@fieldnotes/core 0.36.0 → 0.37.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
@@ -1011,6 +1011,6 @@ declare class TemplateTool implements Tool {
1011
1011
  private notifyOptionsChange;
1012
1012
  }
1013
1013
 
1014
- declare const VERSION = "0.36.0";
1014
+ declare const VERSION = "0.37.0";
1015
1015
 
1016
1016
  export { type ActiveFormats, type AlignEdge, type ArrowElement, 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, ElementStore, type ElementStyle, type ElementType, type ElementUpdateEvent, EraserTool, type EraserToolOptions, type ExportImageOptions, type FontSizePreset, type GridElement, type GridInfo, HandTool, type HexOrientation, HistoryStack, type HistoryStackOptions, type HtmlElement, type ImageElement, ImageTool, type ImageToolOptions, type Layer, LayerManager, MeasureTool, type MeasureToolOptions, type Measurement, type NoteElement, NoteTool, type NoteToolOptions, PencilTool, type PencilToolOptions, type Point, type PointerState, type RenderStatsSnapshot, SelectTool, type ShapeElement, type ShapeKind, ShapeTool, type ShapeToolOptions, type ShortcutBindings, type ShortcutOptions, type ShortcutsApi, type Size, type StrokeElement, type StrokePoint, type TemplateElement, 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, getActiveFormats, getArrowBounds, getArrowControlPoint, getArrowMidpoint, getArrowTangentAngle, getBendFromPoint, getElementBounds, getElementStyle, getElementsBoundingBox, getHexCellsInCone, getHexCellsInLine, getHexCellsInRadius, getHexCellsInSquare, getHexDistance, isNearBezier, setFontSize, smartSnap, snapPoint, snapToHexCenter, styleToPatch, toggleBold, toggleItalic, toggleStrikethrough, toggleUnderline };
package/dist/index.d.ts CHANGED
@@ -1011,6 +1011,6 @@ declare class TemplateTool implements Tool {
1011
1011
  private notifyOptionsChange;
1012
1012
  }
1013
1013
 
1014
- declare const VERSION = "0.36.0";
1014
+ declare const VERSION = "0.37.0";
1015
1015
 
1016
1016
  export { type ActiveFormats, type AlignEdge, type ArrowElement, 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, ElementStore, type ElementStyle, type ElementType, type ElementUpdateEvent, EraserTool, type EraserToolOptions, type ExportImageOptions, type FontSizePreset, type GridElement, type GridInfo, HandTool, type HexOrientation, HistoryStack, type HistoryStackOptions, type HtmlElement, type ImageElement, ImageTool, type ImageToolOptions, type Layer, LayerManager, MeasureTool, type MeasureToolOptions, type Measurement, type NoteElement, NoteTool, type NoteToolOptions, PencilTool, type PencilToolOptions, type Point, type PointerState, type RenderStatsSnapshot, SelectTool, type ShapeElement, type ShapeKind, ShapeTool, type ShapeToolOptions, type ShortcutBindings, type ShortcutOptions, type ShortcutsApi, type Size, type StrokeElement, type StrokePoint, type TemplateElement, 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, getActiveFormats, getArrowBounds, getArrowControlPoint, getArrowMidpoint, getArrowTangentAngle, getBendFromPoint, getElementBounds, getElementStyle, getElementsBoundingBox, getHexCellsInCone, getHexCellsInLine, getHexCellsInRadius, getHexCellsInSquare, getHexDistance, isNearBezier, setFontSize, smartSnap, snapPoint, snapToHexCenter, styleToPatch, toggleBold, toggleItalic, toggleStrikethrough, toggleUnderline };
package/dist/index.js CHANGED
@@ -2002,9 +2002,10 @@ var Quadtree = class {
2002
2002
  };
2003
2003
 
2004
2004
  // src/elements/stroke-smoothing.ts
2005
- var MIN_PRESSURE_SCALE = 0.2;
2005
+ var MIN_PRESSURE_SCALE = 0.4;
2006
+ var MAX_PRESSURE_SCALE = 1.8;
2006
2007
  function pressureToWidth(pressure, baseWidth) {
2007
- return baseWidth * (MIN_PRESSURE_SCALE + (1 - MIN_PRESSURE_SCALE) * pressure);
2008
+ return baseWidth * (MIN_PRESSURE_SCALE + (MAX_PRESSURE_SCALE - MIN_PRESSURE_SCALE) * pressure);
2008
2009
  }
2009
2010
  function simplifyPoints(points, tolerance) {
2010
2011
  if (points.length <= 2) return points.slice();
@@ -3667,12 +3668,33 @@ var NoteToolbar = class {
3667
3668
  e.stopPropagation();
3668
3669
  });
3669
3670
  select.addEventListener("change", () => {
3670
- setFontSize(Number(select.value));
3671
+ this.applyFontSize(Number(select.value));
3671
3672
  this.updateActiveStates();
3672
3673
  this.anchor?.focus();
3673
3674
  });
3674
3675
  return select;
3675
3676
  }
3677
+ applyFontSize(size) {
3678
+ const sel = window.getSelection();
3679
+ const collapsed = !sel || sel.rangeCount === 0 || sel.getRangeAt(0).collapsed;
3680
+ if (collapsed && this.anchor) {
3681
+ const range = document.createRange();
3682
+ range.selectNodeContents(this.anchor);
3683
+ sel?.removeAllRanges();
3684
+ sel?.addRange(range);
3685
+ setFontSize(size);
3686
+ const after = window.getSelection();
3687
+ if (after) {
3688
+ const caret = document.createRange();
3689
+ caret.selectNodeContents(this.anchor);
3690
+ caret.collapse(false);
3691
+ after.removeAllRanges();
3692
+ after.addRange(caret);
3693
+ }
3694
+ return;
3695
+ }
3696
+ setFontSize(size);
3697
+ }
3676
3698
  positionToolbar(anchor) {
3677
3699
  if (!this.el) return;
3678
3700
  const rect = anchor.getBoundingClientRect();
@@ -8818,7 +8840,7 @@ var TemplateTool = class {
8818
8840
  };
8819
8841
 
8820
8842
  // src/index.ts
8821
- var VERSION = "0.36.0";
8843
+ var VERSION = "0.37.0";
8822
8844
  export {
8823
8845
  ArrowTool,
8824
8846
  AutoSave,