@pixldocs/canvas-renderer 0.5.280 → 0.5.281

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.
@@ -14389,76 +14389,22 @@ const PageCanvas = react.forwardRef(
14389
14389
  setDrilledGroupBounds(null);
14390
14390
  drilledGroupIdRef.current = null;
14391
14391
  const groupSelectionId = (isActiveSelection && activeObj instanceof fabric__namespace.ActiveSelection ? activeObj.__pixldocsGroupSelection : void 0) ?? groupToMove.id;
14392
- const targetObjects = isActiveSelection && activeObj instanceof fabric__namespace.ActiveSelection ? activeObj.getObjects() : activeObjects;
14393
- let preservedGroupMemberIds = targetObjects.map((obj) => getObjectId(obj)).filter((id) => !!id && id !== "__background__");
14394
- if (groupSelectionId && activeObj instanceof fabric__namespace.ActiveSelection) {
14395
- try {
14396
- skipSelectionClearOnDiscardRef.current = true;
14397
- skipActiveSelectionBakeOnClearRef.current = true;
14398
- try {
14399
- fabricCanvas.discardActiveObject();
14400
- } finally {
14401
- skipActiveSelectionBakeOnClearRef.current = false;
14402
- skipSelectionClearOnDiscardRef.current = false;
14403
- }
14404
- } catch {
14405
- }
14406
- const pageAfterMove = ((_j = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _j.children) ?? [];
14407
- const groupAfterMove = findNodeById(pageAfterMove, groupToMove.id);
14408
- const memberIdsAfterMove = groupAfterMove && isGroup(groupAfterMove) ? getAllElementIds(groupAfterMove.children ?? []) : targetObjects.map((obj) => getObjectId(obj)).filter((id) => !!id && id !== "__background__");
14409
- preservedGroupMemberIds = memberIdsAfterMove;
14410
- const reselectionObjects = memberIdsAfterMove.map((id) => targetObjects.find((obj) => getObjectId(obj) === id) ?? fabricCanvas.getObjects().find((obj) => getObjectId(obj) === id)).filter((obj) => !!obj);
14411
- for (const obj of reselectionObjects) {
14412
- const id = getObjectId(obj);
14413
- const node = id ? findNodeById(pageAfterMove, id) : null;
14414
- if (!node) continue;
14415
- const abs = getAbsoluteBounds(node, pageAfterMove, pageBoundsOptions);
14416
- const bounds = getNodeBounds(node, pageAfterMove, pageBoundsOptions);
14417
- const __prevLeft = obj.left;
14418
- const __prevTop = obj.top;
14419
- const useCenterAnchor = obj instanceof fabric__namespace.Group && obj.__cropGroup || obj instanceof fabric__namespace.FabricImage && (obj.originX === "center" || obj.originY === "center");
14420
- const nextPoint = new fabric__namespace.Point(
14421
- useCenterAnchor ? abs.left + Math.max(1, bounds.width) / 2 : abs.left,
14422
- useCenterAnchor ? abs.top + Math.max(1, bounds.height) / 2 : abs.top
14423
- );
14424
- if (typeof obj.setXY === "function") {
14425
- obj.setXY(nextPoint, useCenterAnchor ? "center" : "left", useCenterAnchor ? "center" : "top");
14426
- } else {
14427
- obj.set({ left: nextPoint.x, top: nextPoint.y });
14428
- }
14429
- obj.setCoords();
14430
- if (shouldLogGroupMove()) {
14431
- console.log("[GRP-MOVE] rebake-member", {
14432
- id,
14433
- nodeType: node.type,
14434
- storeAbs: abs,
14435
- bounds,
14436
- origin: { x: obj.originX, y: obj.originY },
14437
- prev: { left: __prevLeft, top: __prevTop },
14438
- after: { left: obj.left, top: obj.top }
14439
- });
14440
- }
14441
- }
14442
- const bakedSelection = reselectionObjects.length > 1 ? new fabric__namespace.ActiveSelection(reselectionObjects, { canvas: fabricCanvas }) : activeObj;
14443
- restoreGroupSelectionVisualState(bakedSelection, groupSelectionId);
14444
- fabricCanvas.setActiveObject(bakedSelection);
14445
- if (!(bakedSelection instanceof fabric__namespace.ActiveSelection && bakedSelection.getObjects().every((obj) => !(obj instanceof fabric__namespace.Group)))) {
14446
- bakedSelection.setCoords();
14447
- }
14392
+ const pageAfterMove = ((_j = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _j.children) ?? [];
14393
+ const groupAfterMove = findNodeById(pageAfterMove, groupToMove.id);
14394
+ const preservedGroupMemberIds = groupAfterMove && isGroup(groupAfterMove) ? getAllElementIds(groupAfterMove.children ?? []) : selectedElementIds;
14395
+ if (activeObj instanceof fabric__namespace.ActiveSelection) {
14396
+ restoreGroupSelectionVisualState(activeObj, groupSelectionId);
14397
+ preserveActiveSelectionAfterTransformRef.current = {
14398
+ memberIds: preservedGroupMemberIds,
14399
+ groupSelectionId,
14400
+ expiresAt: Date.now() + 1200
14401
+ };
14448
14402
  }
14449
14403
  selectElements([groupSelectionId], false, false);
14450
14404
  fabricCanvas.requestRenderAll();
14451
14405
  elementsRef.current = getCurrentElements();
14452
- for (const obj of targetObjects.length ? targetObjects : activeObjects) {
14453
- const objId = getObjectId(obj);
14454
- if (objId && objId !== "__background__") {
14455
- justModifiedIdsRef.current.add(objId);
14456
- modifiedIdsThisRound.add(objId);
14457
- }
14458
- }
14459
- setTimeout(() => modifiedIdsThisRound.forEach((id) => justModifiedIdsRef.current.delete(id)), 150);
14460
14406
  groupSelectionTransformStartRef.current = null;
14461
- preserveActiveSelectionAfterTransformRef.current = null;
14407
+ activeSelectionMoveStartRef.current = null;
14462
14408
  unlockEditsSoon();
14463
14409
  return;
14464
14410
  }
@@ -15117,7 +15063,8 @@ const PageCanvas = react.forwardRef(
15117
15063
  const replacementById = !activeStillOnCanvas && activeId ? fc.getObjects().find((o) => getObjectId(o) === activeId) ?? null : null;
15118
15064
  const restoreTarget = activeStillOnCanvas ? activeBeforeSync : replacementById;
15119
15065
  const isActiveTextBeingEdited = activeId && editingTextIdRef.current === activeId && activeBeforeSync instanceof fabric__namespace.Textbox;
15120
- if (!skipRestoreSelection && activeSelectionSnapshot && !isActiveTextBeingEdited && !shouldSkipUpdates2 && !needsLooseLogicalGroupPositionSync) {
15066
+ const keepLiveLogicalActiveSelection = !!((activeSelectionSnapshot == null ? void 0 : activeSelectionSnapshot.groupSelectionId) && activeBeforeSync instanceof fabric__namespace.ActiveSelection && fc.getActiveObject() === activeBeforeSync && activeBeforeSync.__pixldocsGroupSelection === activeSelectionSnapshot.groupSelectionId && activeSelectionSnapshot.memberIds.length > 1);
15067
+ if (!skipRestoreSelection && activeSelectionSnapshot && !isActiveTextBeingEdited && !shouldSkipUpdates2 && !needsLooseLogicalGroupPositionSync && !keepLiveLogicalActiveSelection) {
15121
15068
  const freshMembers = activeSelectionSnapshot.memberIds.map((id) => fc.getObjects().find((o) => getObjectId(o) === id)).filter((o) => !!o);
15122
15069
  if (freshMembers.length > 1) {
15123
15070
  isSyncingSelectionToFabricRef.current = true;
@@ -23883,9 +23830,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
23883
23830
  }
23884
23831
  return svgString;
23885
23832
  }
23886
- const resolvedPackageVersion = "0.5.280";
23833
+ const resolvedPackageVersion = "0.5.281";
23887
23834
  const PACKAGE_VERSION = resolvedPackageVersion;
23888
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.280";
23835
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.281";
23889
23836
  const roundParityValue = (value) => {
23890
23837
  if (typeof value !== "number") return value;
23891
23838
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -24699,7 +24646,7 @@ class PixldocsRenderer {
24699
24646
  await this.waitForCanvasScene(container, cloned, i);
24700
24647
  }
24701
24648
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
24702
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-IHdElmRG.cjs"));
24649
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-CyvVvmOr.cjs"));
24703
24650
  const prepared = preparePagesForExport(
24704
24651
  cloned.pages,
24705
24652
  canvasWidth,
@@ -27019,7 +26966,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27019
26966
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27020
26967
  sanitizeSvgTreeForPdf(svgToDraw);
27021
26968
  try {
27022
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-IHdElmRG.cjs"));
26969
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-CyvVvmOr.cjs"));
27023
26970
  try {
27024
26971
  await logTextMeasurementDiagnostic(svgToDraw);
27025
26972
  } catch {
@@ -27416,4 +27363,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
27416
27363
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
27417
27364
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
27418
27365
  exports.warmTemplateFromForm = warmTemplateFromForm;
27419
- //# sourceMappingURL=index-C4tIRDnD.cjs.map
27366
+ //# sourceMappingURL=index-m0_zL8dr.cjs.map