@pixldocs/canvas-renderer 0.5.244 → 0.5.245

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.
@@ -11120,6 +11120,8 @@ const PageCanvas = forwardRef(
11120
11120
  const [guides, setGuides] = useState([]);
11121
11121
  const [gridResizeLabel, setGridResizeLabel] = useState(null);
11122
11122
  const [hoverBounds, setHoverBounds] = useState(null);
11123
+ const [drilledGroupBounds, setDrilledGroupBounds] = useState(null);
11124
+ const drilledGroupIdRef = useRef(null);
11123
11125
  const [rotationLabel, setRotationLabel] = useState(null);
11124
11126
  const [sizeLabel, setSizeLabel] = useState(null);
11125
11127
  const [ready, setReady] = useState(false);
@@ -11987,16 +11989,29 @@ const PageCanvas = forwardRef(
11987
11989
  }
11988
11990
  });
11989
11991
  fabricCanvas.on("object:scaling", () => {
11992
+ var _a2;
11990
11993
  fabricCanvas.__isUserTransforming = true;
11994
+ if (drilledGroupIdRef.current) {
11995
+ try {
11996
+ (_a2 = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _a2.call(fabricCanvas);
11997
+ } catch {
11998
+ }
11999
+ }
11991
12000
  });
11992
12001
  fabricCanvas.on("object:moving", () => {
11993
- var _a2;
12002
+ var _a2, _b2;
11994
12003
  fabricCanvas.__isUserTransforming = true;
11995
12004
  didTransformRef.current = true;
12005
+ if (drilledGroupIdRef.current) {
12006
+ try {
12007
+ (_a2 = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _a2.call(fabricCanvas);
12008
+ } catch {
12009
+ }
12010
+ }
11996
12011
  const active = fabricCanvas.getActiveObject();
11997
12012
  if (!active) return;
11998
12013
  const state = useEditorStore.getState();
11999
- const canvasPage = (_a2 = state.canvas.pages) == null ? void 0 : _a2.find((p) => p.id === pageId);
12014
+ const canvasPage = (_b2 = state.canvas.pages) == null ? void 0 : _b2.find((p) => p.id === pageId);
12000
12015
  const children = (canvasPage == null ? void 0 : canvasPage.children) ?? [];
12001
12016
  if (!canvasPage) return;
12002
12017
  const ids = state.canvas.selectedIds ?? [];
@@ -12027,8 +12042,15 @@ const PageCanvas = forwardRef(
12027
12042
  }
12028
12043
  });
12029
12044
  fabricCanvas.on("object:rotating", () => {
12045
+ var _a2;
12030
12046
  fabricCanvas.__isUserTransforming = true;
12031
12047
  didTransformRef.current = true;
12048
+ if (drilledGroupIdRef.current) {
12049
+ try {
12050
+ (_a2 = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _a2.call(fabricCanvas);
12051
+ } catch {
12052
+ }
12053
+ }
12032
12054
  });
12033
12055
  const syncSelectionToStore = () => {
12034
12056
  var _a2, _b2, _c, _d;
@@ -12239,7 +12261,7 @@ const PageCanvas = forwardRef(
12239
12261
  }
12240
12262
  });
12241
12263
  fabricCanvas.on("mouse:dblclick", (opt) => {
12242
- var _a2, _b2;
12264
+ var _a2, _b2, _c;
12243
12265
  const target = opt == null ? void 0 : opt.target;
12244
12266
  if (!target) return;
12245
12267
  if (target.isEditing) return;
@@ -12334,6 +12356,10 @@ const PageCanvas = forwardRef(
12334
12356
  }
12335
12357
  const selectedId = selectionIdx < 0 ? childId : chain[selectionIdx].id;
12336
12358
  selectElements([selectedId], false, false);
12359
+ try {
12360
+ (_c = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _c.call(fabricCanvas);
12361
+ } catch {
12362
+ }
12337
12363
  });
12338
12364
  fabricCanvas.on("selection:cleared", () => {
12339
12365
  if (!isActiveRef.current || isRebuildingRef.current || !allowSelection) return;
@@ -12341,6 +12367,8 @@ const PageCanvas = forwardRef(
12341
12367
  groupBoundsResizingRef.current = false;
12342
12368
  if (!preserveEditingScopeOnSelectionClearRef.current) {
12343
12369
  fabricCanvas.__activeEditingGroupId = null;
12370
+ setDrilledGroupBounds(null);
12371
+ drilledGroupIdRef.current = null;
12344
12372
  }
12345
12373
  const preservedGroupSelection = preserveActiveSelectionAfterTransformRef.current;
12346
12374
  const shouldRestoreGroupSelection = !!((preservedGroupSelection == null ? void 0 : preservedGroupSelection.groupSelectionId) && (!preservedGroupSelection.expiresAt || preservedGroupSelection.expiresAt > Date.now()));
@@ -12744,6 +12772,32 @@ const PageCanvas = forwardRef(
12744
12772
  }
12745
12773
  return pick;
12746
12774
  };
12775
+ const updateDrilledGroupOutline = () => {
12776
+ const gid = fabricCanvas.__activeEditingGroupId ?? null;
12777
+ drilledGroupIdRef.current = gid;
12778
+ if (!gid) {
12779
+ setDrilledGroupBounds(null);
12780
+ return;
12781
+ }
12782
+ const pageNow = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId);
12783
+ const node = pageNow ? findNodeById(pageNow.children ?? [], gid) : null;
12784
+ if (!node || !isGroup(node) || node.backgroundColor) {
12785
+ setDrilledGroupBounds(null);
12786
+ return;
12787
+ }
12788
+ const b = groupFabricUnionBBox(node);
12789
+ if (!b) {
12790
+ setDrilledGroupBounds(null);
12791
+ return;
12792
+ }
12793
+ setDrilledGroupBounds({
12794
+ left: b.left,
12795
+ top: b.top,
12796
+ width: b.right - b.left,
12797
+ height: b.bottom - b.top
12798
+ });
12799
+ };
12800
+ fabricCanvas.__updateDrilledGroupOutline = updateDrilledGroupOutline;
12747
12801
  fabricCanvas.on("mouse:down:before", (opt) => {
12748
12802
  var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
12749
12803
  if (editLockRef.current) {
@@ -12878,7 +12932,11 @@ const PageCanvas = forwardRef(
12878
12932
  opt.target = effectiveTarget;
12879
12933
  pendingGroupPromotionRef.current = null;
12880
12934
  pendingGroupDrillInRef.current = { groupId: drillGroup.id, childId: effectiveTargetId, target: effectiveTarget };
12935
+ effectiveTarget.selected = false;
12936
+ effectiveTarget.__lastSelected = false;
12937
+ effectiveTarget.__corner = void 0;
12881
12938
  selectElements([effectiveTargetId], false, false);
12939
+ updateDrilledGroupOutline();
12882
12940
  fabricCanvas.requestRenderAll();
12883
12941
  }
12884
12942
  } else if (!target || targetId === "__background__") {
@@ -13046,6 +13104,9 @@ const PageCanvas = forwardRef(
13046
13104
  (_b2 = (_a2 = pendingDrillIn.target).set) == null ? void 0 : _b2.call(_a2, { selectable: true, evented: true, hasBorders: true, hasControls: true });
13047
13105
  fabricCanvas.setActiveObject(pendingDrillIn.target);
13048
13106
  pendingDrillIn.target.setCoords();
13107
+ pendingDrillIn.target.selected = false;
13108
+ pendingDrillIn.target.__lastSelected = false;
13109
+ pendingDrillIn.target.__corner = void 0;
13049
13110
  fabricCanvas.requestRenderAll();
13050
13111
  } finally {
13051
13112
  requestAnimationFrame(() => {
@@ -13053,6 +13114,7 @@ const PageCanvas = forwardRef(
13053
13114
  });
13054
13115
  }
13055
13116
  selectElements([pendingDrillIn.childId], false, false);
13117
+ updateDrilledGroupOutline();
13056
13118
  }
13057
13119
  }
13058
13120
  const pendingPromotion = pendingGroupPromotionRef.current;
@@ -17181,6 +17243,28 @@ const PageCanvas = forwardRef(
17181
17243
  )
17182
17244
  }
17183
17245
  ),
17246
+ drilledGroupBounds && /* @__PURE__ */ jsx(
17247
+ "svg",
17248
+ {
17249
+ className: "absolute inset-0 pointer-events-none",
17250
+ style: { width: scaledWidth, height: scaledHeight },
17251
+ viewBox: `0 0 ${canvasWidth} ${canvasHeight}`,
17252
+ children: /* @__PURE__ */ jsx(
17253
+ "rect",
17254
+ {
17255
+ x: drilledGroupBounds.left,
17256
+ y: drilledGroupBounds.top,
17257
+ width: drilledGroupBounds.width,
17258
+ height: drilledGroupBounds.height,
17259
+ fill: "none",
17260
+ stroke: "rgba(100, 116, 139, 0.7)",
17261
+ strokeWidth: 1,
17262
+ strokeDasharray: "4 4",
17263
+ vectorEffect: "non-scaling-stroke"
17264
+ }
17265
+ )
17266
+ }
17267
+ ),
17184
17268
  canvas.projectSettings.showGrid && (() => {
17185
17269
  const ps = canvas.projectSettings;
17186
17270
  const gx = Math.max(1, ps.gridSizeX ?? ps.gridSize ?? 0);
@@ -23292,9 +23376,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
23292
23376
  }
23293
23377
  return svgString;
23294
23378
  }
23295
- const resolvedPackageVersion = "0.5.244";
23379
+ const resolvedPackageVersion = "0.5.245";
23296
23380
  const PACKAGE_VERSION = resolvedPackageVersion;
23297
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.244";
23381
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.245";
23298
23382
  const roundParityValue = (value) => {
23299
23383
  if (typeof value !== "number") return value;
23300
23384
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -24108,7 +24192,7 @@ class PixldocsRenderer {
24108
24192
  await this.waitForCanvasScene(container, cloned, i);
24109
24193
  }
24110
24194
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
24111
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-BWQ8fyXp.js");
24195
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-qzZ0kZCI.js");
24112
24196
  const prepared = preparePagesForExport(
24113
24197
  cloned.pages,
24114
24198
  canvasWidth,
@@ -26428,7 +26512,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
26428
26512
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
26429
26513
  sanitizeSvgTreeForPdf(svgToDraw);
26430
26514
  try {
26431
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-BWQ8fyXp.js");
26515
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-qzZ0kZCI.js");
26432
26516
  try {
26433
26517
  await logTextMeasurementDiagnostic(svgToDraw);
26434
26518
  } catch {
@@ -26828,4 +26912,4 @@ export {
26828
26912
  buildTeaserBlurFlatKeys as y,
26829
26913
  collectFontDescriptorsFromConfig as z
26830
26914
  };
26831
- //# sourceMappingURL=index-xJBNIfjT.js.map
26915
+ //# sourceMappingURL=index-FE8QLDiA.js.map