Make sure the path is available when checking for scrolling touch

This commit is contained in:
Hadi Nategh 2023-02-09 17:15:01 +01:00
parent 7343283e12
commit 0d68f87ae3

View File

@ -125,19 +125,23 @@ export class tapAndSwipe {
this._isTapAndHold = false; this._isTapAndHold = false;
this._fingercount = event.touches.length; this._fingercount = event.touches.length;
const scrolledItem = event.path.filter(_item => { if(event.path)
return _item instanceof HTMLElement && this.element.contains(_item) && (_item.scrollTop != 0 || _item.scrollLeft !=0);
});
if (scrolledItem.length>0)
{ {
this._scrolledElementObj = {el: scrolledItem[0], scrollTop: scrolledItem[0].scrollTop, scrollLeft: scrolledItem[0].scrollLeft}; const scrolledItem = event.path.filter(_item => {
} return _item instanceof HTMLElement && this.element.contains(_item) && (_item.scrollTop != 0 || _item.scrollLeft !=0);
else });
{ if (scrolledItem.length>0)
this._scrolledElementObj = null; {
this._scrolledElementObj = {el: scrolledItem[0], scrollTop: scrolledItem[0].scrollTop, scrollLeft: scrolledItem[0].scrollLeft};
}
else
{
this._scrolledElementObj = null;
}
} }
this._tapHoldTimeout = window.setTimeout(_=>{ this._tapHoldTimeout = window.setTimeout(_=>{
this._isTapAndHold = true; this._isTapAndHold = true;
//check scrolling //check scrolling