@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.d.cts
CHANGED
|
@@ -1123,6 +1123,6 @@ declare class LaserTool implements Tool {
|
|
|
1123
1123
|
private notifyOptionsChange;
|
|
1124
1124
|
}
|
|
1125
1125
|
|
|
1126
|
-
declare const VERSION = "0.50.
|
|
1126
|
+
declare const VERSION = "0.50.4";
|
|
1127
1127
|
|
|
1128
1128
|
export { type ActiveFormats, type AlignEdge, type ArrowElement, type ArrowStrokeStyle, ArrowTool, type ArrowToolOptions, AutoSave, type AutoSaveOptions, type BackgroundOptions, type BackgroundPattern, type Binding, type Bounds, Camera, type CameraChangeInfo, type CameraOptions, type CanvasElement, type CanvasState, type Command, DEFAULT_NOTE_FONT_SIZE, type DistributeAxis, type ElementChangeMeta, ElementStore, type ElementStyle, type ElementType, type ElementUpdateEvent, EraserTool, type EraserToolOptions, type ExportImageOptions, type ExportSvgOptions, type FontSizePreset, type GridElement, type GridInfo, HandTool, type HexOrientation, HistoryStack, type HistoryStackOptions, type HtmlElement, type ImageElement, ImageTool, type ImageToolOptions, IndexedDBAdapter, type IndexedDBAdapterOptions, LaserTool, type LaserToolOptions, type Layer, LayerManager, LocalStorageAdapter, MeasureTool, type MeasureToolOptions, type Measurement, MemoryAdapter, type NoteElement, NoteTool, type NoteToolOptions, PencilTool, type PencilToolOptions, type Point, type PointerState, type RenderStatsSnapshot, type RotateDirection, SelectTool, type ShapeElement, type ShapeKind, ShapeTool, type ShapeToolOptions, type ShortcutBindings, type ShortcutOptions, type ShortcutsApi, type Size, type StorageAdapter, type StrokeElement, type StrokePoint, type TemplateElement, type TemplateRenderStyle, type TemplateShape, TemplateTool, type TemplateToolOptions, type TextElement, TextTool, type TextToolOptions, type Tool, type ToolContext, ToolManager, type ToolName, VERSION, Viewport, type ViewportOptions, boundsIntersect, createArrow, createGrid, createHtmlElement, createImage, createNote, createShape, createStroke, createTemplate, createText, drawHexPath, exportImage, exportSvg, getActiveFormats, getArrowBounds, getArrowControlPoint, getArrowMidpoint, getArrowTangentAngle, getBendFromPoint, getElementBounds, getElementStyle, getElementsBoundingBox, getHexCellsInCone, getHexCellsInLine, getHexCellsInRadius, getHexCellsInRectangle, getHexCellsInSquare, getHexDistance, isNearBezier, setFontSize, smartSnap, snapPoint, snapToHexCenter, styleToPatch, toggleBold, toggleItalic, toggleStrikethrough, toggleUnderline };
|
package/dist/index.d.ts
CHANGED
|
@@ -1123,6 +1123,6 @@ declare class LaserTool implements Tool {
|
|
|
1123
1123
|
private notifyOptionsChange;
|
|
1124
1124
|
}
|
|
1125
1125
|
|
|
1126
|
-
declare const VERSION = "0.50.
|
|
1126
|
+
declare const VERSION = "0.50.4";
|
|
1127
1127
|
|
|
1128
1128
|
export { type ActiveFormats, type AlignEdge, type ArrowElement, type ArrowStrokeStyle, ArrowTool, type ArrowToolOptions, AutoSave, type AutoSaveOptions, type BackgroundOptions, type BackgroundPattern, type Binding, type Bounds, Camera, type CameraChangeInfo, type CameraOptions, type CanvasElement, type CanvasState, type Command, DEFAULT_NOTE_FONT_SIZE, type DistributeAxis, type ElementChangeMeta, ElementStore, type ElementStyle, type ElementType, type ElementUpdateEvent, EraserTool, type EraserToolOptions, type ExportImageOptions, type ExportSvgOptions, type FontSizePreset, type GridElement, type GridInfo, HandTool, type HexOrientation, HistoryStack, type HistoryStackOptions, type HtmlElement, type ImageElement, ImageTool, type ImageToolOptions, IndexedDBAdapter, type IndexedDBAdapterOptions, LaserTool, type LaserToolOptions, type Layer, LayerManager, LocalStorageAdapter, MeasureTool, type MeasureToolOptions, type Measurement, MemoryAdapter, type NoteElement, NoteTool, type NoteToolOptions, PencilTool, type PencilToolOptions, type Point, type PointerState, type RenderStatsSnapshot, type RotateDirection, SelectTool, type ShapeElement, type ShapeKind, ShapeTool, type ShapeToolOptions, type ShortcutBindings, type ShortcutOptions, type ShortcutsApi, type Size, type StorageAdapter, type StrokeElement, type StrokePoint, type TemplateElement, type TemplateRenderStyle, type TemplateShape, TemplateTool, type TemplateToolOptions, type TextElement, TextTool, type TextToolOptions, type Tool, type ToolContext, ToolManager, type ToolName, VERSION, Viewport, type ViewportOptions, boundsIntersect, createArrow, createGrid, createHtmlElement, createImage, createNote, createShape, createStroke, createTemplate, createText, drawHexPath, exportImage, exportSvg, getActiveFormats, getArrowBounds, getArrowControlPoint, getArrowMidpoint, getArrowTangentAngle, getBendFromPoint, getElementBounds, getElementStyle, getElementsBoundingBox, getHexCellsInCone, getHexCellsInLine, getHexCellsInRadius, getHexCellsInRectangle, getHexCellsInSquare, getHexDistance, isNearBezier, setFontSize, smartSnap, snapPoint, snapToHexCenter, styleToPatch, toggleBold, toggleItalic, toggleStrikethrough, toggleUnderline };
|
package/dist/index.js
CHANGED
|
@@ -8360,7 +8360,8 @@ function hitTestArrowHandles(world, selectedIds, ctx) {
|
|
|
8360
8360
|
const hitRadius = (HANDLE_RADIUS + HANDLE_HIT_PADDING) / zoom;
|
|
8361
8361
|
for (const id of selectedIds) {
|
|
8362
8362
|
const el = ctx.store.getById(id);
|
|
8363
|
-
if (!el || el.type !== "arrow")
|
|
8363
|
+
if (!el || el.type !== "arrow" || el.locked || (ctx.isLayerLocked?.(el.layerId) ?? false))
|
|
8364
|
+
continue;
|
|
8364
8365
|
const handles = getArrowHandlePositions(el);
|
|
8365
8366
|
for (const [handle, pos] of handles) {
|
|
8366
8367
|
const dx = world.x - pos.x;
|
|
@@ -8374,7 +8375,7 @@ function hitTestArrowHandles(world, selectedIds, ctx) {
|
|
|
8374
8375
|
}
|
|
8375
8376
|
function applyArrowHandleDrag(handle, elementId, world, ctx) {
|
|
8376
8377
|
const el = ctx.store.getById(elementId);
|
|
8377
|
-
if (!el || el.type !== "arrow") return;
|
|
8378
|
+
if (!el || el.type !== "arrow" || el.locked || (ctx.isLayerLocked?.(el.layerId) ?? false)) return;
|
|
8378
8379
|
const threshold = BIND_THRESHOLD / ctx.camera.zoom;
|
|
8379
8380
|
const layerFilter = (candidate) => candidate.layerId === el.layerId;
|
|
8380
8381
|
switch (handle) {
|
|
@@ -8425,7 +8426,9 @@ function applyArrowHandleDrag(handle, elementId, world, ctx) {
|
|
|
8425
8426
|
function getArrowHandleDragTarget(handle, elementId, world, ctx) {
|
|
8426
8427
|
if (handle === "mid") return null;
|
|
8427
8428
|
const el = ctx.store.getById(elementId);
|
|
8428
|
-
if (!el || el.type !== "arrow")
|
|
8429
|
+
if (!el || el.type !== "arrow" || el.locked || (ctx.isLayerLocked?.(el.layerId) ?? false)) {
|
|
8430
|
+
return null;
|
|
8431
|
+
}
|
|
8429
8432
|
const threshold = BIND_THRESHOLD / ctx.camera.zoom;
|
|
8430
8433
|
const excludeId = handle === "start" ? el.toBinding?.elementId : el.fromBinding?.elementId;
|
|
8431
8434
|
const layerFilter = (candidate) => candidate.layerId === el.layerId;
|
|
@@ -8617,22 +8620,25 @@ function renderSelectionBoxes(ctx, p) {
|
|
|
8617
8620
|
for (const id of p.selectedIds) {
|
|
8618
8621
|
const el = p.store.getById(id);
|
|
8619
8622
|
if (!el) continue;
|
|
8623
|
+
const locked = el.locked || (p.isLayerLocked?.(el.layerId) ?? false);
|
|
8620
8624
|
if (el.type === "arrow") {
|
|
8621
|
-
renderArrowHandles(ctx, el, zoom);
|
|
8625
|
+
if (!locked) renderArrowHandles(ctx, el, zoom);
|
|
8622
8626
|
renderBindingHighlights(ctx, el, zoom, p.store);
|
|
8623
8627
|
continue;
|
|
8624
8628
|
}
|
|
8625
8629
|
if (el.type === "shape" && el.shape === "line") {
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
|
|
8630
|
+
if (!locked) {
|
|
8631
|
+
ctx.setLineDash([]);
|
|
8632
|
+
ctx.fillStyle = "#ffffff";
|
|
8633
|
+
const r = handleWorldSize / 2;
|
|
8634
|
+
for (const pt of lineEndpoints(el)) {
|
|
8635
|
+
ctx.beginPath();
|
|
8636
|
+
ctx.arc(pt.x, pt.y, r, 0, Math.PI * 2);
|
|
8637
|
+
ctx.fill();
|
|
8638
|
+
ctx.stroke();
|
|
8639
|
+
}
|
|
8640
|
+
ctx.setLineDash([4 / zoom, 4 / zoom]);
|
|
8634
8641
|
}
|
|
8635
|
-
ctx.setLineDash([4 / zoom, 4 / zoom]);
|
|
8636
8642
|
continue;
|
|
8637
8643
|
}
|
|
8638
8644
|
const bounds = getElementBounds(el);
|
|
@@ -8867,7 +8873,8 @@ function hitTestLineHandles(world, ctx, selectedIds) {
|
|
|
8867
8873
|
const r2 = r * r;
|
|
8868
8874
|
for (const id of selectedIds) {
|
|
8869
8875
|
const el = ctx.store.getById(id);
|
|
8870
|
-
if (!el || el.type !== "shape" || el.shape !== "line")
|
|
8876
|
+
if (!el || el.type !== "shape" || el.shape !== "line" || el.locked || (ctx.isLayerLocked?.(el.layerId) ?? false))
|
|
8877
|
+
continue;
|
|
8871
8878
|
const [a, b] = lineEndpoints(el);
|
|
8872
8879
|
if ((world.x - a.x) ** 2 + (world.y - a.y) ** 2 <= r2) return { elementId: id, fixed: b };
|
|
8873
8880
|
if ((world.x - b.x) ** 2 + (world.y - b.y) ** 2 <= r2) return { elementId: id, fixed: a };
|
|
@@ -9301,10 +9308,10 @@ var SelectTool = class {
|
|
|
9301
9308
|
if (this.mode.type === "line-handle") {
|
|
9302
9309
|
ctx.setCursor?.("grabbing");
|
|
9303
9310
|
const el = ctx.store.getById(this.mode.elementId);
|
|
9304
|
-
if (el && el.type === "shape") {
|
|
9311
|
+
if (el && el.type === "shape" && el.shape === "line" && !el.locked && !(ctx.isLayerLocked?.(el.layerId) ?? false)) {
|
|
9305
9312
|
ctx.store.update(el.id, lineFromEndpoints(this.mode.fixed, world));
|
|
9313
|
+
ctx.requestRender();
|
|
9306
9314
|
}
|
|
9307
|
-
ctx.requestRender();
|
|
9308
9315
|
return;
|
|
9309
9316
|
}
|
|
9310
9317
|
if (this.mode.type === "resizing-template") {
|
|
@@ -9462,7 +9469,8 @@ var SelectTool = class {
|
|
|
9462
9469
|
renderSelectionBoxes(canvasCtx, {
|
|
9463
9470
|
selectedIds: this._selectedIds,
|
|
9464
9471
|
store: this.ctx.store,
|
|
9465
|
-
zoom: this.ctx.camera.zoom
|
|
9472
|
+
zoom: this.ctx.camera.zoom,
|
|
9473
|
+
isLayerLocked: this.ctx.isLayerLocked
|
|
9466
9474
|
});
|
|
9467
9475
|
if (this.mode.type === "arrow-handle" && this.ctx) {
|
|
9468
9476
|
const target = getArrowHandleDragTarget(
|
|
@@ -10619,7 +10627,7 @@ var LaserTool = class {
|
|
|
10619
10627
|
};
|
|
10620
10628
|
|
|
10621
10629
|
// src/index.ts
|
|
10622
|
-
var VERSION = "0.50.
|
|
10630
|
+
var VERSION = "0.50.4";
|
|
10623
10631
|
export {
|
|
10624
10632
|
ArrowTool,
|
|
10625
10633
|
AutoSave,
|