@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.
@@ -14371,76 +14371,26 @@ 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
+ preserveActiveSelectionAfterTransformRef.current = {
14379
+ memberIds: preservedGroupMemberIds,
14380
+ groupSelectionId,
14381
+ expiresAt: Date.now() + 1200
14382
+ };
14383
+ preservedGroupMemberIds.forEach((id) => {
14384
+ justModifiedIdsRef.current.add(id);
14385
+ modifiedIdsThisRound.add(id);
14386
+ });
14387
+ setTimeout(() => modifiedIdsThisRound.forEach((id) => justModifiedIdsRef.current.delete(id)), 150);
14430
14388
  }
14431
14389
  selectElements([groupSelectionId], false, false);
14432
14390
  fabricCanvas.requestRenderAll();
14433
14391
  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
14392
  groupSelectionTransformStartRef.current = null;
14443
- preserveActiveSelectionAfterTransformRef.current = null;
14393
+ activeSelectionMoveStartRef.current = null;
14444
14394
  unlockEditsSoon();
14445
14395
  return;
14446
14396
  }
@@ -15099,7 +15049,8 @@ const PageCanvas = forwardRef(
15099
15049
  const replacementById = !activeStillOnCanvas && activeId ? fc.getObjects().find((o) => getObjectId(o) === activeId) ?? null : null;
15100
15050
  const restoreTarget = activeStillOnCanvas ? activeBeforeSync : replacementById;
15101
15051
  const isActiveTextBeingEdited = activeId && editingTextIdRef.current === activeId && activeBeforeSync instanceof fabric.Textbox;
15102
- if (!skipRestoreSelection && activeSelectionSnapshot && !isActiveTextBeingEdited && !shouldSkipUpdates2 && !needsLooseLogicalGroupPositionSync) {
15052
+ const keepLiveLogicalActiveSelection = !!((activeSelectionSnapshot == null ? void 0 : activeSelectionSnapshot.groupSelectionId) && activeBeforeSync instanceof fabric.ActiveSelection && fc.getActiveObject() === activeBeforeSync && activeBeforeSync.__pixldocsGroupSelection === activeSelectionSnapshot.groupSelectionId && activeSelectionSnapshot.memberIds.length > 1);
15053
+ if (!skipRestoreSelection && activeSelectionSnapshot && !isActiveTextBeingEdited && !shouldSkipUpdates2 && !needsLooseLogicalGroupPositionSync && !keepLiveLogicalActiveSelection) {
15103
15054
  const freshMembers = activeSelectionSnapshot.memberIds.map((id) => fc.getObjects().find((o) => getObjectId(o) === id)).filter((o) => !!o);
15104
15055
  if (freshMembers.length > 1) {
15105
15056
  isSyncingSelectionToFabricRef.current = true;
@@ -23865,9 +23816,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
23865
23816
  }
23866
23817
  return svgString;
23867
23818
  }
23868
- const resolvedPackageVersion = "0.5.280";
23819
+ const resolvedPackageVersion = "0.5.282";
23869
23820
  const PACKAGE_VERSION = resolvedPackageVersion;
23870
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.280";
23821
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.282";
23871
23822
  const roundParityValue = (value) => {
23872
23823
  if (typeof value !== "number") return value;
23873
23824
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -24681,7 +24632,7 @@ class PixldocsRenderer {
24681
24632
  await this.waitForCanvasScene(container, cloned, i);
24682
24633
  }
24683
24634
  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");
24635
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DRVboAKK.js");
24685
24636
  const prepared = preparePagesForExport(
24686
24637
  cloned.pages,
24687
24638
  canvasWidth,
@@ -27001,7 +26952,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27001
26952
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27002
26953
  sanitizeSvgTreeForPdf(svgToDraw);
27003
26954
  try {
27004
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CZKs5Llt.js");
26955
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DRVboAKK.js");
27005
26956
  try {
27006
26957
  await logTextMeasurementDiagnostic(svgToDraw);
27007
26958
  } catch {
@@ -27401,4 +27352,4 @@ export {
27401
27352
  buildTeaserBlurFlatKeys as y,
27402
27353
  collectFontDescriptorsFromConfig as z
27403
27354
  };
27404
- //# sourceMappingURL=index-Ce2aM_l6.js.map
27355
+ //# sourceMappingURL=index-d5uaicum.js.map