@pixldocs/canvas-renderer 0.5.335 → 0.5.337

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.
@@ -14308,9 +14308,36 @@ const PageCanvas = forwardRef(
14308
14308
  }
14309
14309
  });
14310
14310
  fabricCanvas.on("object:rotating", (e) => {
14311
+ var _a2, _b2;
14311
14312
  markSimpleTransform(e);
14312
14313
  didTransformRef.current = true;
14313
14314
  const tr = e.target;
14315
+ try {
14316
+ const children = tr instanceof fabric.Group || tr instanceof fabric.ActiveSelection ? tr.getObjects() : [];
14317
+ logGroupImageResizeDebug("rotating-entry", {
14318
+ time: Math.round(performance.now()),
14319
+ angle: tr == null ? void 0 : tr.angle,
14320
+ targetType: tr == null ? void 0 : tr.type,
14321
+ targetCtor: (_a2 = tr == null ? void 0 : tr.constructor) == null ? void 0 : _a2.name,
14322
+ isActiveSelection: tr instanceof fabric.ActiveSelection,
14323
+ isGroup: tr instanceof fabric.Group,
14324
+ isCropGroup: !!(tr && (tr.__cropGroup || ((_b2 = tr._ct) == null ? void 0 : _b2.isCropGroup))),
14325
+ childCount: children.length,
14326
+ childTypes: children.map((c) => c == null ? void 0 : c.type),
14327
+ hasImageChild: children.some((c) => isGroupResizeImageLikeObject(c)),
14328
+ target: tr ? summarizeFabricObjectForResizeDebug(tr) : null,
14329
+ children: children.map((c) => {
14330
+ var _a3;
14331
+ return {
14332
+ type: c == null ? void 0 : c.type,
14333
+ ctor: (_a3 = c == null ? void 0 : c.constructor) == null ? void 0 : _a3.name,
14334
+ summary: summarizeFabricObjectForResizeDebug(c)
14335
+ };
14336
+ })
14337
+ });
14338
+ } catch (err) {
14339
+ console.warn("[Pixldocs][group-image-side-resize] rotating-entry log failed", err);
14340
+ }
14314
14341
  try {
14315
14342
  const getCursor = fabricCanvas.__pixldocsGetRotateCursor;
14316
14343
  const upper = fabricCanvas.upperCanvasEl;
@@ -14406,7 +14433,7 @@ const PageCanvas = forwardRef(
14406
14433
  });
14407
14434
  let cropGroupSaveTimer = null;
14408
14435
  fabricCanvas.on("object:modified", (e) => {
14409
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
14436
+ var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j;
14410
14437
  try {
14411
14438
  dragStarted = false;
14412
14439
  setGuides([]);
@@ -14414,6 +14441,33 @@ const PageCanvas = forwardRef(
14414
14441
  objectResizeActiveSnapRef.current = null;
14415
14442
  groupResizeActiveSnapRef.current = null;
14416
14443
  onDragEnd == null ? void 0 : onDragEnd();
14444
+ try {
14445
+ const mt = e.target;
14446
+ const children = mt instanceof fabric.Group || mt instanceof fabric.ActiveSelection ? mt.getObjects() : [];
14447
+ logGroupImageResizeDebug("modified-entry", {
14448
+ time: Math.round(performance.now()),
14449
+ didTransform: didTransformRef.current,
14450
+ targetType: mt == null ? void 0 : mt.type,
14451
+ targetCtor: (_a2 = mt == null ? void 0 : mt.constructor) == null ? void 0 : _a2.name,
14452
+ isActiveSelection: mt instanceof fabric.ActiveSelection,
14453
+ isGroup: mt instanceof fabric.Group,
14454
+ angle: mt == null ? void 0 : mt.angle,
14455
+ childCount: children.length,
14456
+ childTypes: children.map((c) => c == null ? void 0 : c.type),
14457
+ hasImageChild: children.some((c) => isGroupResizeImageLikeObject(c)),
14458
+ target: mt ? summarizeFabricObjectForResizeDebug(mt) : null,
14459
+ children: children.map((c) => {
14460
+ var _a3;
14461
+ return {
14462
+ type: c == null ? void 0 : c.type,
14463
+ ctor: (_a3 = c == null ? void 0 : c.constructor) == null ? void 0 : _a3.name,
14464
+ summary: summarizeFabricObjectForResizeDebug(c)
14465
+ };
14466
+ })
14467
+ });
14468
+ } catch (err) {
14469
+ console.warn("[Pixldocs][group-image-side-resize] modified-entry log failed", err);
14470
+ }
14417
14471
  try {
14418
14472
  const t = e.target;
14419
14473
  if (t instanceof fabric.ActiveSelection) {
@@ -14451,7 +14505,7 @@ const PageCanvas = forwardRef(
14451
14505
  const active = fabricCanvas.getActiveObject();
14452
14506
  const activeId = active ? getObjectId(active) : null;
14453
14507
  if (active && activeId && activeId !== "__background__" && !(active instanceof fabric.Group)) {
14454
- const pageChildrenForParent = ((_a2 = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _a2.children) ?? [];
14508
+ const pageChildrenForParent = ((_b2 = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _b2.children) ?? [];
14455
14509
  const parentGroup = findParentGroup(pageChildrenForParent, activeId);
14456
14510
  if (parentGroup && isGroup(parentGroup) && parentGroup.backgroundColor) {
14457
14511
  let fabricSectionGroup = active.group && active.group instanceof fabric.Group ? active.group : null;
@@ -14533,7 +14587,7 @@ const PageCanvas = forwardRef(
14533
14587
  useEditorStore.getState().reflowStackGroupInPage(pageId, groupId);
14534
14588
  }
14535
14589
  const stateAfter = useEditorStore.getState();
14536
- const pageAfter = ((_b2 = stateAfter.canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _b2.children) ?? [];
14590
+ const pageAfter = ((_c = stateAfter.canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _c.children) ?? [];
14537
14591
  const groupNodeAfter = findNodeById(pageAfter, groupId);
14538
14592
  if (groupNodeAfter) {
14539
14593
  const abs = getAbsoluteBounds(groupNodeAfter, pageAfter);
@@ -14596,7 +14650,7 @@ const PageCanvas = forwardRef(
14596
14650
  }
14597
14651
  if (active && active instanceof fabric.Group && active.__docuforgeSectionGroup && getObjectId(active)) {
14598
14652
  const groupId = getObjectId(active);
14599
- const pageChildrenSec = ((_c = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _c.children) ?? [];
14653
+ const pageChildrenSec = ((_d = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _d.children) ?? [];
14600
14654
  const modifiedTarget2 = e == null ? void 0 : e.target;
14601
14655
  const resizeScaleTarget = lastResizeScaleTargetRef.current;
14602
14656
  lastResizeScaleTargetRef.current = null;
@@ -14627,7 +14681,7 @@ const PageCanvas = forwardRef(
14627
14681
  const node = findNodeById(pageChildrenSec, groupId);
14628
14682
  if (isChildModified && node && !groupMoved) {
14629
14683
  const stateAfter = useEditorStore.getState();
14630
- const pageAfter = ((_d = stateAfter.canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _d.children) ?? [];
14684
+ const pageAfter = ((_e = stateAfter.canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _e.children) ?? [];
14631
14685
  const groupNodeAfter = findNodeById(pageAfter, groupId);
14632
14686
  if (groupNodeAfter) {
14633
14687
  const abs = getAbsoluteBounds(groupNodeAfter, pageAfter);
@@ -14643,7 +14697,7 @@ const PageCanvas = forwardRef(
14643
14697
  }
14644
14698
  if (active && active instanceof fabric.Group && !(active instanceof fabric.ActiveSelection) && getObjectId(active)) {
14645
14699
  const groupId = getObjectId(active);
14646
- const pageChildren3 = ((_e = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _e.children) ?? [];
14700
+ const pageChildren3 = ((_f = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _f.children) ?? [];
14647
14701
  const w = (active.width ?? 0) * (active.scaleX ?? 1);
14648
14702
  const h = (active.height ?? 0) * (active.scaleY ?? 1);
14649
14703
  const centerX = active.left ?? 0;
@@ -14665,7 +14719,7 @@ const PageCanvas = forwardRef(
14665
14719
  }
14666
14720
  const activeObj = fabricCanvas.getActiveObject();
14667
14721
  let activeObjects = fabricCanvas.getActiveObjects();
14668
- const activeSelectionMoveStart = activeObj instanceof fabric.ActiveSelection && ((_f = activeSelectionMoveStartRef.current) == null ? void 0 : _f.selection) === activeObj ? activeSelectionMoveStartRef.current : null;
14722
+ const activeSelectionMoveStart = activeObj instanceof fabric.ActiveSelection && ((_g = activeSelectionMoveStartRef.current) == null ? void 0 : _g.selection) === activeObj ? activeSelectionMoveStartRef.current : null;
14669
14723
  const activeSelectionDelta = activeObj instanceof fabric.ActiveSelection && activeSelectionMoveStart ? (() => {
14670
14724
  const rect = activeObj.getBoundingRect();
14671
14725
  return {
@@ -15084,7 +15138,7 @@ const PageCanvas = forwardRef(
15084
15138
  const localScaleX = 1 / sx;
15085
15139
  const localScaleY = 1 / sy;
15086
15140
  obj.set({ scaleX: localScaleX, scaleY: localScaleY });
15087
- const selectionMatrix = (_g = activeObj == null ? void 0 : activeObj.calcTransformMatrix) == null ? void 0 : _g.call(activeObj);
15141
+ const selectionMatrix = (_h = activeObj == null ? void 0 : activeObj.calcTransformMatrix) == null ? void 0 : _h.call(activeObj);
15088
15142
  const localCenter = selectionMatrix ? fabric.util.transformPoint(preBakeCenter, fabric.util.invertTransform(selectionMatrix)) : preBakeCenter;
15089
15143
  obj.setPositionByOrigin(localCenter, "center", "center");
15090
15144
  }
@@ -15235,7 +15289,7 @@ const PageCanvas = forwardRef(
15235
15289
  const localScaleX = 1 / sx;
15236
15290
  const localScaleY = 1 / sy;
15237
15291
  obj.set({ scaleX: localScaleX, scaleY: localScaleY });
15238
- const selectionMatrix = (_h = activeObj == null ? void 0 : activeObj.calcTransformMatrix) == null ? void 0 : _h.call(activeObj);
15292
+ const selectionMatrix = (_i = activeObj == null ? void 0 : activeObj.calcTransformMatrix) == null ? void 0 : _i.call(activeObj);
15239
15293
  const localCenter = selectionMatrix ? fabric.util.transformPoint(preBakeCenter, fabric.util.invertTransform(selectionMatrix)) : preBakeCenter;
15240
15294
  obj.setPositionByOrigin(localCenter, "center", "center");
15241
15295
  } else {
@@ -15383,7 +15437,7 @@ const PageCanvas = forwardRef(
15383
15437
  updateElement(objId, elementUpdate, { recordHistory: false, skipLayoutRecalc: true });
15384
15438
  obj.setCoords();
15385
15439
  }
15386
- const pageChildrenForReflow = ((_i = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _i.children) ?? [];
15440
+ const pageChildrenForReflow = ((_j = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _j.children) ?? [];
15387
15441
  const stackGroupsToReflow = /* @__PURE__ */ new Set();
15388
15442
  for (const id of modifiedIdsThisRound) {
15389
15443
  const parent = findParentGroup(pageChildrenForReflow, id);
@@ -24523,9 +24577,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24523
24577
  }
24524
24578
  return svgString;
24525
24579
  }
24526
- const resolvedPackageVersion = "0.5.335";
24580
+ const resolvedPackageVersion = "0.5.337";
24527
24581
  const PACKAGE_VERSION = resolvedPackageVersion;
24528
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.335";
24582
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.337";
24529
24583
  const roundParityValue = (value) => {
24530
24584
  if (typeof value !== "number") return value;
24531
24585
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25339,7 +25393,7 @@ class PixldocsRenderer {
25339
25393
  await this.waitForCanvasScene(container, cloned, i);
25340
25394
  }
25341
25395
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25342
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-D2ai2jn2.js");
25396
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CpYoH5k1.js");
25343
25397
  const prepared = preparePagesForExport(
25344
25398
  cloned.pages,
25345
25399
  canvasWidth,
@@ -27659,7 +27713,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27659
27713
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27660
27714
  sanitizeSvgTreeForPdf(svgToDraw);
27661
27715
  try {
27662
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-D2ai2jn2.js");
27716
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CpYoH5k1.js");
27663
27717
  try {
27664
27718
  await logTextMeasurementDiagnostic(svgToDraw);
27665
27719
  } catch {
@@ -28059,4 +28113,4 @@ export {
28059
28113
  buildTeaserBlurFlatKeys as y,
28060
28114
  collectFontDescriptorsFromConfig as z
28061
28115
  };
28062
- //# sourceMappingURL=index-DpMLP8sp.js.map
28116
+ //# sourceMappingURL=index-B5OFG6Dl.js.map