@pixldocs/canvas-renderer 0.5.432 → 0.5.434

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.
@@ -11958,6 +11958,7 @@ const PageCanvas = forwardRef(
11958
11958
  const preserveEditingScopeOnSelectionClearRef = useRef(false);
11959
11959
  const preserveActiveSelectionAfterTransformRef = useRef(null);
11960
11960
  const recentGroupSelectionRestoreRef = useRef(null);
11961
+ const intentionalGroupDeselectRef = useRef(null);
11961
11962
  const pendingGroupPromotionRef = useRef(null);
11962
11963
  const pendingGroupDrillInRef = useRef(null);
11963
11964
  const imageReloadRequestSeqRef = useRef(/* @__PURE__ */ new Map());
@@ -13489,6 +13490,14 @@ const PageCanvas = forwardRef(
13489
13490
  setDrilledGroupBounds(null);
13490
13491
  drilledGroupIdRef.current = null;
13491
13492
  }
13493
+ const explicitGroupDeselect = intentionalGroupDeselectRef.current;
13494
+ if (explicitGroupDeselect) {
13495
+ preserveActiveSelectionAfterTransformRef.current = null;
13496
+ recentGroupSelectionRestoreRef.current = null;
13497
+ preserveSelectionAfterTransformIdRef.current = null;
13498
+ editLockRef.current = false;
13499
+ syncLockedRef.current = false;
13500
+ }
13492
13501
  const preservedGroupSelection = preserveActiveSelectionAfterTransformRef.current;
13493
13502
  const shouldRestoreGroupSelection = !!((preservedGroupSelection == null ? void 0 : preservedGroupSelection.groupSelectionId) && (!preservedGroupSelection.expiresAt || preservedGroupSelection.expiresAt > Date.now()));
13494
13503
  if (skipSelectionClearOnDiscardRef.current) {
@@ -13497,11 +13506,12 @@ const PageCanvas = forwardRef(
13497
13506
  }
13498
13507
  const recentGroupSelectionRestore = recentGroupSelectionRestoreRef.current;
13499
13508
  const shouldReassertRecentGroupSelection = !!((recentGroupSelectionRestore == null ? void 0 : recentGroupSelectionRestore.groupSelectionId) && recentGroupSelectionRestore.expiresAt > Date.now());
13500
- if (editLockRef.current || syncLockedRef.current || didTransformRef.current || preserveSelectionAfterTransformIdRef.current || shouldRestoreGroupSelection || shouldReassertRecentGroupSelection) {
13509
+ if (!explicitGroupDeselect && (editLockRef.current || syncLockedRef.current || didTransformRef.current || preserveSelectionAfterTransformIdRef.current || shouldRestoreGroupSelection || shouldReassertRecentGroupSelection)) {
13501
13510
  if (shouldRestoreGroupSelection) restorePreservedGroupSelectionSoon(preservedGroupSelection);
13502
13511
  else if (shouldReassertRecentGroupSelection) restorePreservedGroupSelectionSoon(recentGroupSelectionRestore);
13503
13512
  return;
13504
13513
  }
13514
+ intentionalGroupDeselectRef.current = null;
13505
13515
  restoreSuppressedGroupBorders();
13506
13516
  editLockRef.current = false;
13507
13517
  syncLockedRef.current = false;
@@ -14026,7 +14036,7 @@ const PageCanvas = forwardRef(
14026
14036
  };
14027
14037
  fabricCanvas.__updateDrilledGroupOutline = updateDrilledGroupOutline;
14028
14038
  fabricCanvas.on("mouse:down:before", (opt) => {
14029
- var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
14039
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
14030
14040
  const activeBeforeMouseDown = fabricCanvas.getActiveObject();
14031
14041
  if (editLockRef.current) {
14032
14042
  const active = fabricCanvas.getActiveObject();
@@ -14148,15 +14158,46 @@ const PageCanvas = forwardRef(
14148
14158
  suppressTextEditForClick(effectiveTarget);
14149
14159
  }
14150
14160
  }
14151
- } else if (!target || targetId === "__background__") {
14161
+ } else if (!target || !targetId || targetId === "__background__") {
14152
14162
  const isMultiSelectKey = !!(((_j = opt.e) == null ? void 0 : _j.shiftKey) || ((_k = opt.e) == null ? void 0 : _k.metaKey) || ((_l = opt.e) == null ? void 0 : _l.ctrlKey));
14153
14163
  if (isMultiSelectKey) return;
14154
14164
  if ((_m = opt.e) == null ? void 0 : _m.altKey) return;
14165
+ try {
14166
+ const activeForCornerCheck = fabricCanvas.getActiveObject();
14167
+ if (activeForCornerCheck) {
14168
+ const ptrForCorner = fabricCanvas.getPointer(opt.e);
14169
+ const cornerHit = ((_n = activeForCornerCheck.findControl) == null ? void 0 : _n.call(activeForCornerCheck, ptrForCorner)) || ((_o = activeForCornerCheck._findTargetCorner) == null ? void 0 : _o.call(activeForCornerCheck, ptrForCorner));
14170
+ if (cornerHit) {
14171
+ return;
14172
+ }
14173
+ }
14174
+ } catch {
14175
+ }
14155
14176
  try {
14156
14177
  const pointer = fabricCanvas.getPointer(opt.e);
14157
14178
  const px = pointer.x;
14158
14179
  const py = pointer.y;
14159
14180
  const pick = pickGroupAtPointer(px, py, childrenNow, activeEditingGroupId);
14181
+ if (!pick) {
14182
+ const activeNow = fabricCanvas.getActiveObject();
14183
+ const groupSelectionId = activeNow instanceof fabric.ActiveSelection ? activeNow.__pixldocsGroupSelection : activeNow == null ? void 0 : activeNow.__pixldocsGroupSelection;
14184
+ if (groupSelectionId) {
14185
+ intentionalGroupDeselectRef.current = groupSelectionId;
14186
+ preserveActiveSelectionAfterTransformRef.current = null;
14187
+ recentGroupSelectionRestoreRef.current = null;
14188
+ preserveSelectionAfterTransformIdRef.current = null;
14189
+ pendingGroupPromotionRef.current = null;
14190
+ pendingGroupDrillInRef.current = null;
14191
+ editLockRef.current = false;
14192
+ syncLockedRef.current = false;
14193
+ fabricCanvas._target = void 0;
14194
+ fabricCanvas._currentTransform = null;
14195
+ opt.target = void 0;
14196
+ fabricCanvas.discardActiveObject();
14197
+ fabricCanvas.requestRenderAll();
14198
+ }
14199
+ return;
14200
+ }
14160
14201
  if (pick) {
14161
14202
  const parent = pick.group;
14162
14203
  if (activeEditingGroupId !== parent.id) {
@@ -25762,9 +25803,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
25762
25803
  }
25763
25804
  return svgString;
25764
25805
  }
25765
- const resolvedPackageVersion = "0.5.432";
25806
+ const resolvedPackageVersion = "0.5.434";
25766
25807
  const PACKAGE_VERSION = resolvedPackageVersion;
25767
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.432";
25808
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.434";
25768
25809
  const roundParityValue = (value) => {
25769
25810
  if (typeof value !== "number") return value;
25770
25811
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -26578,7 +26619,7 @@ class PixldocsRenderer {
26578
26619
  await this.waitForCanvasScene(container, cloned, i);
26579
26620
  }
26580
26621
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
26581
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-Bkipkjlc.js");
26622
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-BLi6yU52.js");
26582
26623
  const prepared = preparePagesForExport(
26583
26624
  cloned.pages,
26584
26625
  canvasWidth,
@@ -28898,7 +28939,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28898
28939
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28899
28940
  sanitizeSvgTreeForPdf(svgToDraw);
28900
28941
  try {
28901
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-Bkipkjlc.js");
28942
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-BLi6yU52.js");
28902
28943
  try {
28903
28944
  await logTextMeasurementDiagnostic(svgToDraw);
28904
28945
  } catch {
@@ -29298,4 +29339,4 @@ export {
29298
29339
  buildTeaserBlurFlatKeys as y,
29299
29340
  collectFontDescriptorsFromConfig as z
29300
29341
  };
29301
- //# sourceMappingURL=index-gL0A2DGr.js.map
29342
+ //# sourceMappingURL=index-CAzQTttO.js.map