@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.
@@ -14371,76 +14371,22 @@ const PageCanvas = forwardRef(
14371
14371
  setDrilledGroupBounds(null);
14372
14372
  drilledGroupIdRef.current = null;
14373
14373
  const groupSelectionId = (isActiveSelection && activeObj instanceof fabric.ActiveSelection ? activeObj.__pixldocsGroupSelection : void 0) ?? groupToMove.id;
14374
- const targetObjects = isActiveSelection && activeObj instanceof fabric.ActiveSelection ? activeObj.getObjects() : activeObjects;
14375
- let preservedGroupMemberIds = targetObjects.map((obj) => getObjectId(obj)).filter((id) => !!id && id !== "__background__");
14376
- if (groupSelectionId && activeObj instanceof fabric.ActiveSelection) {
14377
- try {
14378
- skipSelectionClearOnDiscardRef.current = true;
14379
- skipActiveSelectionBakeOnClearRef.current = true;
14380
- try {
14381
- fabricCanvas.discardActiveObject();
14382
- } finally {
14383
- skipActiveSelectionBakeOnClearRef.current = false;
14384
- skipSelectionClearOnDiscardRef.current = false;
14385
- }
14386
- } catch {
14387
- }
14388
- const pageAfterMove = ((_j = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _j.children) ?? [];
14389
- const groupAfterMove = findNodeById(pageAfterMove, groupToMove.id);
14390
- const memberIdsAfterMove = groupAfterMove && isGroup(groupAfterMove) ? getAllElementIds(groupAfterMove.children ?? []) : targetObjects.map((obj) => getObjectId(obj)).filter((id) => !!id && id !== "__background__");
14391
- preservedGroupMemberIds = memberIdsAfterMove;
14392
- const reselectionObjects = memberIdsAfterMove.map((id) => targetObjects.find((obj) => getObjectId(obj) === id) ?? fabricCanvas.getObjects().find((obj) => getObjectId(obj) === id)).filter((obj) => !!obj);
14393
- for (const obj of reselectionObjects) {
14394
- const id = getObjectId(obj);
14395
- const node = id ? findNodeById(pageAfterMove, id) : null;
14396
- if (!node) continue;
14397
- const abs = getAbsoluteBounds(node, pageAfterMove, pageBoundsOptions);
14398
- const bounds = getNodeBounds(node, pageAfterMove, pageBoundsOptions);
14399
- const __prevLeft = obj.left;
14400
- const __prevTop = obj.top;
14401
- const useCenterAnchor = obj instanceof fabric.Group && obj.__cropGroup || obj instanceof fabric.FabricImage && (obj.originX === "center" || obj.originY === "center");
14402
- const nextPoint = new fabric.Point(
14403
- useCenterAnchor ? abs.left + Math.max(1, bounds.width) / 2 : abs.left,
14404
- useCenterAnchor ? abs.top + Math.max(1, bounds.height) / 2 : abs.top
14405
- );
14406
- if (typeof obj.setXY === "function") {
14407
- obj.setXY(nextPoint, useCenterAnchor ? "center" : "left", useCenterAnchor ? "center" : "top");
14408
- } else {
14409
- obj.set({ left: nextPoint.x, top: nextPoint.y });
14410
- }
14411
- obj.setCoords();
14412
- if (shouldLogGroupMove()) {
14413
- console.log("[GRP-MOVE] rebake-member", {
14414
- id,
14415
- nodeType: node.type,
14416
- storeAbs: abs,
14417
- bounds,
14418
- origin: { x: obj.originX, y: obj.originY },
14419
- prev: { left: __prevLeft, top: __prevTop },
14420
- after: { left: obj.left, top: obj.top }
14421
- });
14422
- }
14423
- }
14424
- const bakedSelection = reselectionObjects.length > 1 ? new fabric.ActiveSelection(reselectionObjects, { canvas: fabricCanvas }) : activeObj;
14425
- restoreGroupSelectionVisualState(bakedSelection, groupSelectionId);
14426
- fabricCanvas.setActiveObject(bakedSelection);
14427
- if (!(bakedSelection instanceof fabric.ActiveSelection && bakedSelection.getObjects().every((obj) => !(obj instanceof fabric.Group)))) {
14428
- bakedSelection.setCoords();
14429
- }
14374
+ const pageAfterMove = ((_j = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _j.children) ?? [];
14375
+ const groupAfterMove = findNodeById(pageAfterMove, groupToMove.id);
14376
+ const preservedGroupMemberIds = groupAfterMove && isGroup(groupAfterMove) ? getAllElementIds(groupAfterMove.children ?? []) : selectedElementIds;
14377
+ if (activeObj instanceof fabric.ActiveSelection) {
14378
+ restoreGroupSelectionVisualState(activeObj, groupSelectionId);
14379
+ preserveActiveSelectionAfterTransformRef.current = {
14380
+ memberIds: preservedGroupMemberIds,
14381
+ groupSelectionId,
14382
+ expiresAt: Date.now() + 1200
14383
+ };
14430
14384
  }
14431
14385
  selectElements([groupSelectionId], false, false);
14432
14386
  fabricCanvas.requestRenderAll();
14433
14387
  elementsRef.current = getCurrentElements();
14434
- for (const obj of targetObjects.length ? targetObjects : activeObjects) {
14435
- const objId = getObjectId(obj);
14436
- if (objId && objId !== "__background__") {
14437
- justModifiedIdsRef.current.add(objId);
14438
- modifiedIdsThisRound.add(objId);
14439
- }
14440
- }
14441
- setTimeout(() => modifiedIdsThisRound.forEach((id) => justModifiedIdsRef.current.delete(id)), 150);
14442
14388
  groupSelectionTransformStartRef.current = null;
14443
- preserveActiveSelectionAfterTransformRef.current = null;
14389
+ activeSelectionMoveStartRef.current = null;
14444
14390
  unlockEditsSoon();
14445
14391
  return;
14446
14392
  }
@@ -15099,7 +15045,8 @@ const PageCanvas = forwardRef(
15099
15045
  const replacementById = !activeStillOnCanvas && activeId ? fc.getObjects().find((o) => getObjectId(o) === activeId) ?? null : null;
15100
15046
  const restoreTarget = activeStillOnCanvas ? activeBeforeSync : replacementById;
15101
15047
  const isActiveTextBeingEdited = activeId && editingTextIdRef.current === activeId && activeBeforeSync instanceof fabric.Textbox;
15102
- if (!skipRestoreSelection && activeSelectionSnapshot && !isActiveTextBeingEdited && !shouldSkipUpdates2 && !needsLooseLogicalGroupPositionSync) {
15048
+ const keepLiveLogicalActiveSelection = !!((activeSelectionSnapshot == null ? void 0 : activeSelectionSnapshot.groupSelectionId) && activeBeforeSync instanceof fabric.ActiveSelection && fc.getActiveObject() === activeBeforeSync && activeBeforeSync.__pixldocsGroupSelection === activeSelectionSnapshot.groupSelectionId && activeSelectionSnapshot.memberIds.length > 1);
15049
+ if (!skipRestoreSelection && activeSelectionSnapshot && !isActiveTextBeingEdited && !shouldSkipUpdates2 && !needsLooseLogicalGroupPositionSync && !keepLiveLogicalActiveSelection) {
15103
15050
  const freshMembers = activeSelectionSnapshot.memberIds.map((id) => fc.getObjects().find((o) => getObjectId(o) === id)).filter((o) => !!o);
15104
15051
  if (freshMembers.length > 1) {
15105
15052
  isSyncingSelectionToFabricRef.current = true;
@@ -23865,9 +23812,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
23865
23812
  }
23866
23813
  return svgString;
23867
23814
  }
23868
- const resolvedPackageVersion = "0.5.280";
23815
+ const resolvedPackageVersion = "0.5.281";
23869
23816
  const PACKAGE_VERSION = resolvedPackageVersion;
23870
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.280";
23817
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.281";
23871
23818
  const roundParityValue = (value) => {
23872
23819
  if (typeof value !== "number") return value;
23873
23820
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -24681,7 +24628,7 @@ class PixldocsRenderer {
24681
24628
  await this.waitForCanvasScene(container, cloned, i);
24682
24629
  }
24683
24630
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
24684
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CZKs5Llt.js");
24631
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CT_DagYd.js");
24685
24632
  const prepared = preparePagesForExport(
24686
24633
  cloned.pages,
24687
24634
  canvasWidth,
@@ -27001,7 +26948,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27001
26948
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27002
26949
  sanitizeSvgTreeForPdf(svgToDraw);
27003
26950
  try {
27004
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CZKs5Llt.js");
26951
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CT_DagYd.js");
27005
26952
  try {
27006
26953
  await logTextMeasurementDiagnostic(svgToDraw);
27007
26954
  } catch {
@@ -27401,4 +27348,4 @@ export {
27401
27348
  buildTeaserBlurFlatKeys as y,
27402
27349
  collectFontDescriptorsFromConfig as z
27403
27350
  };
27404
- //# sourceMappingURL=index-Ce2aM_l6.js.map
27351
+ //# sourceMappingURL=index-CcnLc5LI.js.map