@mlightcad/cad-simple-viewer 1.7.8-preview.4 → 1.7.8-preview.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.
@@ -58264,7 +58264,10 @@ const tp = {
58264
58264
  async editTextEntity(e) {
58265
58265
  const t = e.database;
58266
58266
  this.setEntitySceneVisible(e.objectId, !1), this._isDirty = !0;
58267
- const i = Number(e.height), n = Number.isFinite(i) && i > 0 ? i : this.pixelsToWorldY(24), o = e.textString ?? "", r = Math.max(n * Math.max(o.length, 1) * 0.6, n), a = Number(e.rotation), l = new Di();
58267
+ const i = Number(e.height), n = Number.isFinite(i) && i > 0 ? i : this.pixelsToWorldY(24), o = e.textString ?? "", r = Math.max(
58268
+ n * Math.max(o.length, 1) * 0.6,
58269
+ n
58270
+ ), a = Number(e.rotation), l = new Di();
58268
58271
  let c = !1;
58269
58272
  try {
58270
58273
  const d = await l.open({
@@ -59857,26 +59860,35 @@ const tp = {
59857
59860
  return;
59858
59861
  const { placements: t, buckets: i } = e.flushMeshGlyphInstances(
59859
59862
  this._scene.internalScene,
59860
- (n) => this.resolveMeshGlyphLayerParent(n)
59863
+ (n, o) => this.resolveMeshGlyphLayerParent(n, o)
59861
59864
  );
59862
59865
  t > 0 && (console.log(
59863
59866
  `[cad-simple-viewer-cli] mesh glyph InstancedMesh flush: placements=${t} buckets=${i}`
59864
59867
  ), this._isDirty = !0);
59865
59868
  }
59866
59869
  /**
59867
- * Prefers the active layout's layer group, then any layout that already has
59868
- * that layer (multi-layout HTML export). Falls back to null so flush can
59869
- * parent under the bookkeeping root.
59870
+ * Parents mesh glyphs under the layout that owns the entity.
59871
+ *
59872
+ * Every layout has a layer group for each layer name. Preferring the active
59873
+ * layout puts model-space TrueType text into the paper-space group while a
59874
+ * paper layout is current, so viewports (which draw model space) never see
59875
+ * it. When `ownerId` names a layout, only that layout's layer is used.
59876
+ * Glyphs with no layout owner still follow the active layout.
59870
59877
  */
59871
- resolveMeshGlyphLayerParent(e) {
59872
- var i;
59873
- const t = (i = this._scene.activeLayout) == null ? void 0 : i.getLayer(e);
59874
- if (t)
59875
- return t.internalObject;
59876
- for (const n of this._scene.layouts.values()) {
59877
- const o = n.getLayer(e);
59878
- if (o)
59879
- return o.internalObject;
59878
+ resolveMeshGlyphLayerParent(e, t) {
59879
+ var o, r;
59880
+ const i = t == null ? void 0 : t.trim();
59881
+ if (i) {
59882
+ const a = this._scene.layouts.get(i);
59883
+ return a ? ((o = a.getLayer(e)) == null ? void 0 : o.internalObject) ?? null : null;
59884
+ }
59885
+ const n = (r = this._scene.activeLayout) == null ? void 0 : r.getLayer(e);
59886
+ if (n)
59887
+ return n.internalObject;
59888
+ for (const a of this._scene.layouts.values()) {
59889
+ const l = a.getLayer(e);
59890
+ if (l)
59891
+ return l.internalObject;
59880
59892
  }
59881
59893
  return null;
59882
59894
  }