minor change
This commit is contained in:
parent
d52f569110
commit
54707a238d
|
|
@ -417,25 +417,28 @@ export class FolkShape extends HTMLElement {
|
||||||
|
|
||||||
if (handle.includes('resize')) {
|
if (handle.includes('resize')) {
|
||||||
const { clientX, clientY } = event;
|
const { clientX, clientY } = event;
|
||||||
const [topLeft, topRight, bottomRight, bottomLeft] = this.getClientRect().corners();
|
|
||||||
|
const [topLeft] = this.getClientRect().corners();
|
||||||
|
|
||||||
const newCenter: Point = {
|
const newCenter: Point = {
|
||||||
x: (topLeft.x + clientX) / 2,
|
x: (topLeft.x + clientX) / 2,
|
||||||
y: (topLeft.y + clientY) / 2,
|
y: (topLeft.y + clientY) / 2,
|
||||||
};
|
};
|
||||||
const newTopLeft = Vector.rotateAround(topLeft, newCenter, -this.rotation);
|
const newTopLeft = Vector.rotateAround(topLeft, newCenter, -this.rotation);
|
||||||
|
|
||||||
let bottomRightAdjusted: Point;
|
let bottomRight: Point;
|
||||||
|
|
||||||
if (handle.endsWith('nw')) {
|
if (handle.endsWith('nw')) {
|
||||||
bottomRightAdjusted = { x: clientX, y: clientY };
|
bottomRight = { x: clientX, y: clientY };
|
||||||
} else if (handle.endsWith('ne')) {
|
} else if (handle.endsWith('ne')) {
|
||||||
bottomRightAdjusted = { x: clientX, y: clientY };
|
bottomRight = { x: clientX, y: clientY };
|
||||||
} else if (handle.endsWith('se')) {
|
} else if (handle.endsWith('se')) {
|
||||||
bottomRightAdjusted = { x: clientX, y: clientY };
|
bottomRight = { x: clientX, y: clientY };
|
||||||
} else {
|
} else {
|
||||||
bottomRightAdjusted = { x: clientX, y: clientY };
|
bottomRight = { x: clientX, y: clientY };
|
||||||
}
|
}
|
||||||
const newBottomRight = Vector.rotateAround(bottomRightAdjusted, newCenter, -this.rotation);
|
|
||||||
|
const newBottomRight = Vector.rotateAround(bottomRight, newCenter, -this.rotation);
|
||||||
|
|
||||||
this.x = newTopLeft.x;
|
this.x = newTopLeft.x;
|
||||||
this.y = newTopLeft.y;
|
this.y = newTopLeft.y;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue