FIX: Touch issues in iOS
This commit is contained in:
parent
531d649a75
commit
ecb9574a32
|
@ -11,7 +11,7 @@ export default Ember.View.extend({
|
||||||
classNames: ['quote-button'],
|
classNames: ['quote-button'],
|
||||||
classNameBindings: ['visible'],
|
classNameBindings: ['visible'],
|
||||||
isMouseDown: false,
|
isMouseDown: false,
|
||||||
isTouchInProgress: false,
|
_isTouchInProgress: false,
|
||||||
|
|
||||||
// The button is visible whenever there is something in the buffer
|
// The button is visible whenever there is something in the buffer
|
||||||
// (ie. something has been selected)
|
// (ie. something has been selected)
|
||||||
|
@ -59,17 +59,23 @@ export default Ember.View.extend({
|
||||||
}).on('selectionchange', () => {
|
}).on('selectionchange', () => {
|
||||||
// there is no need to handle this event when the mouse is down
|
// there is no need to handle this event when the mouse is down
|
||||||
// or if there a touch in progress
|
// or if there a touch in progress
|
||||||
if (this.get('isMouseDown') || this.get('isTouchInProgress')) { return; }
|
if (this.get('isMouseDown') || this._isTouchInProgress) { return; }
|
||||||
// `selection.anchorNode` is used as a target
|
// `selection.anchorNode` is used as a target
|
||||||
onSelectionChanged();
|
onSelectionChanged();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Android is dodgy, touchend often will not fire
|
// Android is dodgy, touchend often will not fire
|
||||||
// https://code.google.com/p/android/issues/detail?id=19827
|
// https://code.google.com/p/android/issues/detail?id=19827
|
||||||
if (!isAndroid) {
|
if (!this.isAndroid) {
|
||||||
$(document)
|
$(document).on('touchstart.quote-button', () => {
|
||||||
.on('touchstart.quote-button', () => this.set('isTouchInProgress', true))
|
this._isTouchInProgress = true;
|
||||||
.on('touchend.quote-button', () => this.set('isTouchInProgress', false));
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('touchend.quote-button', () => {
|
||||||
|
this._isTouchInProgress = false;
|
||||||
|
return true;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue