@fieldnotes/core 0.50.3 → 0.50.5
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 +31 -19
- 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 +31 -19
- 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.5";
|
|
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.5";
|
|
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
|
@@ -1945,7 +1945,11 @@ var InputHandler = class {
|
|
|
1945
1945
|
if (this.lastPinchDistance > 0) {
|
|
1946
1946
|
const scale = dist / this.lastPinchDistance;
|
|
1947
1947
|
const newZoom = this.camera.zoom * scale;
|
|
1948
|
-
this.
|
|
1948
|
+
const rect = this.element.getBoundingClientRect();
|
|
1949
|
+
this.camera.zoomAt(newZoom, {
|
|
1950
|
+
x: center2.x - rect.left,
|
|
1951
|
+
y: center2.y - rect.top
|
|
1952
|
+
});
|
|
1949
1953
|
}
|
|
1950
1954
|
const dx = center2.x - this.lastPointer.x;
|
|
1951
1955
|
const dy = center2.y - this.lastPointer.y;
|
|
@@ -8360,7 +8364,8 @@ function hitTestArrowHandles(world, selectedIds, ctx) {
|
|
|
8360
8364
|
const hitRadius = (HANDLE_RADIUS + HANDLE_HIT_PADDING) / zoom;
|
|
8361
8365
|
for (const id of selectedIds) {
|
|
8362
8366
|
const el = ctx.store.getById(id);
|
|
8363
|
-
if (!el || el.type !== "arrow")
|
|
8367
|
+
if (!el || el.type !== "arrow" || el.locked || (ctx.isLayerLocked?.(el.layerId) ?? false))
|
|
8368
|
+
continue;
|
|
8364
8369
|
const handles = getArrowHandlePositions(el);
|
|
8365
8370
|
for (const [handle, pos] of handles) {
|
|
8366
8371
|
const dx = world.x - pos.x;
|
|
@@ -8374,7 +8379,7 @@ function hitTestArrowHandles(world, selectedIds, ctx) {
|
|
|
8374
8379
|
}
|
|
8375
8380
|
function applyArrowHandleDrag(handle, elementId, world, ctx) {
|
|
8376
8381
|
const el = ctx.store.getById(elementId);
|
|
8377
|
-
if (!el || el.type !== "arrow") return;
|
|
8382
|
+
if (!el || el.type !== "arrow" || el.locked || (ctx.isLayerLocked?.(el.layerId) ?? false)) return;
|
|
8378
8383
|
const threshold = BIND_THRESHOLD / ctx.camera.zoom;
|
|
8379
8384
|
const layerFilter = (candidate) => candidate.layerId === el.layerId;
|
|
8380
8385
|
switch (handle) {
|
|
@@ -8425,7 +8430,9 @@ function applyArrowHandleDrag(handle, elementId, world, ctx) {
|
|
|
8425
8430
|
function getArrowHandleDragTarget(handle, elementId, world, ctx) {
|
|
8426
8431
|
if (handle === "mid") return null;
|
|
8427
8432
|
const el = ctx.store.getById(elementId);
|
|
8428
|
-
if (!el || el.type !== "arrow")
|
|
8433
|
+
if (!el || el.type !== "arrow" || el.locked || (ctx.isLayerLocked?.(el.layerId) ?? false)) {
|
|
8434
|
+
return null;
|
|
8435
|
+
}
|
|
8429
8436
|
const threshold = BIND_THRESHOLD / ctx.camera.zoom;
|
|
8430
8437
|
const excludeId = handle === "start" ? el.toBinding?.elementId : el.fromBinding?.elementId;
|
|
8431
8438
|
const layerFilter = (candidate) => candidate.layerId === el.layerId;
|
|
@@ -8617,22 +8624,25 @@ function renderSelectionBoxes(ctx, p) {
|
|
|
8617
8624
|
for (const id of p.selectedIds) {
|
|
8618
8625
|
const el = p.store.getById(id);
|
|
8619
8626
|
if (!el) continue;
|
|
8627
|
+
const locked = el.locked || (p.isLayerLocked?.(el.layerId) ?? false);
|
|
8620
8628
|
if (el.type === "arrow") {
|
|
8621
|
-
renderArrowHandles(ctx, el, zoom);
|
|
8629
|
+
if (!locked) renderArrowHandles(ctx, el, zoom);
|
|
8622
8630
|
renderBindingHighlights(ctx, el, zoom, p.store);
|
|
8623
8631
|
continue;
|
|
8624
8632
|
}
|
|
8625
8633
|
if (el.type === "shape" && el.shape === "line") {
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
|
|
8634
|
+
if (!locked) {
|
|
8635
|
+
ctx.setLineDash([]);
|
|
8636
|
+
ctx.fillStyle = "#ffffff";
|
|
8637
|
+
const r = handleWorldSize / 2;
|
|
8638
|
+
for (const pt of lineEndpoints(el)) {
|
|
8639
|
+
ctx.beginPath();
|
|
8640
|
+
ctx.arc(pt.x, pt.y, r, 0, Math.PI * 2);
|
|
8641
|
+
ctx.fill();
|
|
8642
|
+
ctx.stroke();
|
|
8643
|
+
}
|
|
8644
|
+
ctx.setLineDash([4 / zoom, 4 / zoom]);
|
|
8634
8645
|
}
|
|
8635
|
-
ctx.setLineDash([4 / zoom, 4 / zoom]);
|
|
8636
8646
|
continue;
|
|
8637
8647
|
}
|
|
8638
8648
|
const bounds = getElementBounds(el);
|
|
@@ -8867,7 +8877,8 @@ function hitTestLineHandles(world, ctx, selectedIds) {
|
|
|
8867
8877
|
const r2 = r * r;
|
|
8868
8878
|
for (const id of selectedIds) {
|
|
8869
8879
|
const el = ctx.store.getById(id);
|
|
8870
|
-
if (!el || el.type !== "shape" || el.shape !== "line")
|
|
8880
|
+
if (!el || el.type !== "shape" || el.shape !== "line" || el.locked || (ctx.isLayerLocked?.(el.layerId) ?? false))
|
|
8881
|
+
continue;
|
|
8871
8882
|
const [a, b] = lineEndpoints(el);
|
|
8872
8883
|
if ((world.x - a.x) ** 2 + (world.y - a.y) ** 2 <= r2) return { elementId: id, fixed: b };
|
|
8873
8884
|
if ((world.x - b.x) ** 2 + (world.y - b.y) ** 2 <= r2) return { elementId: id, fixed: a };
|
|
@@ -9301,10 +9312,10 @@ var SelectTool = class {
|
|
|
9301
9312
|
if (this.mode.type === "line-handle") {
|
|
9302
9313
|
ctx.setCursor?.("grabbing");
|
|
9303
9314
|
const el = ctx.store.getById(this.mode.elementId);
|
|
9304
|
-
if (el && el.type === "shape") {
|
|
9315
|
+
if (el && el.type === "shape" && el.shape === "line" && !el.locked && !(ctx.isLayerLocked?.(el.layerId) ?? false)) {
|
|
9305
9316
|
ctx.store.update(el.id, lineFromEndpoints(this.mode.fixed, world));
|
|
9317
|
+
ctx.requestRender();
|
|
9306
9318
|
}
|
|
9307
|
-
ctx.requestRender();
|
|
9308
9319
|
return;
|
|
9309
9320
|
}
|
|
9310
9321
|
if (this.mode.type === "resizing-template") {
|
|
@@ -9462,7 +9473,8 @@ var SelectTool = class {
|
|
|
9462
9473
|
renderSelectionBoxes(canvasCtx, {
|
|
9463
9474
|
selectedIds: this._selectedIds,
|
|
9464
9475
|
store: this.ctx.store,
|
|
9465
|
-
zoom: this.ctx.camera.zoom
|
|
9476
|
+
zoom: this.ctx.camera.zoom,
|
|
9477
|
+
isLayerLocked: this.ctx.isLayerLocked
|
|
9466
9478
|
});
|
|
9467
9479
|
if (this.mode.type === "arrow-handle" && this.ctx) {
|
|
9468
9480
|
const target = getArrowHandleDragTarget(
|
|
@@ -10619,7 +10631,7 @@ var LaserTool = class {
|
|
|
10619
10631
|
};
|
|
10620
10632
|
|
|
10621
10633
|
// src/index.ts
|
|
10622
|
-
var VERSION = "0.50.
|
|
10634
|
+
var VERSION = "0.50.5";
|
|
10623
10635
|
export {
|
|
10624
10636
|
ArrowTool,
|
|
10625
10637
|
AutoSave,
|