@ibodr/editor 0.2.11 → 0.2.12

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.ts CHANGED
@@ -3067,9 +3067,8 @@ interface DrawOptions {
3067
3067
  */
3068
3068
  readonly debouncedZoomThreshold: number;
3069
3069
  /**
3070
- * Zoom level below which shapes that implement {@link ShapeUtil.getLodStyle} are painted into
3071
- * one canvas instead of a DOM node each. Shapes whose on-screen size is still large stay in
3072
- * the DOM. Defaults to 0.35 so a normal working zoom keeps real text and strokes.
3070
+ * Kept for compatibility. Stand-in rendering follows each shape's on-screen size
3071
+ * (its page bounds times the zoom), not this zoom cutoff.
3073
3072
  */
3074
3073
  readonly lodZoom: number;
3075
3074
  /**
package/dist/index.mjs CHANGED
@@ -4459,15 +4459,17 @@ function drawGeometryStroke(ctx, geometry) {
4459
4459
  }
4460
4460
 
4461
4461
  // src/lib/editor/lod/shapeRenderMode.ts
4462
- var LOD_SMALL_SCREEN_PX = 28;
4462
+ var LOD_KEEP_SCREEN_PX = 36;
4463
+ var LOD_KEEP_TEXT_PX = 7;
4463
4464
  var LOD_CULL_MARGIN = 0.75;
4464
4465
  function getShapeRenderMode(input) {
4465
4466
  if (!input.hasLodStyle || input.interactive) return "dom";
4466
4467
  if (input.outsideViewport) return "unmounted";
4467
4468
  if (input.unmountWhenCulled) return "dom";
4468
- const maxSide = Math.max(input.pageWidth, input.pageHeight) * input.zoom;
4469
- if (input.zoom < input.lodZoom || maxSide < LOD_SMALL_SCREEN_PX) return "canvas";
4470
- return "dom";
4469
+ const screenMax = Math.max(input.pageWidth, input.pageHeight) * input.zoom;
4470
+ const textScreen = (input.labelSize ?? 0) * input.zoom;
4471
+ if (screenMax >= LOD_KEEP_SCREEN_PX || textScreen >= LOD_KEEP_TEXT_PX) return "dom";
4472
+ return "canvas";
4471
4473
  }
4472
4474
  var MAX_LOD_POINTS = 48;
4473
4475
  var meshCache = /* @__PURE__ */ new WeakMap();
@@ -4609,6 +4611,7 @@ function ownRenderMode(editor, shape, frame, outsideViewport) {
4609
4611
  if (frame.debug || editor.isShapeHidden(shape)) return "dom";
4610
4612
  const style = lodStyleFor(editor, shape);
4611
4613
  const mesh = style && !style.unmountWhenCulled ? meshFor(editor, shape, style) : null;
4614
+ const pageBounds = editor.getShapePageBounds(shape);
4612
4615
  return getShapeRenderMode({
4613
4616
  zoom: frame.zoom,
4614
4617
  lodZoom: frame.lodZoom,
@@ -4616,8 +4619,9 @@ function ownRenderMode(editor, shape, frame, outsideViewport) {
4616
4619
  interactive: isInteractive(editor, shape, frame.selected, frame.editingId),
4617
4620
  outsideViewport,
4618
4621
  unmountWhenCulled: Boolean(style?.unmountWhenCulled),
4619
- pageWidth: mesh?.w ?? 0,
4620
- pageHeight: mesh?.h ?? 0
4622
+ pageWidth: pageBounds?.w ?? mesh?.w ?? 0,
4623
+ pageHeight: pageBounds?.h ?? mesh?.h ?? 0,
4624
+ labelSize: style?.labelSize ?? 0
4621
4625
  });
4622
4626
  }
4623
4627
  function coveredByDomBackground(editor, shape, frame) {
@@ -26311,7 +26315,7 @@ function getFontsFromRichText(editor, richText, initialState2) {
26311
26315
  // src/index.ts
26312
26316
  registerDrawLibraryVersion(
26313
26317
  "@ibodr/editor",
26314
- "0.2.11",
26318
+ "0.2.12",
26315
26319
  "esm"
26316
26320
  );
26317
26321
  /*!