cleanup
This commit is contained in:
parent
55851839f0
commit
e9a5edf787
|
|
@ -429,11 +429,6 @@ export class FolkShape extends HTMLElement {
|
||||||
const unrotatedHandle = Vector.rotateAround(mouse, newCenter, -this.rotation);
|
const unrotatedHandle = Vector.rotateAround(mouse, newCenter, -this.rotation);
|
||||||
const unrotatedAnchor = Vector.rotateAround(oppositeCorner, newCenter, -this.rotation);
|
const unrotatedAnchor = Vector.rotateAround(oppositeCorner, newCenter, -this.rotation);
|
||||||
|
|
||||||
let newX = Math.min(unrotatedHandle.x, unrotatedAnchor.x);
|
|
||||||
let newY = Math.min(unrotatedHandle.y, unrotatedAnchor.y);
|
|
||||||
let newWidth = Math.abs(unrotatedAnchor.x - unrotatedHandle.x);
|
|
||||||
let newHeight = Math.abs(unrotatedAnchor.y - unrotatedHandle.y);
|
|
||||||
|
|
||||||
const HANDLE_BEHAVIOR = {
|
const HANDLE_BEHAVIOR = {
|
||||||
'resize-se': {
|
'resize-se': {
|
||||||
flipX: unrotatedHandle.x < unrotatedAnchor.x,
|
flipX: unrotatedHandle.x < unrotatedAnchor.x,
|
||||||
|
|
@ -466,7 +461,6 @@ export class FolkShape extends HTMLElement {
|
||||||
const hasFlippedY = behavior.flipY;
|
const hasFlippedY = behavior.flipY;
|
||||||
|
|
||||||
if (hasFlippedX || hasFlippedY) {
|
if (hasFlippedX || hasFlippedY) {
|
||||||
console.log('negative');
|
|
||||||
const nextHandle = hasFlippedX ? behavior.handleX : behavior.handleY;
|
const nextHandle = hasFlippedX ? behavior.handleX : behavior.handleY;
|
||||||
const newTarget = this.#shadow.querySelector(`[part="${nextHandle}"]`) as HTMLElement;
|
const newTarget = this.#shadow.querySelector(`[part="${nextHandle}"]`) as HTMLElement;
|
||||||
|
|
||||||
|
|
@ -481,19 +475,16 @@ export class FolkShape extends HTMLElement {
|
||||||
newTarget.addEventListener('pointermove', this);
|
newTarget.addEventListener('pointermove', this);
|
||||||
newTarget.addEventListener('lostpointercapture', this);
|
newTarget.addEventListener('lostpointercapture', this);
|
||||||
|
|
||||||
console.log('target', target, 'newTarget', newTarget);
|
|
||||||
|
|
||||||
// Transfer pointer capture
|
// Transfer pointer capture
|
||||||
target.releasePointerCapture(event.pointerId);
|
target.releasePointerCapture(event.pointerId);
|
||||||
newTarget.setPointerCapture(event.pointerId);
|
newTarget.setPointerCapture(event.pointerId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.x = newX;
|
this.x = Math.min(unrotatedHandle.x, unrotatedAnchor.x);
|
||||||
this.y = newY;
|
this.y = Math.min(unrotatedHandle.y, unrotatedAnchor.y);
|
||||||
this.width = newWidth;
|
this.width = Math.abs(unrotatedAnchor.x - unrotatedHandle.x);
|
||||||
this.height = newHeight;
|
this.height = Math.abs(unrotatedAnchor.y - unrotatedHandle.y);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue