mirror of
https://github.com/Pomax/BezierInfo-2.git
synced 2025-09-01 20:33:34 +02:00
fricking debugging man
This commit is contained in:
@@ -92,17 +92,23 @@ class BaseAPI {
|
||||
getCursorCoords(evt) {
|
||||
const left = evt.target.offsetLeft,
|
||||
top = evt.target.offsetTop;
|
||||
|
||||
let x, y;
|
||||
|
||||
if (evt.targetTouches) {
|
||||
const touch = evt.targetTouches;
|
||||
for (let i=0; i<touch.length; i++) {
|
||||
console.log(touch[i]);
|
||||
if (!touch[i] || !touch[i].pageX) continue;
|
||||
this.cursor.x = touch[i].pageX - left;
|
||||
this.cursor.y = touch[i].pageY - top;
|
||||
x = touch[i].pageX - left;
|
||||
y = touch[i].pageY - top;
|
||||
}
|
||||
} else {
|
||||
this.cursor.x = evt.pageX - left;
|
||||
this.cursor.y = evt.pageY - top;
|
||||
x = evt.pageX - left;
|
||||
y = evt.pageY - top;
|
||||
}
|
||||
this.cursor.x = x;
|
||||
this.cursor.y = y;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -36,10 +36,18 @@ class GraphicsAPI extends BaseAPI {
|
||||
|
||||
onMouseDown(evt) {
|
||||
super.onMouseDown(evt);
|
||||
|
||||
const cdist = evt.targetTouches ? 10 : 5;
|
||||
|
||||
for (let i = 0, e = this.moveable.length, p; i < e; i++) {
|
||||
p = this.moveable[i];
|
||||
if (new Vector(p).dist(this.cursor) <= 5) {
|
||||
|
||||
console.log(`m check:`, p);
|
||||
|
||||
if (new Vector(p).dist(this.cursor) <= cdist) {
|
||||
this.currentPoint = p;
|
||||
console.log(`current point found`);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user