@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.
@@ -13258,6 +13258,24 @@ const PageCanvas = react.forwardRef(
13258
13258
  var _a2, _b2, _c2;
13259
13259
  const active = target instanceof fabric__namespace.ActiveSelection ? target : fabricCanvas.getActiveObject();
13260
13260
  if (!(active instanceof fabric__namespace.ActiveSelection)) return;
13261
+ try {
13262
+ const asScaleX = Math.abs(active.scaleX ?? 1);
13263
+ const asScaleY = Math.abs(active.scaleY ?? 1);
13264
+ if (Math.abs(asScaleX - 1) > 1e-4 || Math.abs(asScaleY - 1) > 1e-4) {
13265
+ const newW = Math.max(1, (active.width ?? 0) * asScaleX);
13266
+ const newH = Math.max(1, (active.height ?? 0) * asScaleY);
13267
+ active.set({ width: newW, height: newH, scaleX: 1, scaleY: 1 });
13268
+ active.setCoords();
13269
+ const ct = fabricCanvas._currentTransform;
13270
+ if (ct && ct.target === active && ct.original) {
13271
+ ct.original.scaleX = 1;
13272
+ ct.original.scaleY = 1;
13273
+ ct.original.width = newW;
13274
+ ct.original.height = newH;
13275
+ }
13276
+ }
13277
+ } catch {
13278
+ }
13261
13279
  if (!activeSelectionMoveStartRef.current || activeSelectionMoveStartRef.current.selection !== active) {
13262
13280
  const rect2 = active.getBoundingRect();
13263
13281
  activeSelectionMoveStartRef.current = {
@@ -14187,7 +14205,7 @@ const PageCanvas = react.forwardRef(
14187
14205
  fabricCanvas.on("selection:cleared", () => {
14188
14206
  });
14189
14207
  fabricCanvas.on("object:scaling", (e) => {
14190
- var _a2, _b2, _c2, _d, _e, _f, _g, _h;
14208
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j;
14191
14209
  if (!isActiveRef.current) return;
14192
14210
  const t = e.target;
14193
14211
  if (t) lastResizeScaleTargetRef.current = t;
@@ -14371,15 +14389,18 @@ const PageCanvas = react.forwardRef(
14371
14389
  }
14372
14390
  if (obj instanceof fabric__namespace.ActiveSelection && (corner === "ml" || corner === "mr" || corner === "mt" || corner === "mb")) {
14373
14391
  const isXSide = corner === "ml" || corner === "mr";
14374
- const sAxis = isXSide ? Math.abs(obj.scaleX ?? 1) : Math.abs(obj.scaleY ?? 1);
14392
+ const _cur = fabricCanvas._currentTransform;
14393
+ const startSx = Math.abs(Number(((_d = _cur == null ? void 0 : _cur.original) == null ? void 0 : _d.scaleX) ?? 1)) || 1;
14394
+ const startSy = Math.abs(Number(((_e = _cur == null ? void 0 : _cur.original) == null ? void 0 : _e.scaleY) ?? 1)) || 1;
14395
+ const sAxis = isXSide ? Math.abs((obj.scaleX ?? 1) / startSx) : Math.abs((obj.scaleY ?? 1) / startSy);
14375
14396
  if (sAxis > 1e-3) {
14376
- if (isXSide && ((_d = groupShiftReflowSnapshotRef.current) == null ? void 0 : _d.selection) !== obj) {
14397
+ if (isXSide && ((_f = groupShiftReflowSnapshotRef.current) == null ? void 0 : _f.selection) !== obj) {
14377
14398
  groupShiftReflowSnapshotRef.current = null;
14378
14399
  const logicalGroupId = obj.__pixldocsGroupSelection;
14379
14400
  if (logicalGroupId) {
14380
14401
  try {
14381
14402
  const state = useEditorStore.getState();
14382
- const pageChildren2 = ((_e = state.canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _e.children) ?? [];
14403
+ const pageChildren2 = ((_g = state.canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _g.children) ?? [];
14383
14404
  const groupNode = findNodeById(pageChildren2, logicalGroupId);
14384
14405
  if (groupNode && isGroup(groupNode) && !isStackLayoutMode(groupNode.layoutMode)) {
14385
14406
  const entries = obj.getObjects().map((c) => ({
@@ -14417,7 +14438,7 @@ const PageCanvas = react.forwardRef(
14417
14438
  }
14418
14439
  continue;
14419
14440
  }
14420
- if (child instanceof fabric__namespace.Group && (child.__cropGroup || ((_f = child._ct) == null ? void 0 : _f.isCropGroup))) {
14441
+ if (child instanceof fabric__namespace.Group && (child.__cropGroup || ((_h = child._ct) == null ? void 0 : _h.isCropGroup))) {
14421
14442
  const ct = child.__cropData;
14422
14443
  if (!ct) continue;
14423
14444
  if (child.__asLiveOrigAngle == null) {
@@ -14584,7 +14605,7 @@ const PageCanvas = react.forwardRef(
14584
14605
  child.dirty = true;
14585
14606
  didReflowTextChild = true;
14586
14607
  }
14587
- if (isXSide && ((_g = groupShiftReflowSnapshotRef.current) == null ? void 0 : _g.selection) === obj) {
14608
+ if (isXSide && ((_i = groupShiftReflowSnapshotRef.current) == null ? void 0 : _i.selection) === obj) {
14588
14609
  const snap = groupShiftReflowSnapshotRef.current;
14589
14610
  const anchorEntry = snap.children[0];
14590
14611
  const anchorTopLive = anchorEntry.obj.top ?? 0;
@@ -14744,7 +14765,7 @@ const PageCanvas = react.forwardRef(
14744
14765
  setGuides(gridGuidesForScale.length ? [...scaleGuides, ...gridGuidesForScale] : scaleGuides);
14745
14766
  if (drilledGroupIdRef.current) {
14746
14767
  try {
14747
- (_h = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _h.call(fabricCanvas);
14768
+ (_j = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _j.call(fabricCanvas);
14748
14769
  } catch {
14749
14770
  }
14750
14771
  }
@@ -25153,9 +25174,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
25153
25174
  }
25154
25175
  return svgString;
25155
25176
  }
25156
- const resolvedPackageVersion = "0.5.404";
25177
+ const resolvedPackageVersion = "0.5.406";
25157
25178
  const PACKAGE_VERSION = resolvedPackageVersion;
25158
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.404";
25179
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.406";
25159
25180
  const roundParityValue = (value) => {
25160
25181
  if (typeof value !== "number") return value;
25161
25182
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25969,7 +25990,7 @@ class PixldocsRenderer {
25969
25990
  await this.waitForCanvasScene(container, cloned, i);
25970
25991
  }
25971
25992
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25972
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-CMUgVgvn.cjs"));
25993
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-r257koLL.cjs"));
25973
25994
  const prepared = preparePagesForExport(
25974
25995
  cloned.pages,
25975
25996
  canvasWidth,
@@ -28289,7 +28310,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28289
28310
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28290
28311
  sanitizeSvgTreeForPdf(svgToDraw);
28291
28312
  try {
28292
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-CMUgVgvn.cjs"));
28313
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-r257koLL.cjs"));
28293
28314
  try {
28294
28315
  await logTextMeasurementDiagnostic(svgToDraw);
28295
28316
  } catch {
@@ -28686,4 +28707,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
28686
28707
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
28687
28708
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
28688
28709
  exports.warmTemplateFromForm = warmTemplateFromForm;
28689
- //# sourceMappingURL=index-BsKKxOH4.cjs.map
28710
+ //# sourceMappingURL=index-D5UViOKA.cjs.map