@pixldocs/canvas-renderer 0.5.445 → 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-BtExVWAT.cjs → index-D7JnQkpf.cjs} +70 -122
- package/dist/index-D7JnQkpf.cjs.map +1 -0
- package/dist/{index-DX5LKnWg.js → index-g0HVhMPi.js} +70 -122
- package/dist/index-g0HVhMPi.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-CuC9pjN_.cjs → vectorPdfExport-BVQkDFXD.cjs} +4 -4
- package/dist/{vectorPdfExport-CuC9pjN_.cjs.map → vectorPdfExport-BVQkDFXD.cjs.map} +1 -1
- package/dist/{vectorPdfExport-B5RZe-Kw.js → vectorPdfExport-BdCLPcgH.js} +4 -4
- package/dist/{vectorPdfExport-B5RZe-Kw.js.map → vectorPdfExport-BdCLPcgH.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-BtExVWAT.cjs.map +0 -1
- package/dist/index-DX5LKnWg.js.map +0 -1
|
@@ -11664,7 +11664,7 @@ const applyTransformPreservingFlip = (obj, matrix) => {
|
|
|
11664
11664
|
const restorePersistedFlipState = (obj, flipX, flipY, angle) => {
|
|
11665
11665
|
const sx = Math.abs(Number(obj.scaleX ?? 1)) || 1;
|
|
11666
11666
|
const sy = Math.abs(Number(obj.scaleY ?? 1)) || 1;
|
|
11667
|
-
obj.set({ scaleX: sx, scaleY: sy, flipX, flipY, ...Number.isFinite(angle) ? { angle } : {} });
|
|
11667
|
+
obj.set({ scaleX: sx, scaleY: sy, skewX: 0, skewY: 0, flipX, flipY, ...Number.isFinite(angle) ? { angle } : {} });
|
|
11668
11668
|
obj.setCoords();
|
|
11669
11669
|
obj.dirty = true;
|
|
11670
11670
|
};
|
|
@@ -11775,11 +11775,16 @@ function applyWarpAwareSelectionBorders(selection) {
|
|
|
11775
11775
|
selection.calcTransformMatrix()
|
|
11776
11776
|
);
|
|
11777
11777
|
kids.forEach((k, index) => {
|
|
11778
|
+
var _a3;
|
|
11778
11779
|
const beforeRestore = summarizeRotDriftObject(k);
|
|
11779
11780
|
const localMatrix = fabric.util.multiplyTransformMatrices(
|
|
11780
11781
|
invSelection,
|
|
11781
11782
|
worldMatrices[index]
|
|
11782
11783
|
);
|
|
11784
|
+
const isImageLikeKid = k instanceof fabric.FabricImage || k instanceof fabric.Group && (k.__cropGroup || ((_a3 = k._ct) == null ? void 0 : _a3.isCropGroup));
|
|
11785
|
+
const persistedKidFlipX = !!k.flipX;
|
|
11786
|
+
const persistedKidFlipY = !!k.flipY;
|
|
11787
|
+
const expectedCleanKidAngle = isImageLikeKid && (persistedKidFlipX || persistedKidFlipY) ? fabric.util.qrDecompose(toggleLogicalFlipInMatrix(localMatrix, persistedKidFlipX, persistedKidFlipY)).angle ?? 0 : void 0;
|
|
11783
11788
|
const savedLayout = k.layoutManager;
|
|
11784
11789
|
try {
|
|
11785
11790
|
if (savedLayout) k.layoutManager = void 0;
|
|
@@ -11789,6 +11794,9 @@ function applyWarpAwareSelectionBorders(selection) {
|
|
|
11789
11794
|
);
|
|
11790
11795
|
const expectedCenter = new fabric.Point(decomposed.translateX, decomposed.translateY);
|
|
11791
11796
|
k.setPositionByOrigin(expectedCenter, "center", "center");
|
|
11797
|
+
if (isImageLikeKid && (persistedKidFlipX || persistedKidFlipY)) {
|
|
11798
|
+
restorePersistedFlipState(k, persistedKidFlipX, persistedKidFlipY, expectedCleanKidAngle);
|
|
11799
|
+
}
|
|
11792
11800
|
} finally {
|
|
11793
11801
|
if (savedLayout) k.layoutManager = savedLayout;
|
|
11794
11802
|
}
|
|
@@ -14629,7 +14637,7 @@ const PageCanvas = forwardRef(
|
|
|
14629
14637
|
fabricCanvas.on("selection:cleared", () => {
|
|
14630
14638
|
});
|
|
14631
14639
|
fabricCanvas.on("object:scaling", (e) => {
|
|
14632
|
-
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;
|
|
14633
14641
|
if (!isActiveRef.current) return;
|
|
14634
14642
|
const t = e.target;
|
|
14635
14643
|
if (t) lastResizeScaleTargetRef.current = t;
|
|
@@ -14923,120 +14931,46 @@ const PageCanvas = forwardRef(
|
|
|
14923
14931
|
if (child.__asLiveGestureKey !== liveGestureKey) {
|
|
14924
14932
|
child.__asLiveGestureKey = liveGestureKey;
|
|
14925
14933
|
child.__asLiveOrigAngle = Number.isFinite(child.angle) ? child.angle ?? 0 : 0;
|
|
14934
|
+
child.__asLiveOrigFlipX = !!child.flipX;
|
|
14935
|
+
child.__asLiveOrigFlipY = !!child.flipY;
|
|
14926
14936
|
}
|
|
14927
|
-
|
|
14928
|
-
|
|
14929
|
-
|
|
14930
|
-
|
|
14931
|
-
|
|
14932
|
-
|
|
14933
|
-
const
|
|
14934
|
-
const
|
|
14935
|
-
const
|
|
14936
|
-
|
|
14937
|
-
|
|
14938
|
-
const
|
|
14939
|
-
const
|
|
14940
|
-
|
|
14941
|
-
|
|
14942
|
-
|
|
14943
|
-
|
|
14944
|
-
}
|
|
14945
|
-
const origW = child.__asLiveOrigW;
|
|
14946
|
-
const newW = Math.max(20, origW * sLocalC);
|
|
14947
|
-
if (Math.abs((child.width ?? 0) - newW) > 0.5) {
|
|
14948
|
-
ct.frameW = newW;
|
|
14949
|
-
child._set("width", newW);
|
|
14950
|
-
}
|
|
14951
|
-
} else {
|
|
14952
|
-
if (child.__asLiveOrigH == null) {
|
|
14953
|
-
const baseH = child.height ?? ct.frameH ?? 0;
|
|
14954
|
-
child.__asLiveOrigH = baseH * (child.scaleY ?? 1);
|
|
14955
|
-
}
|
|
14956
|
-
const origH = child.__asLiveOrigH;
|
|
14957
|
-
const newH = Math.max(20, origH * sLocalC);
|
|
14958
|
-
if (Math.abs((child.height ?? 0) - newH) > 0.5) {
|
|
14959
|
-
ct.frameH = newH;
|
|
14960
|
-
child._set("height", newH);
|
|
14961
|
-
}
|
|
14962
|
-
}
|
|
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;
|
|
14963
14954
|
try {
|
|
14964
|
-
const
|
|
14965
|
-
const
|
|
14966
|
-
|
|
14967
|
-
|
|
14968
|
-
|
|
14969
|
-
|
|
14970
|
-
|
|
14971
|
-
|
|
14972
|
-
|
|
14973
|
-
|
|
14974
|
-
child._set("
|
|
14975
|
-
child._set("
|
|
14976
|
-
child._set("
|
|
14977
|
-
child._set("
|
|
14978
|
-
child._set("
|
|
14979
|
-
} catch {
|
|
14980
|
-
}
|
|
14981
|
-
try {
|
|
14982
|
-
updateCoverLayout(child);
|
|
14983
|
-
} catch {
|
|
14984
|
-
}
|
|
14985
|
-
child.setCoords();
|
|
14986
|
-
captureAsLiveWorldSnapshot(child, ct.frameW ?? child.width ?? 0, ct.frameH ?? child.height ?? 0);
|
|
14987
|
-
child.dirty = true;
|
|
14988
|
-
continue;
|
|
14989
|
-
}
|
|
14990
|
-
if (child instanceof fabric.FabricImage && !child.__cropGroup && !child.smartElementType) {
|
|
14991
|
-
if (child.__asLiveOrigAngle == null) {
|
|
14992
|
-
child.__asLiveOrigAngle = child.angle ?? 0;
|
|
14993
|
-
}
|
|
14994
|
-
const childAngleDegI = child.__asLiveOrigAngle;
|
|
14995
|
-
const asSxI = isXSide ? sAxis : 1;
|
|
14996
|
-
const asSyI = isXSide ? 1 : sAxis;
|
|
14997
|
-
const thetaI = fabric.util.degreesToRadians(childAngleDegI);
|
|
14998
|
-
const cosTI = Math.cos(thetaI);
|
|
14999
|
-
const sinTI = Math.sin(thetaI);
|
|
15000
|
-
const sLocalI = isXSide ? asSxI * cosTI * cosTI + sinTI * sinTI : asSyI * cosTI * cosTI + sinTI * sinTI;
|
|
15001
|
-
if (isXSide) {
|
|
15002
|
-
if (child.__asLiveOrigW == null) {
|
|
15003
|
-
child.__asLiveOrigW = (child.width ?? 0) * (child.scaleX ?? 1);
|
|
15004
|
-
}
|
|
15005
|
-
const origW = child.__asLiveOrigW;
|
|
15006
|
-
const newW = Math.max(1, origW * sLocalI);
|
|
15007
|
-
if (Math.abs((child.width ?? 0) - newW) > 0.5) {
|
|
15008
|
-
child._set("width", newW);
|
|
15009
|
-
}
|
|
15010
|
-
} else {
|
|
15011
|
-
if (child.__asLiveOrigH == null) {
|
|
15012
|
-
child.__asLiveOrigH = (child.height ?? 0) * (child.scaleY ?? 1);
|
|
15013
|
-
}
|
|
15014
|
-
const origH = child.__asLiveOrigH;
|
|
15015
|
-
const newH = Math.max(1, origH * sLocalI);
|
|
15016
|
-
if (Math.abs((child.height ?? 0) - newH) > 0.5) {
|
|
15017
|
-
child._set("height", newH);
|
|
15018
|
-
}
|
|
15019
|
-
}
|
|
15020
|
-
try {
|
|
15021
|
-
const invI = [1 / asSxI, 0, 0, 1 / asSyI, 0, 0];
|
|
15022
|
-
const RthetaI = fabric.util.composeMatrix({
|
|
15023
|
-
angle: childAngleDegI,
|
|
15024
|
-
scaleX: 1,
|
|
15025
|
-
scaleY: 1,
|
|
15026
|
-
translateX: 0,
|
|
15027
|
-
translateY: 0
|
|
15028
|
-
});
|
|
15029
|
-
const MI = fabric.util.multiplyTransformMatrices(invI, RthetaI);
|
|
15030
|
-
const decI = fabric.util.qrDecompose(MI);
|
|
15031
|
-
child._set("angle", decI.angle);
|
|
15032
|
-
child._set("scaleX", decI.scaleX);
|
|
15033
|
-
child._set("scaleY", decI.scaleY);
|
|
15034
|
-
child._set("skewX", decI.skewX);
|
|
15035
|
-
child._set("skewY", decI.skewY);
|
|
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));
|
|
15036
14970
|
} catch {
|
|
15037
14971
|
}
|
|
14972
|
+
captureAsLiveWorldSnapshot(child, liveW, liveH);
|
|
15038
14973
|
child.setCoords();
|
|
15039
|
-
captureAsLiveWorldSnapshot(child, child.width ?? 0, child.height ?? 0);
|
|
15040
14974
|
child.dirty = true;
|
|
15041
14975
|
continue;
|
|
15042
14976
|
}
|
|
@@ -15093,7 +15027,7 @@ const PageCanvas = forwardRef(
|
|
|
15093
15027
|
child.dirty = true;
|
|
15094
15028
|
didReflowTextChild = true;
|
|
15095
15029
|
}
|
|
15096
|
-
if (isXSide && ((
|
|
15030
|
+
if (isXSide && ((_p = groupShiftReflowSnapshotRef.current) == null ? void 0 : _p.selection) === obj) {
|
|
15097
15031
|
const snap = groupShiftReflowSnapshotRef.current;
|
|
15098
15032
|
const anchorEntry = snap.children[0];
|
|
15099
15033
|
const anchorTopLive = anchorEntry.obj.top ?? 0;
|
|
@@ -15255,7 +15189,7 @@ const PageCanvas = forwardRef(
|
|
|
15255
15189
|
setGuides(gridGuidesForScale.length ? [...scaleGuides, ...gridGuidesForScale] : scaleGuides);
|
|
15256
15190
|
if (drilledGroupIdRef.current) {
|
|
15257
15191
|
try {
|
|
15258
|
-
(
|
|
15192
|
+
(_q = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _q.call(fabricCanvas);
|
|
15259
15193
|
} catch {
|
|
15260
15194
|
}
|
|
15261
15195
|
}
|
|
@@ -15482,6 +15416,8 @@ const PageCanvas = forwardRef(
|
|
|
15482
15416
|
for (const child of t.getObjects()) {
|
|
15483
15417
|
delete child.__asLiveOrigW;
|
|
15484
15418
|
delete child.__asLiveOrigH;
|
|
15419
|
+
delete child.__asLiveOrigScaleX;
|
|
15420
|
+
delete child.__asLiveOrigScaleY;
|
|
15485
15421
|
delete child.__asLiveRotSnap;
|
|
15486
15422
|
delete child.__asLiveGestureKey;
|
|
15487
15423
|
}
|
|
@@ -16184,10 +16120,12 @@ const PageCanvas = forwardRef(
|
|
|
16184
16120
|
const ownSy = Math.abs(obj.scaleY ?? 1);
|
|
16185
16121
|
const bakedW = Math.max(1, intrinsicWidth * ownSx * (imgIsXSide ? sLocalI : 1));
|
|
16186
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));
|
|
16187
16125
|
try {
|
|
16188
16126
|
obj.set({
|
|
16189
|
-
width:
|
|
16190
|
-
height:
|
|
16127
|
+
width: cleanW,
|
|
16128
|
+
height: cleanH,
|
|
16191
16129
|
scaleX: 1,
|
|
16192
16130
|
scaleY: 1,
|
|
16193
16131
|
skewX: 0,
|
|
@@ -16206,8 +16144,8 @@ const PageCanvas = forwardRef(
|
|
|
16206
16144
|
obj.setCoords();
|
|
16207
16145
|
} catch {
|
|
16208
16146
|
}
|
|
16209
|
-
finalWidth =
|
|
16210
|
-
finalHeight =
|
|
16147
|
+
finalWidth = cleanW;
|
|
16148
|
+
finalHeight = cleanH;
|
|
16211
16149
|
finalScaleX = 1;
|
|
16212
16150
|
finalScaleY = 1;
|
|
16213
16151
|
const worldCx = Number.isFinite(obj.__asLiveWorldCenterX) ? obj.__asLiveWorldCenterX : decomposed.translateX ?? 0;
|
|
@@ -16629,6 +16567,12 @@ const PageCanvas = forwardRef(
|
|
|
16629
16567
|
objectBeforeStoreWrite: summarizeFabricObjectForResizeDebug(obj)
|
|
16630
16568
|
});
|
|
16631
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
|
+
}
|
|
16632
16576
|
if (isActiveSelection) {
|
|
16633
16577
|
logRotGroupImageDrift("store-update-child", {
|
|
16634
16578
|
time: Math.round(performance.now()),
|
|
@@ -16813,6 +16757,10 @@ const PageCanvas = forwardRef(
|
|
|
16813
16757
|
if (t instanceof fabric.ActiveSelection) {
|
|
16814
16758
|
for (const child of t.getObjects()) {
|
|
16815
16759
|
delete child.__asLiveOrigAngle;
|
|
16760
|
+
delete child.__asLiveOrigFlipX;
|
|
16761
|
+
delete child.__asLiveOrigFlipY;
|
|
16762
|
+
delete child.__asLiveOrigScaleX;
|
|
16763
|
+
delete child.__asLiveOrigScaleY;
|
|
16816
16764
|
delete child.__asLiveGestureKey;
|
|
16817
16765
|
delete child.__asLiveWorldAngle;
|
|
16818
16766
|
delete child.__asLiveWorldCenterX;
|
|
@@ -25923,9 +25871,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
25923
25871
|
}
|
|
25924
25872
|
return svgString;
|
|
25925
25873
|
}
|
|
25926
|
-
const resolvedPackageVersion = "0.5.
|
|
25874
|
+
const resolvedPackageVersion = "0.5.447";
|
|
25927
25875
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
25928
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
25876
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.447";
|
|
25929
25877
|
const roundParityValue = (value) => {
|
|
25930
25878
|
if (typeof value !== "number") return value;
|
|
25931
25879
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -26739,7 +26687,7 @@ class PixldocsRenderer {
|
|
|
26739
26687
|
await this.waitForCanvasScene(container, cloned, i);
|
|
26740
26688
|
}
|
|
26741
26689
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
26742
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
26690
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-BdCLPcgH.js");
|
|
26743
26691
|
const prepared = preparePagesForExport(
|
|
26744
26692
|
cloned.pages,
|
|
26745
26693
|
canvasWidth,
|
|
@@ -29059,7 +29007,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
29059
29007
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
29060
29008
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
29061
29009
|
try {
|
|
29062
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
29010
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-BdCLPcgH.js");
|
|
29063
29011
|
try {
|
|
29064
29012
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
29065
29013
|
} catch {
|
|
@@ -29459,4 +29407,4 @@ export {
|
|
|
29459
29407
|
buildTeaserBlurFlatKeys as y,
|
|
29460
29408
|
collectFontDescriptorsFromConfig as z
|
|
29461
29409
|
};
|
|
29462
|
-
//# sourceMappingURL=index-
|
|
29410
|
+
//# sourceMappingURL=index-g0HVhMPi.js.map
|