@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.cjs CHANGED
@@ -2083,9 +2083,10 @@ var Quadtree = class {
2083
2083
  };
2084
2084
 
2085
2085
  // src/elements/stroke-smoothing.ts
2086
- var MIN_PRESSURE_SCALE = 0.2;
2086
+ var MIN_PRESSURE_SCALE = 0.4;
2087
+ var MAX_PRESSURE_SCALE = 1.8;
2087
2088
  function pressureToWidth(pressure, baseWidth) {
2088
- return baseWidth * (MIN_PRESSURE_SCALE + (1 - MIN_PRESSURE_SCALE) * pressure);
2089
+ return baseWidth * (MIN_PRESSURE_SCALE + (MAX_PRESSURE_SCALE - MIN_PRESSURE_SCALE) * pressure);
2089
2090
  }
2090
2091
  function simplifyPoints(points, tolerance) {
2091
2092
  if (points.length <= 2) return points.slice();
@@ -3748,12 +3749,33 @@ var NoteToolbar = class {
3748
3749
  e.stopPropagation();
3749
3750
  });
3750
3751
  select.addEventListener("change", () => {
3751
- setFontSize(Number(select.value));
3752
+ this.applyFontSize(Number(select.value));
3752
3753
  this.updateActiveStates();
3753
3754
  this.anchor?.focus();
3754
3755
  });
3755
3756
  return select;
3756
3757
  }
3758
+ applyFontSize(size) {
3759
+ const sel = window.getSelection();
3760
+ const collapsed = !sel || sel.rangeCount === 0 || sel.getRangeAt(0).collapsed;
3761
+ if (collapsed && this.anchor) {
3762
+ const range = document.createRange();
3763
+ range.selectNodeContents(this.anchor);
3764
+ sel?.removeAllRanges();
3765
+ sel?.addRange(range);
3766
+ setFontSize(size);
3767
+ const after = window.getSelection();
3768
+ if (after) {
3769
+ const caret = document.createRange();
3770
+ caret.selectNodeContents(this.anchor);
3771
+ caret.collapse(false);
3772
+ after.removeAllRanges();
3773
+ after.addRange(caret);
3774
+ }
3775
+ return;
3776
+ }
3777
+ setFontSize(size);
3778
+ }
3757
3779
  positionToolbar(anchor) {
3758
3780
  if (!this.el) return;
3759
3781
  const rect = anchor.getBoundingClientRect();
@@ -8899,7 +8921,7 @@ var TemplateTool = class {
8899
8921
  };
8900
8922
 
8901
8923
  // src/index.ts
8902
- var VERSION = "0.36.0";
8924
+ var VERSION = "0.37.0";
8903
8925
  // Annotate the CommonJS export names for ESM import in node:
8904
8926
  0 && (module.exports = {
8905
8927
  ArrowTool,