@pixldocs/canvas-renderer 0.5.323 → 0.5.324
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.
- package/dist/{index-DZw_u3PM.cjs → index-DPUc5rGE.cjs} +108 -33
- package/dist/index-DPUc5rGE.cjs.map +1 -0
- package/dist/{index-B7-tIVVJ.js → index-y6RZ0a0x.js} +108 -33
- package/dist/index-y6RZ0a0x.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-CMBSLf34.js → vectorPdfExport-Chs7LuGz.js} +4 -4
- package/dist/{vectorPdfExport-CMBSLf34.js.map → vectorPdfExport-Chs7LuGz.js.map} +1 -1
- package/dist/{vectorPdfExport-Da51BWna.cjs → vectorPdfExport-DYMHC1Zs.cjs} +4 -4
- package/dist/{vectorPdfExport-Da51BWna.cjs.map → vectorPdfExport-DYMHC1Zs.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/index-B7-tIVVJ.js.map +0 -1
- package/dist/index-DZw_u3PM.cjs.map +0 -1
|
@@ -13572,30 +13572,6 @@ const PageCanvas = forwardRef(
|
|
|
13572
13572
|
}
|
|
13573
13573
|
const obj = t;
|
|
13574
13574
|
if (!obj) return;
|
|
13575
|
-
try {
|
|
13576
|
-
const transformInfo = e.transform;
|
|
13577
|
-
const cornerEarly = (transformInfo == null ? void 0 : transformInfo.corner) || "";
|
|
13578
|
-
const isSideHandle = cornerEarly === "ml" || cornerEarly === "mr" || cornerEarly === "mt" || cornerEarly === "mb";
|
|
13579
|
-
const isGroupLike = obj instanceof fabric.Group && !obj.__cropGroup && !obj.__docuforgeSectionGroup;
|
|
13580
|
-
if (isSideHandle && isGroupLike && typeof obj.getObjects === "function") {
|
|
13581
|
-
const kids = obj.getObjects();
|
|
13582
|
-
const hasRotatedChild = kids.some(
|
|
13583
|
-
(c) => Math.abs((c.angle ?? 0) % 360) > 0.5
|
|
13584
|
-
);
|
|
13585
|
-
if (hasRotatedChild) {
|
|
13586
|
-
const isXSideEarly = cornerEarly === "ml" || cornerEarly === "mr";
|
|
13587
|
-
if (isXSideEarly) {
|
|
13588
|
-
obj._set("scaleY", obj.scaleX ?? 1);
|
|
13589
|
-
} else {
|
|
13590
|
-
obj._set("scaleX", obj.scaleY ?? 1);
|
|
13591
|
-
}
|
|
13592
|
-
obj.setCoords();
|
|
13593
|
-
obj.dirty = true;
|
|
13594
|
-
return;
|
|
13595
|
-
}
|
|
13596
|
-
}
|
|
13597
|
-
} catch {
|
|
13598
|
-
}
|
|
13599
13575
|
if (obj instanceof fabric.Rect || obj instanceof fabric.Path || obj instanceof fabric.Circle || obj instanceof fabric.Triangle || obj instanceof fabric.Line) {
|
|
13600
13576
|
obj.set({ strokeUniform: true });
|
|
13601
13577
|
}
|
|
@@ -13764,12 +13740,109 @@ const PageCanvas = forwardRef(
|
|
|
13764
13740
|
(c) => Math.abs((c.angle ?? 0) % 360) > 0.5
|
|
13765
13741
|
);
|
|
13766
13742
|
if (hasRotatedChild) {
|
|
13767
|
-
if (
|
|
13768
|
-
obj.
|
|
13769
|
-
|
|
13770
|
-
|
|
13743
|
+
if (obj.__asRotAwareSnap == null) {
|
|
13744
|
+
obj.__asRotAwareSnap = {
|
|
13745
|
+
width: obj.width ?? 0,
|
|
13746
|
+
height: obj.height ?? 0,
|
|
13747
|
+
scaleX: obj.scaleX ?? 1,
|
|
13748
|
+
scaleY: obj.scaleY ?? 1,
|
|
13749
|
+
angle: obj.angle ?? 0,
|
|
13750
|
+
aCoords: (() => {
|
|
13751
|
+
obj.setCoords();
|
|
13752
|
+
const c = obj.aCoords;
|
|
13753
|
+
return c ? { tl: { x: c.tl.x, y: c.tl.y }, tr: { x: c.tr.x, y: c.tr.y }, br: { x: c.br.x, y: c.br.y }, bl: { x: c.bl.x, y: c.bl.y } } : null;
|
|
13754
|
+
})(),
|
|
13755
|
+
corner
|
|
13756
|
+
};
|
|
13757
|
+
for (const ch of obj.getObjects()) {
|
|
13758
|
+
ch.__asRotAwareChild = {
|
|
13759
|
+
width: ch.width ?? 0,
|
|
13760
|
+
height: ch.height ?? 0,
|
|
13761
|
+
scaleX: ch.scaleX ?? 1,
|
|
13762
|
+
scaleY: ch.scaleY ?? 1,
|
|
13763
|
+
left: ch.left ?? 0,
|
|
13764
|
+
top: ch.top ?? 0,
|
|
13765
|
+
angle: ch.angle ?? 0
|
|
13766
|
+
};
|
|
13767
|
+
}
|
|
13768
|
+
}
|
|
13769
|
+
const snap = obj.__asRotAwareSnap;
|
|
13770
|
+
const asAngle = snap.angle;
|
|
13771
|
+
const effAxisScale = isXSide ? (obj.scaleX ?? 1) / (snap.scaleX || 1) : (obj.scaleY ?? 1) / (snap.scaleY || 1);
|
|
13772
|
+
obj._set("scaleX", snap.scaleX);
|
|
13773
|
+
obj._set("scaleY", snap.scaleY);
|
|
13774
|
+
for (const child of obj.getObjects()) {
|
|
13775
|
+
const cSnap = child.__asRotAwareChild;
|
|
13776
|
+
if (!cSnap) continue;
|
|
13777
|
+
const relAngleRad = (cSnap.angle - asAngle) * Math.PI / 180;
|
|
13778
|
+
const proj = Math.abs(Math.cos(relAngleRad));
|
|
13779
|
+
const effChildScale = 1 + (effAxisScale - 1) * proj;
|
|
13780
|
+
if (child instanceof fabric.Textbox) {
|
|
13781
|
+
if (isXSide) {
|
|
13782
|
+
const origVisW = cSnap.width * (cSnap.scaleX || 1);
|
|
13783
|
+
const newW = Math.max(20, origVisW * effChildScale);
|
|
13784
|
+
if (Math.abs((child.width ?? 0) - newW) > 0.5) {
|
|
13785
|
+
child._set("width", newW);
|
|
13786
|
+
child._set("scaleX", cSnap.scaleX);
|
|
13787
|
+
try {
|
|
13788
|
+
child.initDimensions();
|
|
13789
|
+
} catch {
|
|
13790
|
+
}
|
|
13791
|
+
}
|
|
13792
|
+
} else {
|
|
13793
|
+
const origVisH = cSnap.height * (cSnap.scaleY || 1);
|
|
13794
|
+
const newH = Math.max(20, origVisH * effChildScale);
|
|
13795
|
+
child.minBoxHeight = newH;
|
|
13796
|
+
child._set("scaleY", cSnap.scaleY);
|
|
13797
|
+
try {
|
|
13798
|
+
child.initDimensions();
|
|
13799
|
+
} catch {
|
|
13800
|
+
}
|
|
13801
|
+
}
|
|
13802
|
+
} else if (child instanceof fabric.FabricImage && !child.__cropGroup && !child.smartElementType) {
|
|
13803
|
+
if (isXSide) {
|
|
13804
|
+
const origVisW = cSnap.width * (cSnap.scaleX || 1);
|
|
13805
|
+
const newW = Math.max(1, origVisW * effChildScale);
|
|
13806
|
+
child._set("width", newW);
|
|
13807
|
+
child._set("scaleX", cSnap.scaleX);
|
|
13808
|
+
} else {
|
|
13809
|
+
const origVisH = cSnap.height * (cSnap.scaleY || 1);
|
|
13810
|
+
const newH = Math.max(1, origVisH * effChildScale);
|
|
13811
|
+
child._set("height", newH);
|
|
13812
|
+
child._set("scaleY", cSnap.scaleY);
|
|
13813
|
+
}
|
|
13814
|
+
} else {
|
|
13815
|
+
child._set("scaleX", (cSnap.scaleX || 1) * effChildScale);
|
|
13816
|
+
child._set("scaleY", (cSnap.scaleY || 1) * effChildScale);
|
|
13817
|
+
}
|
|
13818
|
+
if (isXSide) {
|
|
13819
|
+
child._set("left", cSnap.left * effAxisScale);
|
|
13820
|
+
child._set("top", cSnap.top);
|
|
13821
|
+
} else {
|
|
13822
|
+
child._set("left", cSnap.left);
|
|
13823
|
+
child._set("top", cSnap.top * effAxisScale);
|
|
13824
|
+
}
|
|
13825
|
+
child.setCoords();
|
|
13826
|
+
child.dirty = true;
|
|
13827
|
+
}
|
|
13828
|
+
try {
|
|
13829
|
+
obj.triggerLayout();
|
|
13830
|
+
} catch {
|
|
13771
13831
|
}
|
|
13772
13832
|
obj.setCoords();
|
|
13833
|
+
const aAfter = obj.aCoords;
|
|
13834
|
+
const aBefore = snap.aCoords;
|
|
13835
|
+
if (aBefore && aAfter) {
|
|
13836
|
+
const midBefore = corner === "ml" ? { x: (aBefore.tr.x + aBefore.br.x) / 2, y: (aBefore.tr.y + aBefore.br.y) / 2 } : corner === "mr" ? { x: (aBefore.tl.x + aBefore.bl.x) / 2, y: (aBefore.tl.y + aBefore.bl.y) / 2 } : corner === "mt" ? { x: (aBefore.bl.x + aBefore.br.x) / 2, y: (aBefore.bl.y + aBefore.br.y) / 2 } : { x: (aBefore.tl.x + aBefore.tr.x) / 2, y: (aBefore.tl.y + aBefore.tr.y) / 2 };
|
|
13837
|
+
const midAfter = corner === "ml" ? { x: (aAfter.tr.x + aAfter.br.x) / 2, y: (aAfter.tr.y + aAfter.br.y) / 2 } : corner === "mr" ? { x: (aAfter.tl.x + aAfter.bl.x) / 2, y: (aAfter.tl.y + aAfter.bl.y) / 2 } : corner === "mt" ? { x: (aAfter.bl.x + aAfter.br.x) / 2, y: (aAfter.bl.y + aAfter.br.y) / 2 } : { x: (aAfter.tl.x + aAfter.tr.x) / 2, y: (aAfter.tl.y + aAfter.tr.y) / 2 };
|
|
13838
|
+
const dx = midBefore.x - midAfter.x;
|
|
13839
|
+
const dy = midBefore.y - midAfter.y;
|
|
13840
|
+
if (Math.abs(dx) > 0.01 || Math.abs(dy) > 0.01) {
|
|
13841
|
+
obj._set("left", (obj.left ?? 0) + dx);
|
|
13842
|
+
obj._set("top", (obj.top ?? 0) + dy);
|
|
13843
|
+
obj.setCoords();
|
|
13844
|
+
}
|
|
13845
|
+
}
|
|
13773
13846
|
obj.dirty = true;
|
|
13774
13847
|
return;
|
|
13775
13848
|
}
|
|
@@ -14273,7 +14346,9 @@ const PageCanvas = forwardRef(
|
|
|
14273
14346
|
for (const child of t.getObjects()) {
|
|
14274
14347
|
delete child.__asLiveOrigW;
|
|
14275
14348
|
delete child.__asLiveOrigH;
|
|
14349
|
+
delete child.__asRotAwareChild;
|
|
14276
14350
|
}
|
|
14351
|
+
delete t.__asRotAwareSnap;
|
|
14277
14352
|
}
|
|
14278
14353
|
} catch {
|
|
14279
14354
|
}
|
|
@@ -24300,9 +24375,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
24300
24375
|
}
|
|
24301
24376
|
return svgString;
|
|
24302
24377
|
}
|
|
24303
|
-
const resolvedPackageVersion = "0.5.
|
|
24378
|
+
const resolvedPackageVersion = "0.5.324";
|
|
24304
24379
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
24305
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
24380
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.324";
|
|
24306
24381
|
const roundParityValue = (value) => {
|
|
24307
24382
|
if (typeof value !== "number") return value;
|
|
24308
24383
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -25116,7 +25191,7 @@ class PixldocsRenderer {
|
|
|
25116
25191
|
await this.waitForCanvasScene(container, cloned, i);
|
|
25117
25192
|
}
|
|
25118
25193
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
25119
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
25194
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-Chs7LuGz.js");
|
|
25120
25195
|
const prepared = preparePagesForExport(
|
|
25121
25196
|
cloned.pages,
|
|
25122
25197
|
canvasWidth,
|
|
@@ -27436,7 +27511,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
27436
27511
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
27437
27512
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
27438
27513
|
try {
|
|
27439
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
27514
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-Chs7LuGz.js");
|
|
27440
27515
|
try {
|
|
27441
27516
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
27442
27517
|
} catch {
|
|
@@ -27836,4 +27911,4 @@ export {
|
|
|
27836
27911
|
buildTeaserBlurFlatKeys as y,
|
|
27837
27912
|
collectFontDescriptorsFromConfig as z
|
|
27838
27913
|
};
|
|
27839
|
-
//# sourceMappingURL=index-
|
|
27914
|
+
//# sourceMappingURL=index-y6RZ0a0x.js.map
|