mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
fix(item): sliding items works with mouse. Fixes #286
This commit is contained in:
@ -143,7 +143,6 @@ export class ItemSliding {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ItemSlideGesture extends DragGesture {
|
class ItemSlideGesture extends DragGesture {
|
||||||
constructor(item: ItemSliding, el: Element, zone) {
|
constructor(item: ItemSliding, el: Element, zone) {
|
||||||
super(el, {
|
super(el, {
|
||||||
@ -156,20 +155,23 @@ class ItemSlideGesture extends DragGesture {
|
|||||||
this.listen();
|
this.listen();
|
||||||
|
|
||||||
zone.runOutsideAngular(() => {
|
zone.runOutsideAngular(() => {
|
||||||
el.addEventListener('touchstart', (e) => {
|
let touchStart = (e) => {
|
||||||
this.item.didTouch();
|
this.item.didTouch();
|
||||||
raf(() => {
|
raf(() => {
|
||||||
this.item.itemOptionsWidth = this.item.itemOptions && this.item.itemOptions.offsetWidth || 0;
|
this.item.itemOptionsWidth = this.item.itemOptions && this.item.itemOptions.offsetWidth || 0;
|
||||||
})
|
})
|
||||||
});
|
};
|
||||||
|
el.addEventListener('touchstart', touchStart);
|
||||||
|
el.addEventListener('mousedown', touchStart);
|
||||||
|
|
||||||
el.addEventListener('touchend', (e) => {
|
let touchEnd = (e) => {
|
||||||
this.item.didClose = false;
|
this.item.didClose = false;
|
||||||
});
|
};
|
||||||
|
el.addEventListener('touchend', touchEnd);
|
||||||
el.addEventListener('touchcancel', (e) => {
|
el.addEventListener('mouseup', touchEnd);
|
||||||
this.item.didClose = false;
|
el.addEventListener('mouseout', touchEnd);
|
||||||
});
|
el.addEventListener('mouseleave', touchEnd);
|
||||||
|
el.addEventListener('touchcancel', touchEnd);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user