@pixldocs/canvas-renderer 0.5.280 → 0.5.282

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,26 @@ 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
+ preserveActiveSelectionAfterTransformRef.current = {
14397
+ memberIds: preservedGroupMemberIds,
14398
+ groupSelectionId,
14399
+ expiresAt: Date.now() + 1200
14400
+ };
14401
+ preservedGroupMemberIds.forEach((id) => {
14402
+ justModifiedIdsRef.current.add(id);
14403
+ modifiedIdsThisRound.add(id);
14404
+ });
14405
+ setTimeout(() => modifiedIdsThisRound.forEach((id) => justModifiedIdsRef.current.delete(id)), 150);
14448
14406
  }
14449
14407
  selectElements([groupSelectionId], false, false);
14450
14408
  fabricCanvas.requestRenderAll();
14451
14409
  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
14410
  groupSelectionTransformStartRef.current = null;
14461
- preserveActiveSelectionAfterTransformRef.current = null;
14411
+ activeSelectionMoveStartRef.current = null;
14462
14412
  unlockEditsSoon();
14463
14413
  return;
14464
14414
  }
@@ -15117,7 +15067,8 @@ const PageCanvas = react.forwardRef(
15117
15067
  const replacementById = !activeStillOnCanvas && activeId ? fc.getObjects().find((o) => getObjectId(o) === activeId) ?? null : null;
15118
15068
  const restoreTarget = activeStillOnCanvas ? activeBeforeSync : replacementById;
15119
15069
  const isActiveTextBeingEdited = activeId && editingTextIdRef.current === activeId && activeBeforeSync instanceof fabric__namespace.Textbox;
15120
- if (!skipRestoreSelection && activeSelectionSnapshot && !isActiveTextBeingEdited && !shouldSkipUpdates2 && !needsLooseLogicalGroupPositionSync) {
15070
+ const keepLiveLogicalActiveSelection = !!((activeSelectionSnapshot == null ? void 0 : activeSelectionSnapshot.groupSelectionId) && activeBeforeSync instanceof fabric__namespace.ActiveSelection && fc.getActiveObject() === activeBeforeSync && activeBeforeSync.__pixldocsGroupSelection === activeSelectionSnapshot.groupSelectionId && activeSelectionSnapshot.memberIds.length > 1);
15071
+ if (!skipRestoreSelection && activeSelectionSnapshot && !isActiveTextBeingEdited && !shouldSkipUpdates2 && !needsLooseLogicalGroupPositionSync && !keepLiveLogicalActiveSelection) {
15121
15072
  const freshMembers = activeSelectionSnapshot.memberIds.map((id) => fc.getObjects().find((o) => getObjectId(o) === id)).filter((o) => !!o);
15122
15073
  if (freshMembers.length > 1) {
15123
15074
  isSyncingSelectionToFabricRef.current = true;
@@ -23883,9 +23834,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
23883
23834
  }
23884
23835
  return svgString;
23885
23836
  }
23886
- const resolvedPackageVersion = "0.5.280";
23837
+ const resolvedPackageVersion = "0.5.282";
23887
23838
  const PACKAGE_VERSION = resolvedPackageVersion;
23888
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.280";
23839
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.282";
23889
23840
  const roundParityValue = (value) => {
23890
23841
  if (typeof value !== "number") return value;
23891
23842
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -24699,7 +24650,7 @@ class PixldocsRenderer {
24699
24650
  await this.waitForCanvasScene(container, cloned, i);
24700
24651
  }
24701
24652
  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"));
24653
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-CIvJyIlB.cjs"));
24703
24654
  const prepared = preparePagesForExport(
24704
24655
  cloned.pages,
24705
24656
  canvasWidth,
@@ -27019,7 +26970,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27019
26970
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27020
26971
  sanitizeSvgTreeForPdf(svgToDraw);
27021
26972
  try {
27022
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-IHdElmRG.cjs"));
26973
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-CIvJyIlB.cjs"));
27023
26974
  try {
27024
26975
  await logTextMeasurementDiagnostic(svgToDraw);
27025
26976
  } catch {
@@ -27416,4 +27367,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
27416
27367
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
27417
27368
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
27418
27369
  exports.warmTemplateFromForm = warmTemplateFromForm;
27419
- //# sourceMappingURL=index-C4tIRDnD.cjs.map
27370
+ //# sourceMappingURL=index-DeBKmZZc.cjs.map