@pixldocs/canvas-renderer 0.5.446 → 0.5.447
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-BAQIJf_b.cjs → index-D7JnQkpf.cjs} +80 -18
- package/dist/index-D7JnQkpf.cjs.map +1 -0
- package/dist/{index-BhfNlcH_.js → index-g0HVhMPi.js} +80 -18
- package/dist/index-g0HVhMPi.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-D7WHhcGD.cjs → vectorPdfExport-BVQkDFXD.cjs} +4 -4
- package/dist/{vectorPdfExport-D7WHhcGD.cjs.map → vectorPdfExport-BVQkDFXD.cjs.map} +1 -1
- package/dist/{vectorPdfExport-DNSgRVdW.js → vectorPdfExport-BdCLPcgH.js} +4 -4
- package/dist/{vectorPdfExport-DNSgRVdW.js.map → vectorPdfExport-BdCLPcgH.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-BAQIJf_b.cjs.map +0 -1
- package/dist/index-BhfNlcH_.js.map +0 -1
|
@@ -14637,7 +14637,7 @@ const PageCanvas = forwardRef(
|
|
|
14637
14637
|
fabricCanvas.on("selection:cleared", () => {
|
|
14638
14638
|
});
|
|
14639
14639
|
fabricCanvas.on("object:scaling", (e) => {
|
|
14640
|
-
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
14640
|
+
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
14641
14641
|
if (!isActiveRef.current) return;
|
|
14642
14642
|
const t = e.target;
|
|
14643
14643
|
if (t) lastResizeScaleTargetRef.current = t;
|
|
@@ -14875,6 +14875,22 @@ const PageCanvas = forwardRef(
|
|
|
14875
14875
|
const startSy = Math.abs(Number(((_h = _cur == null ? void 0 : _cur.original) == null ? void 0 : _h.scaleY) ?? 1)) || 1;
|
|
14876
14876
|
const sAxis = isXSide ? Math.abs((obj.scaleX ?? 1) / startSx) : Math.abs((obj.scaleY ?? 1) / startSy);
|
|
14877
14877
|
if (sAxis > 1e-3) {
|
|
14878
|
+
const captureAsLiveWorldSnapshot = (childObj, liveW, liveH) => {
|
|
14879
|
+
try {
|
|
14880
|
+
const selectionMatrix = obj.calcTransformMatrix();
|
|
14881
|
+
const childMatrix = childObj.calcOwnMatrix();
|
|
14882
|
+
const worldMatrix = fabric.util.multiplyTransformMatrices(selectionMatrix, childMatrix);
|
|
14883
|
+
const live = fabric.util.qrDecompose(worldMatrix);
|
|
14884
|
+
const childOrigLocalAngle = Number.isFinite(childObj.__asLiveOrigAngle) ? childObj.__asLiveOrigAngle : childObj.angle ?? 0;
|
|
14885
|
+
childObj.__asLiveWorldAngle = (obj.angle ?? 0) + childOrigLocalAngle;
|
|
14886
|
+
childObj.__asLiveWorldCenterX = live.translateX;
|
|
14887
|
+
childObj.__asLiveWorldCenterY = live.translateY;
|
|
14888
|
+
childObj.__asLiveParentWorldAngle = obj.angle ?? 0;
|
|
14889
|
+
if (Number.isFinite(liveW)) childObj.__asLiveFinalW = liveW;
|
|
14890
|
+
if (Number.isFinite(liveH)) childObj.__asLiveFinalH = liveH;
|
|
14891
|
+
} catch {
|
|
14892
|
+
}
|
|
14893
|
+
};
|
|
14878
14894
|
if (isXSide && ((_i = groupShiftReflowSnapshotRef.current) == null ? void 0 : _i.selection) !== obj) {
|
|
14879
14895
|
groupShiftReflowSnapshotRef.current = null;
|
|
14880
14896
|
const logicalGroupId = obj.__pixldocsGroupSelection;
|
|
@@ -14915,13 +14931,45 @@ const PageCanvas = forwardRef(
|
|
|
14915
14931
|
if (child.__asLiveGestureKey !== liveGestureKey) {
|
|
14916
14932
|
child.__asLiveGestureKey = liveGestureKey;
|
|
14917
14933
|
child.__asLiveOrigAngle = Number.isFinite(child.angle) ? child.angle ?? 0 : 0;
|
|
14934
|
+
child.__asLiveOrigFlipX = !!child.flipX;
|
|
14935
|
+
child.__asLiveOrigFlipY = !!child.flipY;
|
|
14918
14936
|
}
|
|
14919
|
-
|
|
14920
|
-
|
|
14921
|
-
|
|
14922
|
-
|
|
14923
|
-
|
|
14924
|
-
|
|
14937
|
+
const liveAsSx = isXSide ? sAxis : 1;
|
|
14938
|
+
const liveAsSy = isXSide ? 1 : sAxis;
|
|
14939
|
+
if (child instanceof fabric.Group && (child.__cropGroup || ((_m = child._ct) == null ? void 0 : _m.isCropGroup)) || child instanceof fabric.FabricImage && !child.__cropGroup && !child.smartElementType) {
|
|
14940
|
+
const childAngleDeg2 = child.__asLiveOrigAngle ?? (child.angle ?? 0);
|
|
14941
|
+
const theta2 = fabric.util.degreesToRadians(childAngleDeg2);
|
|
14942
|
+
const cosT2 = Math.cos(theta2);
|
|
14943
|
+
const sinT2 = Math.sin(theta2);
|
|
14944
|
+
const dX = isXSide ? Math.max(1e-3, liveAsSx * cosT2 * cosT2 + sinT2 * sinT2) : 1;
|
|
14945
|
+
const dY = isXSide ? 1 : Math.max(1e-3, liveAsSy * cosT2 * cosT2 + sinT2 * sinT2);
|
|
14946
|
+
if (child.__asLiveOrigScaleX == null) child.__asLiveOrigScaleX = Math.abs(Number(child.scaleX ?? 1)) || 1;
|
|
14947
|
+
if (child.__asLiveOrigScaleY == null) child.__asLiveOrigScaleY = Math.abs(Number(child.scaleY ?? 1)) || 1;
|
|
14948
|
+
const origScaleX = child.__asLiveOrigScaleX;
|
|
14949
|
+
const origScaleY = child.__asLiveOrigScaleY;
|
|
14950
|
+
const baseW = Math.max(1, Number(((_n = child.__cropData) == null ? void 0 : _n.frameW) ?? child.width ?? 1));
|
|
14951
|
+
const baseH = Math.max(1, Number(((_o = child.__cropData) == null ? void 0 : _o.frameH) ?? child.height ?? 1));
|
|
14952
|
+
const liveW = baseW * origScaleX * dX;
|
|
14953
|
+
const liveH = baseH * origScaleY * dY;
|
|
14954
|
+
try {
|
|
14955
|
+
const inv = [1 / liveAsSx, 0, 0, 1 / liveAsSy, 0, 0];
|
|
14956
|
+
const Rtheta = fabric.util.composeMatrix({ angle: childAngleDeg2, scaleX: 1, scaleY: 1, translateX: 0, translateY: 0 });
|
|
14957
|
+
const Dscale = fabric.util.composeMatrix({ angle: 0, scaleX: origScaleX * dX, scaleY: origScaleY * dY, translateX: 0, translateY: 0 });
|
|
14958
|
+
const M = fabric.util.multiplyTransformMatrices(
|
|
14959
|
+
fabric.util.multiplyTransformMatrices(inv, Rtheta),
|
|
14960
|
+
Dscale
|
|
14961
|
+
);
|
|
14962
|
+
const dec = fabric.util.qrDecompose(M);
|
|
14963
|
+
child._set("angle", dec.angle);
|
|
14964
|
+
child._set("scaleX", dec.scaleX);
|
|
14965
|
+
child._set("scaleY", dec.scaleY);
|
|
14966
|
+
child._set("skewX", dec.skewX);
|
|
14967
|
+
child._set("skewY", dec.skewY);
|
|
14968
|
+
child._set("flipX", !!(child.__asLiveOrigFlipX ?? child.flipX));
|
|
14969
|
+
child._set("flipY", !!(child.__asLiveOrigFlipY ?? child.flipY));
|
|
14970
|
+
} catch {
|
|
14971
|
+
}
|
|
14972
|
+
captureAsLiveWorldSnapshot(child, liveW, liveH);
|
|
14925
14973
|
child.setCoords();
|
|
14926
14974
|
child.dirty = true;
|
|
14927
14975
|
continue;
|
|
@@ -14979,7 +15027,7 @@ const PageCanvas = forwardRef(
|
|
|
14979
15027
|
child.dirty = true;
|
|
14980
15028
|
didReflowTextChild = true;
|
|
14981
15029
|
}
|
|
14982
|
-
if (isXSide && ((
|
|
15030
|
+
if (isXSide && ((_p = groupShiftReflowSnapshotRef.current) == null ? void 0 : _p.selection) === obj) {
|
|
14983
15031
|
const snap = groupShiftReflowSnapshotRef.current;
|
|
14984
15032
|
const anchorEntry = snap.children[0];
|
|
14985
15033
|
const anchorTopLive = anchorEntry.obj.top ?? 0;
|
|
@@ -15141,7 +15189,7 @@ const PageCanvas = forwardRef(
|
|
|
15141
15189
|
setGuides(gridGuidesForScale.length ? [...scaleGuides, ...gridGuidesForScale] : scaleGuides);
|
|
15142
15190
|
if (drilledGroupIdRef.current) {
|
|
15143
15191
|
try {
|
|
15144
|
-
(
|
|
15192
|
+
(_q = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _q.call(fabricCanvas);
|
|
15145
15193
|
} catch {
|
|
15146
15194
|
}
|
|
15147
15195
|
}
|
|
@@ -15368,6 +15416,8 @@ const PageCanvas = forwardRef(
|
|
|
15368
15416
|
for (const child of t.getObjects()) {
|
|
15369
15417
|
delete child.__asLiveOrigW;
|
|
15370
15418
|
delete child.__asLiveOrigH;
|
|
15419
|
+
delete child.__asLiveOrigScaleX;
|
|
15420
|
+
delete child.__asLiveOrigScaleY;
|
|
15371
15421
|
delete child.__asLiveRotSnap;
|
|
15372
15422
|
delete child.__asLiveGestureKey;
|
|
15373
15423
|
}
|
|
@@ -16070,10 +16120,12 @@ const PageCanvas = forwardRef(
|
|
|
16070
16120
|
const ownSy = Math.abs(obj.scaleY ?? 1);
|
|
16071
16121
|
const bakedW = Math.max(1, intrinsicWidth * ownSx * (imgIsXSide ? sLocalI : 1));
|
|
16072
16122
|
const bakedH = Math.max(1, intrinsicHeight * ownSy * (imgIsXSide ? 1 : sLocalI));
|
|
16123
|
+
const cleanW = Math.max(1, Number(obj.__asLiveFinalW ?? bakedW));
|
|
16124
|
+
const cleanH = Math.max(1, Number(obj.__asLiveFinalH ?? bakedH));
|
|
16073
16125
|
try {
|
|
16074
16126
|
obj.set({
|
|
16075
|
-
width:
|
|
16076
|
-
height:
|
|
16127
|
+
width: cleanW,
|
|
16128
|
+
height: cleanH,
|
|
16077
16129
|
scaleX: 1,
|
|
16078
16130
|
scaleY: 1,
|
|
16079
16131
|
skewX: 0,
|
|
@@ -16092,8 +16144,8 @@ const PageCanvas = forwardRef(
|
|
|
16092
16144
|
obj.setCoords();
|
|
16093
16145
|
} catch {
|
|
16094
16146
|
}
|
|
16095
|
-
finalWidth =
|
|
16096
|
-
finalHeight =
|
|
16147
|
+
finalWidth = cleanW;
|
|
16148
|
+
finalHeight = cleanH;
|
|
16097
16149
|
finalScaleX = 1;
|
|
16098
16150
|
finalScaleY = 1;
|
|
16099
16151
|
const worldCx = Number.isFinite(obj.__asLiveWorldCenterX) ? obj.__asLiveWorldCenterX : decomposed.translateX ?? 0;
|
|
@@ -16515,6 +16567,12 @@ const PageCanvas = forwardRef(
|
|
|
16515
16567
|
objectBeforeStoreWrite: summarizeFabricObjectForResizeDebug(obj)
|
|
16516
16568
|
});
|
|
16517
16569
|
}
|
|
16570
|
+
if (isActiveSelection && (obj instanceof fabric.FabricImage || obj instanceof fabric.Group && obj.__cropGroup)) {
|
|
16571
|
+
const restore = activeSelectionFlipRestores.find((entry) => entry.obj === obj);
|
|
16572
|
+
if (restore) {
|
|
16573
|
+
restore.angle = Number.isFinite(elementUpdate.angle) ? elementUpdate.angle : persistedAngle;
|
|
16574
|
+
}
|
|
16575
|
+
}
|
|
16518
16576
|
if (isActiveSelection) {
|
|
16519
16577
|
logRotGroupImageDrift("store-update-child", {
|
|
16520
16578
|
time: Math.round(performance.now()),
|
|
@@ -16699,6 +16757,10 @@ const PageCanvas = forwardRef(
|
|
|
16699
16757
|
if (t instanceof fabric.ActiveSelection) {
|
|
16700
16758
|
for (const child of t.getObjects()) {
|
|
16701
16759
|
delete child.__asLiveOrigAngle;
|
|
16760
|
+
delete child.__asLiveOrigFlipX;
|
|
16761
|
+
delete child.__asLiveOrigFlipY;
|
|
16762
|
+
delete child.__asLiveOrigScaleX;
|
|
16763
|
+
delete child.__asLiveOrigScaleY;
|
|
16702
16764
|
delete child.__asLiveGestureKey;
|
|
16703
16765
|
delete child.__asLiveWorldAngle;
|
|
16704
16766
|
delete child.__asLiveWorldCenterX;
|
|
@@ -25809,9 +25871,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
25809
25871
|
}
|
|
25810
25872
|
return svgString;
|
|
25811
25873
|
}
|
|
25812
|
-
const resolvedPackageVersion = "0.5.
|
|
25874
|
+
const resolvedPackageVersion = "0.5.447";
|
|
25813
25875
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
25814
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
25876
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.447";
|
|
25815
25877
|
const roundParityValue = (value) => {
|
|
25816
25878
|
if (typeof value !== "number") return value;
|
|
25817
25879
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -26625,7 +26687,7 @@ class PixldocsRenderer {
|
|
|
26625
26687
|
await this.waitForCanvasScene(container, cloned, i);
|
|
26626
26688
|
}
|
|
26627
26689
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
26628
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
26690
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-BdCLPcgH.js");
|
|
26629
26691
|
const prepared = preparePagesForExport(
|
|
26630
26692
|
cloned.pages,
|
|
26631
26693
|
canvasWidth,
|
|
@@ -28945,7 +29007,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
28945
29007
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
28946
29008
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
28947
29009
|
try {
|
|
28948
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
29010
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-BdCLPcgH.js");
|
|
28949
29011
|
try {
|
|
28950
29012
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
28951
29013
|
} catch {
|
|
@@ -29345,4 +29407,4 @@ export {
|
|
|
29345
29407
|
buildTeaserBlurFlatKeys as y,
|
|
29346
29408
|
collectFontDescriptorsFromConfig as z
|
|
29347
29409
|
};
|
|
29348
|
-
//# sourceMappingURL=index-
|
|
29410
|
+
//# sourceMappingURL=index-g0HVhMPi.js.map
|