mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 05:21:52 +08:00
fix(gestures): drag events are debounced
- Performance regressions in menu, sliding item, toggle, go back swipe and scroll up to refresh. - Buggy sliding item
This commit is contained in:
@ -315,12 +315,7 @@ export class ItemSliding {
|
||||
openAmount = optsWidth + (openAmount - optsWidth) * ELASTIC_FACTOR;
|
||||
}
|
||||
|
||||
// this.debouncer.write(() => {
|
||||
|
||||
// });
|
||||
this._dom.write(() => {
|
||||
this._setOpenAmount(openAmount, false);
|
||||
});
|
||||
|
||||
return openAmount;
|
||||
}
|
||||
@ -362,7 +357,6 @@ export class ItemSliding {
|
||||
* @private
|
||||
*/
|
||||
private calculateOptsWidth() {
|
||||
this._plt.raf(() => {
|
||||
if (!this._optsDirty) {
|
||||
return;
|
||||
}
|
||||
@ -378,13 +372,15 @@ export class ItemSliding {
|
||||
assert(this._optsWidthLeftSide > 0, '_optsWidthLeftSide should not be zero');
|
||||
}
|
||||
this._optsDirty = false;
|
||||
});
|
||||
}
|
||||
|
||||
private _setOpenAmount(openAmount: number, isFinal: boolean) {
|
||||
const platform = this._plt;
|
||||
|
||||
if (this._tmr) {
|
||||
platform.cancelTimeout(this._tmr);
|
||||
this._tmr = null;
|
||||
}
|
||||
this._openAmount = openAmount;
|
||||
|
||||
if (isFinal) {
|
||||
|
@ -110,7 +110,9 @@ export class PanGesture {
|
||||
pointerMove(ev: any) {
|
||||
assert(this.started === true, 'started must be true');
|
||||
if (this.captured) {
|
||||
this.debouncer.write(() => {
|
||||
this.onDragMove(ev);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user