@pixldocs/canvas-renderer 0.5.404 → 0.5.406

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.
@@ -13240,6 +13240,24 @@ const PageCanvas = forwardRef(
13240
13240
  var _a2, _b2, _c2;
13241
13241
  const active = target instanceof fabric.ActiveSelection ? target : fabricCanvas.getActiveObject();
13242
13242
  if (!(active instanceof fabric.ActiveSelection)) return;
13243
+ try {
13244
+ const asScaleX = Math.abs(active.scaleX ?? 1);
13245
+ const asScaleY = Math.abs(active.scaleY ?? 1);
13246
+ if (Math.abs(asScaleX - 1) > 1e-4 || Math.abs(asScaleY - 1) > 1e-4) {
13247
+ const newW = Math.max(1, (active.width ?? 0) * asScaleX);
13248
+ const newH = Math.max(1, (active.height ?? 0) * asScaleY);
13249
+ active.set({ width: newW, height: newH, scaleX: 1, scaleY: 1 });
13250
+ active.setCoords();
13251
+ const ct = fabricCanvas._currentTransform;
13252
+ if (ct && ct.target === active && ct.original) {
13253
+ ct.original.scaleX = 1;
13254
+ ct.original.scaleY = 1;
13255
+ ct.original.width = newW;
13256
+ ct.original.height = newH;
13257
+ }
13258
+ }
13259
+ } catch {
13260
+ }
13243
13261
  if (!activeSelectionMoveStartRef.current || activeSelectionMoveStartRef.current.selection !== active) {
13244
13262
  const rect2 = active.getBoundingRect();
13245
13263
  activeSelectionMoveStartRef.current = {
@@ -14169,7 +14187,7 @@ const PageCanvas = forwardRef(
14169
14187
  fabricCanvas.on("selection:cleared", () => {
14170
14188
  });
14171
14189
  fabricCanvas.on("object:scaling", (e) => {
14172
- var _a2, _b2, _c2, _d, _e, _f, _g, _h;
14190
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j;
14173
14191
  if (!isActiveRef.current) return;
14174
14192
  const t = e.target;
14175
14193
  if (t) lastResizeScaleTargetRef.current = t;
@@ -14353,15 +14371,18 @@ const PageCanvas = forwardRef(
14353
14371
  }
14354
14372
  if (obj instanceof fabric.ActiveSelection && (corner === "ml" || corner === "mr" || corner === "mt" || corner === "mb")) {
14355
14373
  const isXSide = corner === "ml" || corner === "mr";
14356
- const sAxis = isXSide ? Math.abs(obj.scaleX ?? 1) : Math.abs(obj.scaleY ?? 1);
14374
+ const _cur = fabricCanvas._currentTransform;
14375
+ const startSx = Math.abs(Number(((_d = _cur == null ? void 0 : _cur.original) == null ? void 0 : _d.scaleX) ?? 1)) || 1;
14376
+ const startSy = Math.abs(Number(((_e = _cur == null ? void 0 : _cur.original) == null ? void 0 : _e.scaleY) ?? 1)) || 1;
14377
+ const sAxis = isXSide ? Math.abs((obj.scaleX ?? 1) / startSx) : Math.abs((obj.scaleY ?? 1) / startSy);
14357
14378
  if (sAxis > 1e-3) {
14358
- if (isXSide && ((_d = groupShiftReflowSnapshotRef.current) == null ? void 0 : _d.selection) !== obj) {
14379
+ if (isXSide && ((_f = groupShiftReflowSnapshotRef.current) == null ? void 0 : _f.selection) !== obj) {
14359
14380
  groupShiftReflowSnapshotRef.current = null;
14360
14381
  const logicalGroupId = obj.__pixldocsGroupSelection;
14361
14382
  if (logicalGroupId) {
14362
14383
  try {
14363
14384
  const state = useEditorStore.getState();
14364
- const pageChildren2 = ((_e = state.canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _e.children) ?? [];
14385
+ const pageChildren2 = ((_g = state.canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _g.children) ?? [];
14365
14386
  const groupNode = findNodeById(pageChildren2, logicalGroupId);
14366
14387
  if (groupNode && isGroup(groupNode) && !isStackLayoutMode(groupNode.layoutMode)) {
14367
14388
  const entries = obj.getObjects().map((c) => ({
@@ -14399,7 +14420,7 @@ const PageCanvas = forwardRef(
14399
14420
  }
14400
14421
  continue;
14401
14422
  }
14402
- if (child instanceof fabric.Group && (child.__cropGroup || ((_f = child._ct) == null ? void 0 : _f.isCropGroup))) {
14423
+ if (child instanceof fabric.Group && (child.__cropGroup || ((_h = child._ct) == null ? void 0 : _h.isCropGroup))) {
14403
14424
  const ct = child.__cropData;
14404
14425
  if (!ct) continue;
14405
14426
  if (child.__asLiveOrigAngle == null) {
@@ -14566,7 +14587,7 @@ const PageCanvas = forwardRef(
14566
14587
  child.dirty = true;
14567
14588
  didReflowTextChild = true;
14568
14589
  }
14569
- if (isXSide && ((_g = groupShiftReflowSnapshotRef.current) == null ? void 0 : _g.selection) === obj) {
14590
+ if (isXSide && ((_i = groupShiftReflowSnapshotRef.current) == null ? void 0 : _i.selection) === obj) {
14570
14591
  const snap = groupShiftReflowSnapshotRef.current;
14571
14592
  const anchorEntry = snap.children[0];
14572
14593
  const anchorTopLive = anchorEntry.obj.top ?? 0;
@@ -14726,7 +14747,7 @@ const PageCanvas = forwardRef(
14726
14747
  setGuides(gridGuidesForScale.length ? [...scaleGuides, ...gridGuidesForScale] : scaleGuides);
14727
14748
  if (drilledGroupIdRef.current) {
14728
14749
  try {
14729
- (_h = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _h.call(fabricCanvas);
14750
+ (_j = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _j.call(fabricCanvas);
14730
14751
  } catch {
14731
14752
  }
14732
14753
  }
@@ -25135,9 +25156,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
25135
25156
  }
25136
25157
  return svgString;
25137
25158
  }
25138
- const resolvedPackageVersion = "0.5.404";
25159
+ const resolvedPackageVersion = "0.5.406";
25139
25160
  const PACKAGE_VERSION = resolvedPackageVersion;
25140
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.404";
25161
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.406";
25141
25162
  const roundParityValue = (value) => {
25142
25163
  if (typeof value !== "number") return value;
25143
25164
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25951,7 +25972,7 @@ class PixldocsRenderer {
25951
25972
  await this.waitForCanvasScene(container, cloned, i);
25952
25973
  }
25953
25974
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25954
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CWHd6dnp.js");
25975
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-BSFv6jYQ.js");
25955
25976
  const prepared = preparePagesForExport(
25956
25977
  cloned.pages,
25957
25978
  canvasWidth,
@@ -28271,7 +28292,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28271
28292
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28272
28293
  sanitizeSvgTreeForPdf(svgToDraw);
28273
28294
  try {
28274
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CWHd6dnp.js");
28295
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-BSFv6jYQ.js");
28275
28296
  try {
28276
28297
  await logTextMeasurementDiagnostic(svgToDraw);
28277
28298
  } catch {
@@ -28671,4 +28692,4 @@ export {
28671
28692
  buildTeaserBlurFlatKeys as y,
28672
28693
  collectFontDescriptorsFromConfig as z
28673
28694
  };
28674
- //# sourceMappingURL=index-FljS6ssY.js.map
28695
+ //# sourceMappingURL=index-D-UEBi3B.js.map