@pixldocs/canvas-renderer 0.5.336 → 0.5.338

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.
@@ -13565,6 +13565,7 @@ const PageCanvas = forwardRef(
13565
13565
  });
13566
13566
  const markSimpleTransform = (e) => {
13567
13567
  if (!isActiveRef.current) return;
13568
+ prepareGroupSelectionTransformStart(e.target);
13568
13569
  markTransforming(e.target);
13569
13570
  };
13570
13571
  const getObjectFrameBoundsInSelection = (selection, obj, frameWidth, frameHeight) => {
@@ -14433,7 +14434,7 @@ const PageCanvas = forwardRef(
14433
14434
  });
14434
14435
  let cropGroupSaveTimer = null;
14435
14436
  fabricCanvas.on("object:modified", (e) => {
14436
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
14437
+ var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j;
14437
14438
  try {
14438
14439
  dragStarted = false;
14439
14440
  setGuides([]);
@@ -14441,6 +14442,33 @@ const PageCanvas = forwardRef(
14441
14442
  objectResizeActiveSnapRef.current = null;
14442
14443
  groupResizeActiveSnapRef.current = null;
14443
14444
  onDragEnd == null ? void 0 : onDragEnd();
14445
+ try {
14446
+ const mt = e.target;
14447
+ const children = mt instanceof fabric.Group || mt instanceof fabric.ActiveSelection ? mt.getObjects() : [];
14448
+ logGroupImageResizeDebug("modified-entry", {
14449
+ time: Math.round(performance.now()),
14450
+ didTransform: didTransformRef.current,
14451
+ targetType: mt == null ? void 0 : mt.type,
14452
+ targetCtor: (_a2 = mt == null ? void 0 : mt.constructor) == null ? void 0 : _a2.name,
14453
+ isActiveSelection: mt instanceof fabric.ActiveSelection,
14454
+ isGroup: mt instanceof fabric.Group,
14455
+ angle: mt == null ? void 0 : mt.angle,
14456
+ childCount: children.length,
14457
+ childTypes: children.map((c) => c == null ? void 0 : c.type),
14458
+ hasImageChild: children.some((c) => isGroupResizeImageLikeObject(c)),
14459
+ target: mt ? summarizeFabricObjectForResizeDebug(mt) : null,
14460
+ children: children.map((c) => {
14461
+ var _a3;
14462
+ return {
14463
+ type: c == null ? void 0 : c.type,
14464
+ ctor: (_a3 = c == null ? void 0 : c.constructor) == null ? void 0 : _a3.name,
14465
+ summary: summarizeFabricObjectForResizeDebug(c)
14466
+ };
14467
+ })
14468
+ });
14469
+ } catch (err) {
14470
+ console.warn("[Pixldocs][group-image-side-resize] modified-entry log failed", err);
14471
+ }
14444
14472
  try {
14445
14473
  const t = e.target;
14446
14474
  if (t instanceof fabric.ActiveSelection) {
@@ -14478,7 +14506,7 @@ const PageCanvas = forwardRef(
14478
14506
  const active = fabricCanvas.getActiveObject();
14479
14507
  const activeId = active ? getObjectId(active) : null;
14480
14508
  if (active && activeId && activeId !== "__background__" && !(active instanceof fabric.Group)) {
14481
- const pageChildrenForParent = ((_a2 = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _a2.children) ?? [];
14509
+ const pageChildrenForParent = ((_b2 = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _b2.children) ?? [];
14482
14510
  const parentGroup = findParentGroup(pageChildrenForParent, activeId);
14483
14511
  if (parentGroup && isGroup(parentGroup) && parentGroup.backgroundColor) {
14484
14512
  let fabricSectionGroup = active.group && active.group instanceof fabric.Group ? active.group : null;
@@ -14560,7 +14588,7 @@ const PageCanvas = forwardRef(
14560
14588
  useEditorStore.getState().reflowStackGroupInPage(pageId, groupId);
14561
14589
  }
14562
14590
  const stateAfter = useEditorStore.getState();
14563
- const pageAfter = ((_b2 = stateAfter.canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _b2.children) ?? [];
14591
+ const pageAfter = ((_c = stateAfter.canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _c.children) ?? [];
14564
14592
  const groupNodeAfter = findNodeById(pageAfter, groupId);
14565
14593
  if (groupNodeAfter) {
14566
14594
  const abs = getAbsoluteBounds(groupNodeAfter, pageAfter);
@@ -14623,7 +14651,7 @@ const PageCanvas = forwardRef(
14623
14651
  }
14624
14652
  if (active && active instanceof fabric.Group && active.__docuforgeSectionGroup && getObjectId(active)) {
14625
14653
  const groupId = getObjectId(active);
14626
- const pageChildrenSec = ((_c = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _c.children) ?? [];
14654
+ const pageChildrenSec = ((_d = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _d.children) ?? [];
14627
14655
  const modifiedTarget2 = e == null ? void 0 : e.target;
14628
14656
  const resizeScaleTarget = lastResizeScaleTargetRef.current;
14629
14657
  lastResizeScaleTargetRef.current = null;
@@ -14654,7 +14682,7 @@ const PageCanvas = forwardRef(
14654
14682
  const node = findNodeById(pageChildrenSec, groupId);
14655
14683
  if (isChildModified && node && !groupMoved) {
14656
14684
  const stateAfter = useEditorStore.getState();
14657
- const pageAfter = ((_d = stateAfter.canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _d.children) ?? [];
14685
+ const pageAfter = ((_e = stateAfter.canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _e.children) ?? [];
14658
14686
  const groupNodeAfter = findNodeById(pageAfter, groupId);
14659
14687
  if (groupNodeAfter) {
14660
14688
  const abs = getAbsoluteBounds(groupNodeAfter, pageAfter);
@@ -14670,7 +14698,7 @@ const PageCanvas = forwardRef(
14670
14698
  }
14671
14699
  if (active && active instanceof fabric.Group && !(active instanceof fabric.ActiveSelection) && getObjectId(active)) {
14672
14700
  const groupId = getObjectId(active);
14673
- const pageChildren3 = ((_e = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _e.children) ?? [];
14701
+ const pageChildren3 = ((_f = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _f.children) ?? [];
14674
14702
  const w = (active.width ?? 0) * (active.scaleX ?? 1);
14675
14703
  const h = (active.height ?? 0) * (active.scaleY ?? 1);
14676
14704
  const centerX = active.left ?? 0;
@@ -14692,7 +14720,7 @@ const PageCanvas = forwardRef(
14692
14720
  }
14693
14721
  const activeObj = fabricCanvas.getActiveObject();
14694
14722
  let activeObjects = fabricCanvas.getActiveObjects();
14695
- const activeSelectionMoveStart = activeObj instanceof fabric.ActiveSelection && ((_f = activeSelectionMoveStartRef.current) == null ? void 0 : _f.selection) === activeObj ? activeSelectionMoveStartRef.current : null;
14723
+ const activeSelectionMoveStart = activeObj instanceof fabric.ActiveSelection && ((_g = activeSelectionMoveStartRef.current) == null ? void 0 : _g.selection) === activeObj ? activeSelectionMoveStartRef.current : null;
14696
14724
  const activeSelectionDelta = activeObj instanceof fabric.ActiveSelection && activeSelectionMoveStart ? (() => {
14697
14725
  const rect = activeObj.getBoundingRect();
14698
14726
  return {
@@ -15111,7 +15139,7 @@ const PageCanvas = forwardRef(
15111
15139
  const localScaleX = 1 / sx;
15112
15140
  const localScaleY = 1 / sy;
15113
15141
  obj.set({ scaleX: localScaleX, scaleY: localScaleY });
15114
- const selectionMatrix = (_g = activeObj == null ? void 0 : activeObj.calcTransformMatrix) == null ? void 0 : _g.call(activeObj);
15142
+ const selectionMatrix = (_h = activeObj == null ? void 0 : activeObj.calcTransformMatrix) == null ? void 0 : _h.call(activeObj);
15115
15143
  const localCenter = selectionMatrix ? fabric.util.transformPoint(preBakeCenter, fabric.util.invertTransform(selectionMatrix)) : preBakeCenter;
15116
15144
  obj.setPositionByOrigin(localCenter, "center", "center");
15117
15145
  }
@@ -15262,7 +15290,7 @@ const PageCanvas = forwardRef(
15262
15290
  const localScaleX = 1 / sx;
15263
15291
  const localScaleY = 1 / sy;
15264
15292
  obj.set({ scaleX: localScaleX, scaleY: localScaleY });
15265
- const selectionMatrix = (_h = activeObj == null ? void 0 : activeObj.calcTransformMatrix) == null ? void 0 : _h.call(activeObj);
15293
+ const selectionMatrix = (_i = activeObj == null ? void 0 : activeObj.calcTransformMatrix) == null ? void 0 : _i.call(activeObj);
15266
15294
  const localCenter = selectionMatrix ? fabric.util.transformPoint(preBakeCenter, fabric.util.invertTransform(selectionMatrix)) : preBakeCenter;
15267
15295
  obj.setPositionByOrigin(localCenter, "center", "center");
15268
15296
  } else {
@@ -15410,7 +15438,7 @@ const PageCanvas = forwardRef(
15410
15438
  updateElement(objId, elementUpdate, { recordHistory: false, skipLayoutRecalc: true });
15411
15439
  obj.setCoords();
15412
15440
  }
15413
- const pageChildrenForReflow = ((_i = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _i.children) ?? [];
15441
+ const pageChildrenForReflow = ((_j = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _j.children) ?? [];
15414
15442
  const stackGroupsToReflow = /* @__PURE__ */ new Set();
15415
15443
  for (const id of modifiedIdsThisRound) {
15416
15444
  const parent = findParentGroup(pageChildrenForReflow, id);
@@ -15421,7 +15449,8 @@ const PageCanvas = forwardRef(
15421
15449
  for (const gid of stackGroupsToReflow) {
15422
15450
  useEditorStore.getState().reflowStackGroupInPage(pageId, gid);
15423
15451
  }
15424
- if (activeObj instanceof fabric.ActiveSelection && activeObjects.length > 0) {
15452
+ const shouldRebuildActiveSelectionAfterPersist = activeObj instanceof fabric.ActiveSelection && (!!activeSelectionResizeHandle || pendingCropGroupFrameBakes.length > 0 || Math.abs((activeObj.scaleX ?? 1) - 1) > 1e-3 || Math.abs((activeObj.scaleY ?? 1) - 1) > 1e-3);
15453
+ if (activeObj instanceof fabric.ActiveSelection && activeObjects.length > 0 && shouldRebuildActiveSelectionAfterPersist) {
15425
15454
  const wasGroupSel = activeObj.__pixldocsGroupSelection;
15426
15455
  const membersToReselect = activeObjects.filter((o) => {
15427
15456
  const oid = getObjectId(o);
@@ -24550,9 +24579,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24550
24579
  }
24551
24580
  return svgString;
24552
24581
  }
24553
- const resolvedPackageVersion = "0.5.336";
24582
+ const resolvedPackageVersion = "0.5.338";
24554
24583
  const PACKAGE_VERSION = resolvedPackageVersion;
24555
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.336";
24584
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.338";
24556
24585
  const roundParityValue = (value) => {
24557
24586
  if (typeof value !== "number") return value;
24558
24587
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25366,7 +25395,7 @@ class PixldocsRenderer {
25366
25395
  await this.waitForCanvasScene(container, cloned, i);
25367
25396
  }
25368
25397
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25369
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-430yRzXb.js");
25398
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DM-aUSae.js");
25370
25399
  const prepared = preparePagesForExport(
25371
25400
  cloned.pages,
25372
25401
  canvasWidth,
@@ -27686,7 +27715,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27686
27715
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27687
27716
  sanitizeSvgTreeForPdf(svgToDraw);
27688
27717
  try {
27689
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-430yRzXb.js");
27718
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DM-aUSae.js");
27690
27719
  try {
27691
27720
  await logTextMeasurementDiagnostic(svgToDraw);
27692
27721
  } catch {
@@ -28086,4 +28115,4 @@ export {
28086
28115
  buildTeaserBlurFlatKeys as y,
28087
28116
  collectFontDescriptorsFromConfig as z
28088
28117
  };
28089
- //# sourceMappingURL=index-9lp-EDhu.js.map
28118
+ //# sourceMappingURL=index-BwAnIzvN.js.map