@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
|
@@ -13754,113 +13754,21 @@ const PageCanvas = react.forwardRef(
|
|
|
13754
13754
|
const isXSide = corner === "ml" || corner === "mr";
|
|
13755
13755
|
const sAxis = isXSide ? Math.abs(obj.scaleX ?? 1) : Math.abs(obj.scaleY ?? 1);
|
|
13756
13756
|
if (sAxis > 1e-3) {
|
|
13757
|
-
const
|
|
13758
|
-
|
|
13757
|
+
const childAnglesNorm = obj.getObjects().map((c) => {
|
|
13758
|
+
const a = (c.angle ?? 0) % 360;
|
|
13759
|
+
return a < 0 ? a + 360 : a;
|
|
13760
|
+
});
|
|
13761
|
+
const baseAngle = childAnglesNorm[0] ?? 0;
|
|
13762
|
+
const hasMixedRotation = childAnglesNorm.some(
|
|
13763
|
+
(a) => Math.abs(a - baseAngle) > 0.5 && Math.abs(Math.abs(a - baseAngle) - 360) > 0.5
|
|
13759
13764
|
);
|
|
13760
|
-
if (
|
|
13761
|
-
if (
|
|
13762
|
-
obj.
|
|
13763
|
-
|
|
13764
|
-
|
|
13765
|
-
scaleX: obj.scaleX ?? 1,
|
|
13766
|
-
scaleY: obj.scaleY ?? 1,
|
|
13767
|
-
angle: obj.angle ?? 0,
|
|
13768
|
-
aCoords: (() => {
|
|
13769
|
-
obj.setCoords();
|
|
13770
|
-
const c = obj.aCoords;
|
|
13771
|
-
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;
|
|
13772
|
-
})(),
|
|
13773
|
-
corner
|
|
13774
|
-
};
|
|
13775
|
-
for (const ch of obj.getObjects()) {
|
|
13776
|
-
ch.__asRotAwareChild = {
|
|
13777
|
-
width: ch.width ?? 0,
|
|
13778
|
-
height: ch.height ?? 0,
|
|
13779
|
-
scaleX: ch.scaleX ?? 1,
|
|
13780
|
-
scaleY: ch.scaleY ?? 1,
|
|
13781
|
-
left: ch.left ?? 0,
|
|
13782
|
-
top: ch.top ?? 0,
|
|
13783
|
-
angle: ch.angle ?? 0
|
|
13784
|
-
};
|
|
13785
|
-
}
|
|
13786
|
-
}
|
|
13787
|
-
const snap = obj.__asRotAwareSnap;
|
|
13788
|
-
const asAngle = snap.angle;
|
|
13789
|
-
const effAxisScale = isXSide ? (obj.scaleX ?? 1) / (snap.scaleX || 1) : (obj.scaleY ?? 1) / (snap.scaleY || 1);
|
|
13790
|
-
obj._set("scaleX", snap.scaleX);
|
|
13791
|
-
obj._set("scaleY", snap.scaleY);
|
|
13792
|
-
for (const child of obj.getObjects()) {
|
|
13793
|
-
const cSnap = child.__asRotAwareChild;
|
|
13794
|
-
if (!cSnap) continue;
|
|
13795
|
-
const relAngleRad = (cSnap.angle - asAngle) * Math.PI / 180;
|
|
13796
|
-
const proj = Math.abs(Math.cos(relAngleRad));
|
|
13797
|
-
const effChildScale = 1 + (effAxisScale - 1) * proj;
|
|
13798
|
-
if (child instanceof fabric__namespace.Textbox) {
|
|
13799
|
-
if (isXSide) {
|
|
13800
|
-
const origVisW = cSnap.width * (cSnap.scaleX || 1);
|
|
13801
|
-
const newW = Math.max(20, origVisW * effChildScale);
|
|
13802
|
-
if (Math.abs((child.width ?? 0) - newW) > 0.5) {
|
|
13803
|
-
child._set("width", newW);
|
|
13804
|
-
child._set("scaleX", cSnap.scaleX);
|
|
13805
|
-
try {
|
|
13806
|
-
child.initDimensions();
|
|
13807
|
-
} catch {
|
|
13808
|
-
}
|
|
13809
|
-
}
|
|
13810
|
-
} else {
|
|
13811
|
-
const origVisH = cSnap.height * (cSnap.scaleY || 1);
|
|
13812
|
-
const newH = Math.max(20, origVisH * effChildScale);
|
|
13813
|
-
child.minBoxHeight = newH;
|
|
13814
|
-
child._set("scaleY", cSnap.scaleY);
|
|
13815
|
-
try {
|
|
13816
|
-
child.initDimensions();
|
|
13817
|
-
} catch {
|
|
13818
|
-
}
|
|
13819
|
-
}
|
|
13820
|
-
} else if (child instanceof fabric__namespace.FabricImage && !child.__cropGroup && !child.smartElementType) {
|
|
13821
|
-
if (isXSide) {
|
|
13822
|
-
const origVisW = cSnap.width * (cSnap.scaleX || 1);
|
|
13823
|
-
const newW = Math.max(1, origVisW * effChildScale);
|
|
13824
|
-
child._set("width", newW);
|
|
13825
|
-
child._set("scaleX", cSnap.scaleX);
|
|
13826
|
-
} else {
|
|
13827
|
-
const origVisH = cSnap.height * (cSnap.scaleY || 1);
|
|
13828
|
-
const newH = Math.max(1, origVisH * effChildScale);
|
|
13829
|
-
child._set("height", newH);
|
|
13830
|
-
child._set("scaleY", cSnap.scaleY);
|
|
13831
|
-
}
|
|
13832
|
-
} else {
|
|
13833
|
-
child._set("scaleX", (cSnap.scaleX || 1) * effChildScale);
|
|
13834
|
-
child._set("scaleY", (cSnap.scaleY || 1) * effChildScale);
|
|
13835
|
-
}
|
|
13836
|
-
if (isXSide) {
|
|
13837
|
-
child._set("left", cSnap.left * effAxisScale);
|
|
13838
|
-
child._set("top", cSnap.top);
|
|
13839
|
-
} else {
|
|
13840
|
-
child._set("left", cSnap.left);
|
|
13841
|
-
child._set("top", cSnap.top * effAxisScale);
|
|
13842
|
-
}
|
|
13843
|
-
child.setCoords();
|
|
13844
|
-
child.dirty = true;
|
|
13845
|
-
}
|
|
13846
|
-
try {
|
|
13847
|
-
obj.triggerLayout();
|
|
13848
|
-
} catch {
|
|
13765
|
+
if (hasMixedRotation) {
|
|
13766
|
+
if (isXSide) {
|
|
13767
|
+
obj._set("scaleY", obj.scaleX ?? 1);
|
|
13768
|
+
} else {
|
|
13769
|
+
obj._set("scaleX", obj.scaleY ?? 1);
|
|
13849
13770
|
}
|
|
13850
13771
|
obj.setCoords();
|
|
13851
|
-
const aAfter = obj.aCoords;
|
|
13852
|
-
const aBefore = snap.aCoords;
|
|
13853
|
-
if (aBefore && aAfter) {
|
|
13854
|
-
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 };
|
|
13855
|
-
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 };
|
|
13856
|
-
const dx = midBefore.x - midAfter.x;
|
|
13857
|
-
const dy = midBefore.y - midAfter.y;
|
|
13858
|
-
if (Math.abs(dx) > 0.01 || Math.abs(dy) > 0.01) {
|
|
13859
|
-
obj._set("left", (obj.left ?? 0) + dx);
|
|
13860
|
-
obj._set("top", (obj.top ?? 0) + dy);
|
|
13861
|
-
obj.setCoords();
|
|
13862
|
-
}
|
|
13863
|
-
}
|
|
13864
13772
|
obj.dirty = true;
|
|
13865
13773
|
return;
|
|
13866
13774
|
}
|
|
@@ -14364,9 +14272,7 @@ const PageCanvas = react.forwardRef(
|
|
|
14364
14272
|
for (const child of t.getObjects()) {
|
|
14365
14273
|
delete child.__asLiveOrigW;
|
|
14366
14274
|
delete child.__asLiveOrigH;
|
|
14367
|
-
delete child.__asRotAwareChild;
|
|
14368
14275
|
}
|
|
14369
|
-
delete t.__asRotAwareSnap;
|
|
14370
14276
|
}
|
|
14371
14277
|
} catch {
|
|
14372
14278
|
}
|
|
@@ -24393,9 +24299,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
24393
24299
|
}
|
|
24394
24300
|
return svgString;
|
|
24395
24301
|
}
|
|
24396
|
-
const resolvedPackageVersion = "0.5.
|
|
24302
|
+
const resolvedPackageVersion = "0.5.325";
|
|
24397
24303
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
24398
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
24304
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.325";
|
|
24399
24305
|
const roundParityValue = (value) => {
|
|
24400
24306
|
if (typeof value !== "number") return value;
|
|
24401
24307
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -25209,7 +25115,7 @@ class PixldocsRenderer {
|
|
|
25209
25115
|
await this.waitForCanvasScene(container, cloned, i);
|
|
25210
25116
|
}
|
|
25211
25117
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
25212
|
-
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
25118
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-DHtj2TRz.cjs"));
|
|
25213
25119
|
const prepared = preparePagesForExport(
|
|
25214
25120
|
cloned.pages,
|
|
25215
25121
|
canvasWidth,
|
|
@@ -27529,7 +27435,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
27529
27435
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
27530
27436
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
27531
27437
|
try {
|
|
27532
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
27438
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-DHtj2TRz.cjs"));
|
|
27533
27439
|
try {
|
|
27534
27440
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
27535
27441
|
} catch {
|
|
@@ -27926,4 +27832,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
27926
27832
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
27927
27833
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
27928
27834
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
27929
|
-
//# sourceMappingURL=index-
|
|
27835
|
+
//# sourceMappingURL=index-BeSkXpzz.cjs.map
|