@fieldnotes/core 0.49.0 → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +8 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -8965,7 +8965,7 @@ function anchorOffset(handle, w, h) {
|
|
|
8965
8965
|
return { x: 0, y: 0 };
|
|
8966
8966
|
}
|
|
8967
8967
|
}
|
|
8968
|
-
function computeResize(el, handle, world, lastWorld, aspectRatio,
|
|
8968
|
+
function computeResize(el, handle, world, lastWorld, aspectRatio, lockAspect) {
|
|
8969
8969
|
const dx = world.x - lastWorld.x;
|
|
8970
8970
|
const dy = world.y - lastWorld.y;
|
|
8971
8971
|
let { x, y, w, h } = { x: el.position.x, y: el.position.y, w: el.size.w, h: el.size.h };
|
|
@@ -8991,7 +8991,7 @@ function computeResize(el, handle, world, lastWorld, aspectRatio, shiftKey) {
|
|
|
8991
8991
|
h -= dy;
|
|
8992
8992
|
break;
|
|
8993
8993
|
}
|
|
8994
|
-
if (
|
|
8994
|
+
if (lockAspect && aspectRatio > 0) {
|
|
8995
8995
|
const absDw = Math.abs(w - el.size.w);
|
|
8996
8996
|
const absDh = Math.abs(h - el.size.h);
|
|
8997
8997
|
if (absDw >= absDh) {
|
|
@@ -9016,7 +9016,7 @@ function computeResize(el, handle, world, lastWorld, aspectRatio, shiftKey) {
|
|
|
9016
9016
|
}
|
|
9017
9017
|
return { position: { x, y }, size: { w, h } };
|
|
9018
9018
|
}
|
|
9019
|
-
function computeRotatedResize(el, handle, angle, world, lastWorld, aspectRatio,
|
|
9019
|
+
function computeRotatedResize(el, handle, angle, world, lastWorld, aspectRatio, lockAspect) {
|
|
9020
9020
|
const wdx = world.x - lastWorld.x;
|
|
9021
9021
|
const wdy = world.y - lastWorld.y;
|
|
9022
9022
|
const cosN = Math.cos(-angle);
|
|
@@ -9043,7 +9043,7 @@ function computeRotatedResize(el, handle, angle, world, lastWorld, aspectRatio,
|
|
|
9043
9043
|
h -= ldy;
|
|
9044
9044
|
break;
|
|
9045
9045
|
}
|
|
9046
|
-
if (
|
|
9046
|
+
if (lockAspect && aspectRatio > 0) {
|
|
9047
9047
|
const absDw = Math.abs(w - el.size.w);
|
|
9048
9048
|
const absDh = Math.abs(h - el.size.h);
|
|
9049
9049
|
if (absDw >= absDh) h = w / aspectRatio;
|
|
@@ -9573,6 +9573,7 @@ var SelectTool = class {
|
|
|
9573
9573
|
if (this.mode.type !== "resizing") return;
|
|
9574
9574
|
const el = ctx.store.getById(this.mode.elementId);
|
|
9575
9575
|
if (!el || !("size" in el) || el.locked) return;
|
|
9576
|
+
const lockAspect = shiftKey !== (el.type === "image");
|
|
9576
9577
|
const angle = el.rotation ?? 0;
|
|
9577
9578
|
const patch = angle !== 0 ? computeRotatedResize(
|
|
9578
9579
|
el,
|
|
@@ -9581,14 +9582,14 @@ var SelectTool = class {
|
|
|
9581
9582
|
world,
|
|
9582
9583
|
this.lastWorld,
|
|
9583
9584
|
this.resizeAspectRatio,
|
|
9584
|
-
|
|
9585
|
+
lockAspect
|
|
9585
9586
|
) : computeResize(
|
|
9586
9587
|
el,
|
|
9587
9588
|
this.mode.handle,
|
|
9588
9589
|
world,
|
|
9589
9590
|
this.lastWorld,
|
|
9590
9591
|
this.resizeAspectRatio,
|
|
9591
|
-
|
|
9592
|
+
lockAspect
|
|
9592
9593
|
);
|
|
9593
9594
|
this.lastWorld = world;
|
|
9594
9595
|
ctx.store.update(this.mode.elementId, patch);
|
|
@@ -10613,7 +10614,7 @@ var LaserTool = class {
|
|
|
10613
10614
|
};
|
|
10614
10615
|
|
|
10615
10616
|
// src/index.ts
|
|
10616
|
-
var VERSION = "0.
|
|
10617
|
+
var VERSION = "0.50.0";
|
|
10617
10618
|
// Annotate the CommonJS export names for ESM import in node:
|
|
10618
10619
|
0 && (module.exports = {
|
|
10619
10620
|
ArrowTool,
|