Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
OrionReed committed Dec 3, 2024
1 parent 5585183 commit e9a5edf
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions src/folk-shape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,11 +429,6 @@ export class FolkShape extends HTMLElement {
const unrotatedHandle = Vector.rotateAround(mouse, 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 = {
'resize-se': {
flipX: unrotatedHandle.x < unrotatedAnchor.x,
Expand Down Expand Up @@ -466,7 +461,6 @@ export class FolkShape extends HTMLElement {
const hasFlippedY = behavior.flipY;

if (hasFlippedX || hasFlippedY) {
console.log('negative');
const nextHandle = hasFlippedX ? behavior.handleX : behavior.handleY;
const newTarget = this.#shadow.querySelector(`[part="${nextHandle}"]`) as HTMLElement;

Expand All @@ -481,19 +475,16 @@ export class FolkShape extends HTMLElement {
newTarget.addEventListener('pointermove', this);
newTarget.addEventListener('lostpointercapture', this);

console.log('target', target, 'newTarget', newTarget);

// Transfer pointer capture
target.releasePointerCapture(event.pointerId);
newTarget.setPointerCapture(event.pointerId);
}
}

this.x = newX;
this.y = newY;
this.width = newWidth;
this.height = newHeight;

this.x = Math.min(unrotatedHandle.x, unrotatedAnchor.x);
this.y = Math.min(unrotatedHandle.y, unrotatedAnchor.y);
this.width = Math.abs(unrotatedAnchor.x - unrotatedHandle.x);
this.height = Math.abs(unrotatedAnchor.y - unrotatedHandle.y);
return;
}

Expand Down

0 comments on commit e9a5edf

Please sign in to comment.