@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.
@@ -11976,6 +11976,7 @@ const PageCanvas = react.forwardRef(
11976
11976
  const preserveEditingScopeOnSelectionClearRef = react.useRef(false);
11977
11977
  const preserveActiveSelectionAfterTransformRef = react.useRef(null);
11978
11978
  const recentGroupSelectionRestoreRef = react.useRef(null);
11979
+ const intentionalGroupDeselectRef = react.useRef(null);
11979
11980
  const pendingGroupPromotionRef = react.useRef(null);
11980
11981
  const pendingGroupDrillInRef = react.useRef(null);
11981
11982
  const imageReloadRequestSeqRef = react.useRef(/* @__PURE__ */ new Map());
@@ -13507,6 +13508,14 @@ const PageCanvas = react.forwardRef(
13507
13508
  setDrilledGroupBounds(null);
13508
13509
  drilledGroupIdRef.current = null;
13509
13510
  }
13511
+ const explicitGroupDeselect = intentionalGroupDeselectRef.current;
13512
+ if (explicitGroupDeselect) {
13513
+ preserveActiveSelectionAfterTransformRef.current = null;
13514
+ recentGroupSelectionRestoreRef.current = null;
13515
+ preserveSelectionAfterTransformIdRef.current = null;
13516
+ editLockRef.current = false;
13517
+ syncLockedRef.current = false;
13518
+ }
13510
13519
  const preservedGroupSelection = preserveActiveSelectionAfterTransformRef.current;
13511
13520
  const shouldRestoreGroupSelection = !!((preservedGroupSelection == null ? void 0 : preservedGroupSelection.groupSelectionId) && (!preservedGroupSelection.expiresAt || preservedGroupSelection.expiresAt > Date.now()));
13512
13521
  if (skipSelectionClearOnDiscardRef.current) {
@@ -13515,11 +13524,12 @@ const PageCanvas = react.forwardRef(
13515
13524
  }
13516
13525
  const recentGroupSelectionRestore = recentGroupSelectionRestoreRef.current;
13517
13526
  const shouldReassertRecentGroupSelection = !!((recentGroupSelectionRestore == null ? void 0 : recentGroupSelectionRestore.groupSelectionId) && recentGroupSelectionRestore.expiresAt > Date.now());
13518
- if (editLockRef.current || syncLockedRef.current || didTransformRef.current || preserveSelectionAfterTransformIdRef.current || shouldRestoreGroupSelection || shouldReassertRecentGroupSelection) {
13527
+ if (!explicitGroupDeselect && (editLockRef.current || syncLockedRef.current || didTransformRef.current || preserveSelectionAfterTransformIdRef.current || shouldRestoreGroupSelection || shouldReassertRecentGroupSelection)) {
13519
13528
  if (shouldRestoreGroupSelection) restorePreservedGroupSelectionSoon(preservedGroupSelection);
13520
13529
  else if (shouldReassertRecentGroupSelection) restorePreservedGroupSelectionSoon(recentGroupSelectionRestore);
13521
13530
  return;
13522
13531
  }
13532
+ intentionalGroupDeselectRef.current = null;
13523
13533
  restoreSuppressedGroupBorders();
13524
13534
  editLockRef.current = false;
13525
13535
  syncLockedRef.current = false;
@@ -14044,7 +14054,7 @@ const PageCanvas = react.forwardRef(
14044
14054
  };
14045
14055
  fabricCanvas.__updateDrilledGroupOutline = updateDrilledGroupOutline;
14046
14056
  fabricCanvas.on("mouse:down:before", (opt) => {
14047
- var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
14057
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
14048
14058
  const activeBeforeMouseDown = fabricCanvas.getActiveObject();
14049
14059
  if (editLockRef.current) {
14050
14060
  const active = fabricCanvas.getActiveObject();
@@ -14166,15 +14176,46 @@ const PageCanvas = react.forwardRef(
14166
14176
  suppressTextEditForClick(effectiveTarget);
14167
14177
  }
14168
14178
  }
14169
- } else if (!target || targetId === "__background__") {
14179
+ } else if (!target || !targetId || targetId === "__background__") {
14170
14180
  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));
14171
14181
  if (isMultiSelectKey) return;
14172
14182
  if ((_m = opt.e) == null ? void 0 : _m.altKey) return;
14183
+ try {
14184
+ const activeForCornerCheck = fabricCanvas.getActiveObject();
14185
+ if (activeForCornerCheck) {
14186
+ const ptrForCorner = fabricCanvas.getPointer(opt.e);
14187
+ const cornerHit = ((_n = activeForCornerCheck.findControl) == null ? void 0 : _n.call(activeForCornerCheck, ptrForCorner)) || ((_o = activeForCornerCheck._findTargetCorner) == null ? void 0 : _o.call(activeForCornerCheck, ptrForCorner));
14188
+ if (cornerHit) {
14189
+ return;
14190
+ }
14191
+ }
14192
+ } catch {
14193
+ }
14173
14194
  try {
14174
14195
  const pointer = fabricCanvas.getPointer(opt.e);
14175
14196
  const px = pointer.x;
14176
14197
  const py = pointer.y;
14177
14198
  const pick = pickGroupAtPointer(px, py, childrenNow, activeEditingGroupId);
14199
+ if (!pick) {
14200
+ const activeNow = fabricCanvas.getActiveObject();
14201
+ const groupSelectionId = activeNow instanceof fabric__namespace.ActiveSelection ? activeNow.__pixldocsGroupSelection : activeNow == null ? void 0 : activeNow.__pixldocsGroupSelection;
14202
+ if (groupSelectionId) {
14203
+ intentionalGroupDeselectRef.current = groupSelectionId;
14204
+ preserveActiveSelectionAfterTransformRef.current = null;
14205
+ recentGroupSelectionRestoreRef.current = null;
14206
+ preserveSelectionAfterTransformIdRef.current = null;
14207
+ pendingGroupPromotionRef.current = null;
14208
+ pendingGroupDrillInRef.current = null;
14209
+ editLockRef.current = false;
14210
+ syncLockedRef.current = false;
14211
+ fabricCanvas._target = void 0;
14212
+ fabricCanvas._currentTransform = null;
14213
+ opt.target = void 0;
14214
+ fabricCanvas.discardActiveObject();
14215
+ fabricCanvas.requestRenderAll();
14216
+ }
14217
+ return;
14218
+ }
14178
14219
  if (pick) {
14179
14220
  const parent = pick.group;
14180
14221
  if (activeEditingGroupId !== parent.id) {
@@ -25780,9 +25821,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
25780
25821
  }
25781
25822
  return svgString;
25782
25823
  }
25783
- const resolvedPackageVersion = "0.5.432";
25824
+ const resolvedPackageVersion = "0.5.434";
25784
25825
  const PACKAGE_VERSION = resolvedPackageVersion;
25785
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.432";
25826
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.434";
25786
25827
  const roundParityValue = (value) => {
25787
25828
  if (typeof value !== "number") return value;
25788
25829
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -26596,7 +26637,7 @@ class PixldocsRenderer {
26596
26637
  await this.waitForCanvasScene(container, cloned, i);
26597
26638
  }
26598
26639
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
26599
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-DgXV6S2u.cjs"));
26640
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-CRHNGoGg.cjs"));
26600
26641
  const prepared = preparePagesForExport(
26601
26642
  cloned.pages,
26602
26643
  canvasWidth,
@@ -28916,7 +28957,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28916
28957
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28917
28958
  sanitizeSvgTreeForPdf(svgToDraw);
28918
28959
  try {
28919
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-DgXV6S2u.cjs"));
28960
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-CRHNGoGg.cjs"));
28920
28961
  try {
28921
28962
  await logTextMeasurementDiagnostic(svgToDraw);
28922
28963
  } catch {
@@ -29313,4 +29354,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
29313
29354
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
29314
29355
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
29315
29356
  exports.warmTemplateFromForm = warmTemplateFromForm;
29316
- //# sourceMappingURL=index-CK9heNqN.cjs.map
29357
+ //# sourceMappingURL=index-BtiEg8-C.cjs.map