@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.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.49.0";
1126
+ declare const VERSION = "0.50.0";
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.49.0";
1126
+ declare const VERSION = "0.50.0";
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
@@ -8878,7 +8878,7 @@ function anchorOffset(handle, w, h) {
8878
8878
  return { x: 0, y: 0 };
8879
8879
  }
8880
8880
  }
8881
- function computeResize(el, handle, world, lastWorld, aspectRatio, shiftKey) {
8881
+ function computeResize(el, handle, world, lastWorld, aspectRatio, lockAspect) {
8882
8882
  const dx = world.x - lastWorld.x;
8883
8883
  const dy = world.y - lastWorld.y;
8884
8884
  let { x, y, w, h } = { x: el.position.x, y: el.position.y, w: el.size.w, h: el.size.h };
@@ -8904,7 +8904,7 @@ function computeResize(el, handle, world, lastWorld, aspectRatio, shiftKey) {
8904
8904
  h -= dy;
8905
8905
  break;
8906
8906
  }
8907
- if (shiftKey && aspectRatio > 0) {
8907
+ if (lockAspect && aspectRatio > 0) {
8908
8908
  const absDw = Math.abs(w - el.size.w);
8909
8909
  const absDh = Math.abs(h - el.size.h);
8910
8910
  if (absDw >= absDh) {
@@ -8929,7 +8929,7 @@ function computeResize(el, handle, world, lastWorld, aspectRatio, shiftKey) {
8929
8929
  }
8930
8930
  return { position: { x, y }, size: { w, h } };
8931
8931
  }
8932
- function computeRotatedResize(el, handle, angle, world, lastWorld, aspectRatio, shiftKey) {
8932
+ function computeRotatedResize(el, handle, angle, world, lastWorld, aspectRatio, lockAspect) {
8933
8933
  const wdx = world.x - lastWorld.x;
8934
8934
  const wdy = world.y - lastWorld.y;
8935
8935
  const cosN = Math.cos(-angle);
@@ -8956,7 +8956,7 @@ function computeRotatedResize(el, handle, angle, world, lastWorld, aspectRatio,
8956
8956
  h -= ldy;
8957
8957
  break;
8958
8958
  }
8959
- if (shiftKey && aspectRatio > 0) {
8959
+ if (lockAspect && aspectRatio > 0) {
8960
8960
  const absDw = Math.abs(w - el.size.w);
8961
8961
  const absDh = Math.abs(h - el.size.h);
8962
8962
  if (absDw >= absDh) h = w / aspectRatio;
@@ -9486,6 +9486,7 @@ var SelectTool = class {
9486
9486
  if (this.mode.type !== "resizing") return;
9487
9487
  const el = ctx.store.getById(this.mode.elementId);
9488
9488
  if (!el || !("size" in el) || el.locked) return;
9489
+ const lockAspect = shiftKey !== (el.type === "image");
9489
9490
  const angle = el.rotation ?? 0;
9490
9491
  const patch = angle !== 0 ? computeRotatedResize(
9491
9492
  el,
@@ -9494,14 +9495,14 @@ var SelectTool = class {
9494
9495
  world,
9495
9496
  this.lastWorld,
9496
9497
  this.resizeAspectRatio,
9497
- shiftKey
9498
+ lockAspect
9498
9499
  ) : computeResize(
9499
9500
  el,
9500
9501
  this.mode.handle,
9501
9502
  world,
9502
9503
  this.lastWorld,
9503
9504
  this.resizeAspectRatio,
9504
- shiftKey
9505
+ lockAspect
9505
9506
  );
9506
9507
  this.lastWorld = world;
9507
9508
  ctx.store.update(this.mode.elementId, patch);
@@ -10526,7 +10527,7 @@ var LaserTool = class {
10526
10527
  };
10527
10528
 
10528
10529
  // src/index.ts
10529
- var VERSION = "0.49.0";
10530
+ var VERSION = "0.50.0";
10530
10531
  export {
10531
10532
  ArrowTool,
10532
10533
  AutoSave,