Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(item): improves performance of sliding item #9005

Merged
merged 1 commit into from
Nov 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/components/item/item-sliding-gesture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { List } from '../list/list';
import { GesturePriority } from '../../gestures/gesture-controller';
import { PanGesture } from '../../gestures/drag-gesture';
import { pointerCoord } from '../../util/dom';
import { NativeRafDebouncer } from '../../util/debouncer';

const DRAG_THRESHOLD = 10;
const MAX_ATTACK_ANGLE = 20;
Expand All @@ -19,6 +20,8 @@ export class ItemSlidingGesture extends PanGesture {
super(list.getNativeElement(), {
maxAngle: MAX_ATTACK_ANGLE,
threshold: DRAG_THRESHOLD,
zone: false,
debouncer: new NativeRafDebouncer(),
gesture: list._gestureCtrl.create('item-sliding', {
priority: GesturePriority.SlidingItem,
})
Expand Down
5 changes: 4 additions & 1 deletion src/components/item/item-sliding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,10 @@ export class ItemSliding {
}

this.item.setElementStyle(CSS.transform, `translate3d(${-openAmount}px,0,0)`);
this._zone.run(() => this.ionDrag.emit(this));
let ionDrag = this.ionDrag;
if (ionDrag.observers.length > 0) {
this._zone.run(ionDrag.emit.bind(ionDrag, this));
}
}

private _setState(state: SlidingState) {
Expand Down