lesca-click
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -21,3 +21,11 @@ "use strict"; | ||
this.ex_up = ex_up; | ||
this.is_press = false; // if (this.detect() === 'desktop') this.deviation = 0; | ||
this.is_press = false; | ||
this.pageOffset = { | ||
top: 0, | ||
left: 0 | ||
}; | ||
this.pageOffseta = { | ||
top: 0, | ||
left: 0 | ||
}; | ||
@@ -38,4 +46,7 @@ this.down = function (e) { | ||
} | ||
} | ||
} // check element position | ||
_this.pageOffset = _this.pageOffseta = _this.getOffset(e); | ||
_this.ex_down(e); | ||
@@ -65,2 +76,4 @@ | ||
_this.pageOffseta = _this.getOffset(e); | ||
_this.ex_move(e); | ||
@@ -70,4 +83,6 @@ }; | ||
this.up = function (e) { | ||
if (Math.abs(_this.px - _this.mx) <= _this.deviation && Math.abs(_this.py - _this.my) <= _this.deviation) { | ||
_this.get(e); | ||
if (_this.pageOffset.top === _this.pageOffseta.top && _this.pageOffset.left === _this.pageOffseta.left) { | ||
if (Math.abs(_this.px - _this.mx) <= _this.deviation && Math.abs(_this.py - _this.my) <= _this.deviation) { | ||
_this.get(e); | ||
} | ||
} | ||
@@ -172,3 +187,10 @@ | ||
if (m.tablet()) return 'mobile';else if (m.mobile()) return 'mobile';else return 'desktop'; | ||
}, | ||
getOffset: function getOffset(e) { | ||
var rect = e === null || e === void 0 ? void 0 : e.target.getBoundingClientRect(); | ||
return { | ||
top: rect.top + window.scrollY, | ||
left: rect.left + window.scrollX | ||
}; | ||
} | ||
}; |
{ | ||
"name": "lesca-click", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "replace click / touch start on SPY page", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -14,3 +14,4 @@ module.exports = { | ||
// if (this.detect() === 'desktop') this.deviation = 0; | ||
this.pageOffset = { top: 0, left: 0 }; | ||
this.pageOffseta = { top: 0, left: 0 }; | ||
@@ -30,2 +31,6 @@ this.down = (e) => { | ||
} | ||
// check element position | ||
this.pageOffset = this.pageOffseta = this.getOffset(e); | ||
this.ex_down(e); | ||
@@ -53,2 +58,3 @@ this.is_press = true; | ||
} | ||
this.pageOffseta = this.getOffset(e); | ||
this.ex_move(e); | ||
@@ -58,4 +64,6 @@ }; | ||
this.up = (e) => { | ||
if (Math.abs(this.px - this.mx) <= this.deviation && Math.abs(this.py - this.my) <= this.deviation) { | ||
this.get(e); | ||
if (this.pageOffset.top === this.pageOffseta.top && this.pageOffset.left === this.pageOffseta.left) { | ||
if (Math.abs(this.px - this.mx) <= this.deviation && Math.abs(this.py - this.my) <= this.deviation) { | ||
this.get(e); | ||
} | ||
} | ||
@@ -155,2 +163,9 @@ this.is_press = false; | ||
}, | ||
getOffset(e) { | ||
const rect = e?.target.getBoundingClientRect(); | ||
return { | ||
top: rect.top + window.scrollY, | ||
left: rect.left + window.scrollX, | ||
}; | ||
}, | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16698
388