@pixldocs/canvas-renderer 0.5.324 → 0.5.325
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-DPUc5rGE.cjs → index-BeSkXpzz.cjs} +17 -111
- package/dist/index-BeSkXpzz.cjs.map +1 -0
- package/dist/{index-y6RZ0a0x.js → index-CYpr1MY-.js} +17 -111
- package/dist/index-CYpr1MY-.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-DYMHC1Zs.cjs → vectorPdfExport-DHtj2TRz.cjs} +4 -4
- package/dist/{vectorPdfExport-DYMHC1Zs.cjs.map → vectorPdfExport-DHtj2TRz.cjs.map} +1 -1
- package/dist/{vectorPdfExport-Chs7LuGz.js → vectorPdfExport-Mq6tcwR7.js} +4 -4
- package/dist/{vectorPdfExport-Chs7LuGz.js.map → vectorPdfExport-Mq6tcwR7.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-DPUc5rGE.cjs.map +0 -1
- package/dist/index-y6RZ0a0x.js.map +0 -1
|
@@ -13736,113 +13736,21 @@ const PageCanvas = forwardRef(
|
|
|
13736
13736
|
const isXSide = corner === "ml" || corner === "mr";
|
|
13737
13737
|
const sAxis = isXSide ? Math.abs(obj.scaleX ?? 1) : Math.abs(obj.scaleY ?? 1);
|
|
13738
13738
|
if (sAxis > 1e-3) {
|
|
13739
|
-
const
|
|
13740
|
-
|
|
13739
|
+
const childAnglesNorm = obj.getObjects().map((c) => {
|
|
13740
|
+
const a = (c.angle ?? 0) % 360;
|
|
13741
|
+
return a < 0 ? a + 360 : a;
|
|
13742
|
+
});
|
|
13743
|
+
const baseAngle = childAnglesNorm[0] ?? 0;
|
|
13744
|
+
const hasMixedRotation = childAnglesNorm.some(
|
|
13745
|
+
(a) => Math.abs(a - baseAngle) > 0.5 && Math.abs(Math.abs(a - baseAngle) - 360) > 0.5
|
|
13741
13746
|
);
|
|
13742
|
-
if (
|
|
13743
|
-
if (
|
|
13744
|
-
obj.
|
|
13745
|
-
|
|
13746
|
-
|
|
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 {
|
|
13747
|
+
if (hasMixedRotation) {
|
|
13748
|
+
if (isXSide) {
|
|
13749
|
+
obj._set("scaleY", obj.scaleX ?? 1);
|
|
13750
|
+
} else {
|
|
13751
|
+
obj._set("scaleX", obj.scaleY ?? 1);
|
|
13831
13752
|
}
|
|
13832
13753
|
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
|
-
}
|
|
13846
13754
|
obj.dirty = true;
|
|
13847
13755
|
return;
|
|
13848
13756
|
}
|
|
@@ -14346,9 +14254,7 @@ const PageCanvas = forwardRef(
|
|
|
14346
14254
|
for (const child of t.getObjects()) {
|
|
14347
14255
|
delete child.__asLiveOrigW;
|
|
14348
14256
|
delete child.__asLiveOrigH;
|
|
14349
|
-
delete child.__asRotAwareChild;
|
|
14350
14257
|
}
|
|
14351
|
-
delete t.__asRotAwareSnap;
|
|
14352
14258
|
}
|
|
14353
14259
|
} catch {
|
|
14354
14260
|
}
|
|
@@ -24375,9 +24281,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
24375
24281
|
}
|
|
24376
24282
|
return svgString;
|
|
24377
24283
|
}
|
|
24378
|
-
const resolvedPackageVersion = "0.5.
|
|
24284
|
+
const resolvedPackageVersion = "0.5.325";
|
|
24379
24285
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
24380
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
24286
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.325";
|
|
24381
24287
|
const roundParityValue = (value) => {
|
|
24382
24288
|
if (typeof value !== "number") return value;
|
|
24383
24289
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -25191,7 +25097,7 @@ class PixldocsRenderer {
|
|
|
25191
25097
|
await this.waitForCanvasScene(container, cloned, i);
|
|
25192
25098
|
}
|
|
25193
25099
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
25194
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
25100
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-Mq6tcwR7.js");
|
|
25195
25101
|
const prepared = preparePagesForExport(
|
|
25196
25102
|
cloned.pages,
|
|
25197
25103
|
canvasWidth,
|
|
@@ -27511,7 +27417,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
27511
27417
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
27512
27418
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
27513
27419
|
try {
|
|
27514
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
27420
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-Mq6tcwR7.js");
|
|
27515
27421
|
try {
|
|
27516
27422
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
27517
27423
|
} catch {
|
|
@@ -27911,4 +27817,4 @@ export {
|
|
|
27911
27817
|
buildTeaserBlurFlatKeys as y,
|
|
27912
27818
|
collectFontDescriptorsFromConfig as z
|
|
27913
27819
|
};
|
|
27914
|
-
//# sourceMappingURL=index-
|
|
27820
|
+
//# sourceMappingURL=index-CYpr1MY-.js.map
|