@fieldnotes/core 0.50.3 → 0.50.4
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 +26 -18
- 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 +26 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -8447,7 +8447,8 @@ function hitTestArrowHandles(world, selectedIds, ctx) {
|
|
|
8447
8447
|
const hitRadius = (HANDLE_RADIUS + HANDLE_HIT_PADDING) / zoom;
|
|
8448
8448
|
for (const id of selectedIds) {
|
|
8449
8449
|
const el = ctx.store.getById(id);
|
|
8450
|
-
if (!el || el.type !== "arrow")
|
|
8450
|
+
if (!el || el.type !== "arrow" || el.locked || (ctx.isLayerLocked?.(el.layerId) ?? false))
|
|
8451
|
+
continue;
|
|
8451
8452
|
const handles = getArrowHandlePositions(el);
|
|
8452
8453
|
for (const [handle, pos] of handles) {
|
|
8453
8454
|
const dx = world.x - pos.x;
|
|
@@ -8461,7 +8462,7 @@ function hitTestArrowHandles(world, selectedIds, ctx) {
|
|
|
8461
8462
|
}
|
|
8462
8463
|
function applyArrowHandleDrag(handle, elementId, world, ctx) {
|
|
8463
8464
|
const el = ctx.store.getById(elementId);
|
|
8464
|
-
if (!el || el.type !== "arrow") return;
|
|
8465
|
+
if (!el || el.type !== "arrow" || el.locked || (ctx.isLayerLocked?.(el.layerId) ?? false)) return;
|
|
8465
8466
|
const threshold = BIND_THRESHOLD / ctx.camera.zoom;
|
|
8466
8467
|
const layerFilter = (candidate) => candidate.layerId === el.layerId;
|
|
8467
8468
|
switch (handle) {
|
|
@@ -8512,7 +8513,9 @@ function applyArrowHandleDrag(handle, elementId, world, ctx) {
|
|
|
8512
8513
|
function getArrowHandleDragTarget(handle, elementId, world, ctx) {
|
|
8513
8514
|
if (handle === "mid") return null;
|
|
8514
8515
|
const el = ctx.store.getById(elementId);
|
|
8515
|
-
if (!el || el.type !== "arrow")
|
|
8516
|
+
if (!el || el.type !== "arrow" || el.locked || (ctx.isLayerLocked?.(el.layerId) ?? false)) {
|
|
8517
|
+
return null;
|
|
8518
|
+
}
|
|
8516
8519
|
const threshold = BIND_THRESHOLD / ctx.camera.zoom;
|
|
8517
8520
|
const excludeId = handle === "start" ? el.toBinding?.elementId : el.fromBinding?.elementId;
|
|
8518
8521
|
const layerFilter = (candidate) => candidate.layerId === el.layerId;
|
|
@@ -8704,22 +8707,25 @@ function renderSelectionBoxes(ctx, p) {
|
|
|
8704
8707
|
for (const id of p.selectedIds) {
|
|
8705
8708
|
const el = p.store.getById(id);
|
|
8706
8709
|
if (!el) continue;
|
|
8710
|
+
const locked = el.locked || (p.isLayerLocked?.(el.layerId) ?? false);
|
|
8707
8711
|
if (el.type === "arrow") {
|
|
8708
|
-
renderArrowHandles(ctx, el, zoom);
|
|
8712
|
+
if (!locked) renderArrowHandles(ctx, el, zoom);
|
|
8709
8713
|
renderBindingHighlights(ctx, el, zoom, p.store);
|
|
8710
8714
|
continue;
|
|
8711
8715
|
}
|
|
8712
8716
|
if (el.type === "shape" && el.shape === "line") {
|
|
8713
|
-
|
|
8714
|
-
|
|
8715
|
-
|
|
8716
|
-
|
|
8717
|
-
|
|
8718
|
-
|
|
8719
|
-
|
|
8720
|
-
|
|
8717
|
+
if (!locked) {
|
|
8718
|
+
ctx.setLineDash([]);
|
|
8719
|
+
ctx.fillStyle = "#ffffff";
|
|
8720
|
+
const r = handleWorldSize / 2;
|
|
8721
|
+
for (const pt of lineEndpoints(el)) {
|
|
8722
|
+
ctx.beginPath();
|
|
8723
|
+
ctx.arc(pt.x, pt.y, r, 0, Math.PI * 2);
|
|
8724
|
+
ctx.fill();
|
|
8725
|
+
ctx.stroke();
|
|
8726
|
+
}
|
|
8727
|
+
ctx.setLineDash([4 / zoom, 4 / zoom]);
|
|
8721
8728
|
}
|
|
8722
|
-
ctx.setLineDash([4 / zoom, 4 / zoom]);
|
|
8723
8729
|
continue;
|
|
8724
8730
|
}
|
|
8725
8731
|
const bounds = getElementBounds(el);
|
|
@@ -8954,7 +8960,8 @@ function hitTestLineHandles(world, ctx, selectedIds) {
|
|
|
8954
8960
|
const r2 = r * r;
|
|
8955
8961
|
for (const id of selectedIds) {
|
|
8956
8962
|
const el = ctx.store.getById(id);
|
|
8957
|
-
if (!el || el.type !== "shape" || el.shape !== "line")
|
|
8963
|
+
if (!el || el.type !== "shape" || el.shape !== "line" || el.locked || (ctx.isLayerLocked?.(el.layerId) ?? false))
|
|
8964
|
+
continue;
|
|
8958
8965
|
const [a, b] = lineEndpoints(el);
|
|
8959
8966
|
if ((world.x - a.x) ** 2 + (world.y - a.y) ** 2 <= r2) return { elementId: id, fixed: b };
|
|
8960
8967
|
if ((world.x - b.x) ** 2 + (world.y - b.y) ** 2 <= r2) return { elementId: id, fixed: a };
|
|
@@ -9388,10 +9395,10 @@ var SelectTool = class {
|
|
|
9388
9395
|
if (this.mode.type === "line-handle") {
|
|
9389
9396
|
ctx.setCursor?.("grabbing");
|
|
9390
9397
|
const el = ctx.store.getById(this.mode.elementId);
|
|
9391
|
-
if (el && el.type === "shape") {
|
|
9398
|
+
if (el && el.type === "shape" && el.shape === "line" && !el.locked && !(ctx.isLayerLocked?.(el.layerId) ?? false)) {
|
|
9392
9399
|
ctx.store.update(el.id, lineFromEndpoints(this.mode.fixed, world));
|
|
9400
|
+
ctx.requestRender();
|
|
9393
9401
|
}
|
|
9394
|
-
ctx.requestRender();
|
|
9395
9402
|
return;
|
|
9396
9403
|
}
|
|
9397
9404
|
if (this.mode.type === "resizing-template") {
|
|
@@ -9549,7 +9556,8 @@ var SelectTool = class {
|
|
|
9549
9556
|
renderSelectionBoxes(canvasCtx, {
|
|
9550
9557
|
selectedIds: this._selectedIds,
|
|
9551
9558
|
store: this.ctx.store,
|
|
9552
|
-
zoom: this.ctx.camera.zoom
|
|
9559
|
+
zoom: this.ctx.camera.zoom,
|
|
9560
|
+
isLayerLocked: this.ctx.isLayerLocked
|
|
9553
9561
|
});
|
|
9554
9562
|
if (this.mode.type === "arrow-handle" && this.ctx) {
|
|
9555
9563
|
const target = getArrowHandleDragTarget(
|
|
@@ -10706,7 +10714,7 @@ var LaserTool = class {
|
|
|
10706
10714
|
};
|
|
10707
10715
|
|
|
10708
10716
|
// src/index.ts
|
|
10709
|
-
var VERSION = "0.50.
|
|
10717
|
+
var VERSION = "0.50.4";
|
|
10710
10718
|
// Annotate the CommonJS export names for ESM import in node:
|
|
10711
10719
|
0 && (module.exports = {
|
|
10712
10720
|
ArrowTool,
|