mirror of
https://github.com/pshihn/planar-range.git
synced 2026-01-10 06:18:01 -05:00
fixed relative positioning
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "planar-range",
|
||||
"version": "0.3.1",
|
||||
"version": "0.3.2",
|
||||
"description": "A 2D range component ",
|
||||
"main": "lib/planar-range.js",
|
||||
"module": "lib/planar-range.js",
|
||||
@@ -32,4 +32,4 @@
|
||||
"dependencies": {
|
||||
"pointer-tracker": "^2.3.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -173,8 +173,8 @@ export class PlanarRange extends HTMLElement {
|
||||
if (pointer) {
|
||||
const w = viewAnchor[2];
|
||||
const h = viewAnchor[3];
|
||||
const newX = w ? ((pointer.pageX - viewAnchor[0]) / w) : 0;
|
||||
const newY = h ? ((pointer.pageY - viewAnchor[1]) / h) : 0;
|
||||
const newX = w ? ((pointer.clientX - viewAnchor[0]) / w) : 0;
|
||||
const newY = h ? ((pointer.clientY - viewAnchor[1]) / h) : 0;
|
||||
if ((newX !== t.x) || (newY !== t.y)) {
|
||||
if (this.validator) {
|
||||
t.setValue(this.validator([newX, newY], [t.x, t.y], t.getAttribute('name') || null), true);
|
||||
|
||||
Reference in New Issue
Block a user