@pixldocs/canvas-renderer 0.5.444 → 0.5.446
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-DTJ_wDD-.cjs → index-BAQIJf_b.cjs} +23 -133
- package/dist/index-BAQIJf_b.cjs.map +1 -0
- package/dist/{index-BBkKxCQ_.js → index-BhfNlcH_.js} +23 -133
- package/dist/index-BhfNlcH_.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-Cy6iRFYd.cjs → vectorPdfExport-D7WHhcGD.cjs} +4 -4
- package/dist/{vectorPdfExport-Cy6iRFYd.cjs.map → vectorPdfExport-D7WHhcGD.cjs.map} +1 -1
- package/dist/{vectorPdfExport-D4YSdx4j.js → vectorPdfExport-DNSgRVdW.js} +4 -4
- package/dist/{vectorPdfExport-D4YSdx4j.js.map → vectorPdfExport-DNSgRVdW.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-BBkKxCQ_.js.map +0 -1
- package/dist/index-DTJ_wDD-.cjs.map +0 -1
|
@@ -11661,10 +11661,10 @@ const applyTransformPreservingFlip = (obj, matrix) => {
|
|
|
11661
11661
|
}
|
|
11662
11662
|
obj.set({ scaleX: sx, scaleY: sy, flipX, flipY });
|
|
11663
11663
|
};
|
|
11664
|
-
const restorePersistedFlipState = (obj, flipX, flipY) => {
|
|
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 });
|
|
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
|
}
|
|
@@ -14867,22 +14875,6 @@ const PageCanvas = forwardRef(
|
|
|
14867
14875
|
const startSy = Math.abs(Number(((_h = _cur == null ? void 0 : _cur.original) == null ? void 0 : _h.scaleY) ?? 1)) || 1;
|
|
14868
14876
|
const sAxis = isXSide ? Math.abs((obj.scaleX ?? 1) / startSx) : Math.abs((obj.scaleY ?? 1) / startSy);
|
|
14869
14877
|
if (sAxis > 1e-3) {
|
|
14870
|
-
const captureAsLiveWorldSnapshot = (childObj, liveW, liveH) => {
|
|
14871
|
-
try {
|
|
14872
|
-
const selectionMatrix = obj.calcTransformMatrix();
|
|
14873
|
-
const childMatrix = childObj.calcOwnMatrix();
|
|
14874
|
-
const worldMatrix = fabric.util.multiplyTransformMatrices(selectionMatrix, childMatrix);
|
|
14875
|
-
const live = fabric.util.qrDecompose(worldMatrix);
|
|
14876
|
-
const childOrigLocalAngle = Number.isFinite(childObj.__asLiveOrigAngle) ? childObj.__asLiveOrigAngle : childObj.angle ?? 0;
|
|
14877
|
-
childObj.__asLiveWorldAngle = (obj.angle ?? 0) + childOrigLocalAngle;
|
|
14878
|
-
childObj.__asLiveWorldCenterX = live.translateX;
|
|
14879
|
-
childObj.__asLiveWorldCenterY = live.translateY;
|
|
14880
|
-
childObj.__asLiveParentWorldAngle = obj.angle ?? 0;
|
|
14881
|
-
if (Number.isFinite(liveW)) childObj.__asLiveFinalW = liveW;
|
|
14882
|
-
if (Number.isFinite(liveH)) childObj.__asLiveFinalH = liveH;
|
|
14883
|
-
} catch {
|
|
14884
|
-
}
|
|
14885
|
-
};
|
|
14886
14878
|
if (isXSide && ((_i = groupShiftReflowSnapshotRef.current) == null ? void 0 : _i.selection) !== obj) {
|
|
14887
14879
|
groupShiftReflowSnapshotRef.current = null;
|
|
14888
14880
|
const logicalGroupId = obj.__pixldocsGroupSelection;
|
|
@@ -14925,118 +14917,12 @@ const PageCanvas = forwardRef(
|
|
|
14925
14917
|
child.__asLiveOrigAngle = Number.isFinite(child.angle) ? child.angle ?? 0 : 0;
|
|
14926
14918
|
}
|
|
14927
14919
|
if (child instanceof fabric.Group && (child.__cropGroup || ((_m = child._ct) == null ? void 0 : _m.isCropGroup))) {
|
|
14928
|
-
const ct = child.__cropData;
|
|
14929
|
-
if (!ct) continue;
|
|
14930
|
-
if (child.__asLiveOrigAngle == null) {
|
|
14931
|
-
child.__asLiveOrigAngle = child.angle ?? 0;
|
|
14932
|
-
}
|
|
14933
|
-
const childAngleDegC = child.__asLiveOrigAngle;
|
|
14934
|
-
const asSxC = isXSide ? sAxis : 1;
|
|
14935
|
-
const asSyC = isXSide ? 1 : sAxis;
|
|
14936
|
-
const thetaC = fabric.util.degreesToRadians(childAngleDegC);
|
|
14937
|
-
const cosTC = Math.cos(thetaC);
|
|
14938
|
-
const sinTC = Math.sin(thetaC);
|
|
14939
|
-
const sLocalC = isXSide ? asSxC * cosTC * cosTC + sinTC * sinTC : asSyC * cosTC * cosTC + sinTC * sinTC;
|
|
14940
|
-
if (isXSide) {
|
|
14941
|
-
if (child.__asLiveOrigW == null) {
|
|
14942
|
-
const baseW = child.width ?? ct.frameW ?? 0;
|
|
14943
|
-
child.__asLiveOrigW = baseW * (child.scaleX ?? 1);
|
|
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
|
-
}
|
|
14963
|
-
try {
|
|
14964
|
-
const invC = [1 / asSxC, 0, 0, 1 / asSyC, 0, 0];
|
|
14965
|
-
const RthetaC = fabric.util.composeMatrix({
|
|
14966
|
-
angle: childAngleDegC,
|
|
14967
|
-
scaleX: 1,
|
|
14968
|
-
scaleY: 1,
|
|
14969
|
-
translateX: 0,
|
|
14970
|
-
translateY: 0
|
|
14971
|
-
});
|
|
14972
|
-
const MC = fabric.util.multiplyTransformMatrices(invC, RthetaC);
|
|
14973
|
-
const decC = fabric.util.qrDecompose(MC);
|
|
14974
|
-
child._set("angle", decC.angle);
|
|
14975
|
-
child._set("scaleX", decC.scaleX);
|
|
14976
|
-
child._set("scaleY", decC.scaleY);
|
|
14977
|
-
child._set("skewX", decC.skewX);
|
|
14978
|
-
child._set("skewY", decC.skewY);
|
|
14979
|
-
} catch {
|
|
14980
|
-
}
|
|
14981
|
-
try {
|
|
14982
|
-
updateCoverLayout(child);
|
|
14983
|
-
} catch {
|
|
14984
|
-
}
|
|
14985
14920
|
child.setCoords();
|
|
14986
|
-
captureAsLiveWorldSnapshot(child, ct.frameW ?? child.width ?? 0, ct.frameH ?? child.height ?? 0);
|
|
14987
14921
|
child.dirty = true;
|
|
14988
14922
|
continue;
|
|
14989
14923
|
}
|
|
14990
14924
|
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);
|
|
15036
|
-
} catch {
|
|
15037
|
-
}
|
|
15038
14925
|
child.setCoords();
|
|
15039
|
-
captureAsLiveWorldSnapshot(child, child.width ?? 0, child.height ?? 0);
|
|
15040
14926
|
child.dirty = true;
|
|
15041
14927
|
continue;
|
|
15042
14928
|
}
|
|
@@ -16483,8 +16369,9 @@ const PageCanvas = forwardRef(
|
|
|
16483
16369
|
const objectFlipY = obj.flipY ?? false;
|
|
16484
16370
|
const persistedFlipX = (sourceElement == null ? void 0 : sourceElement.flipX) ?? objectFlipX;
|
|
16485
16371
|
const persistedFlipY = (sourceElement == null ? void 0 : sourceElement.flipY) ?? objectFlipY;
|
|
16372
|
+
const persistedAngle = sourceElement ? Number.isFinite(sourceElement.angle) ? sourceElement.angle ?? 0 : 0 : Number.isFinite(obj.angle) ? obj.angle ?? 0 : void 0;
|
|
16486
16373
|
const isActiveSelectionResizeGesture = activeSelectionResizeHandle === "ml" || activeSelectionResizeHandle === "mr" || activeSelectionResizeHandle === "mt" || activeSelectionResizeHandle === "mb" || activeSelectionResizeHandle === "tl" || activeSelectionResizeHandle === "tr" || activeSelectionResizeHandle === "bl" || activeSelectionResizeHandle === "br";
|
|
16487
|
-
const expectedCleanAngle = isActiveSelection && isActiveSelectionResizeGesture ? Number.isFinite(sourceElement
|
|
16374
|
+
const expectedCleanAngle = isActiveSelection && isActiveSelectionResizeGesture ? sourceElement ? Number.isFinite(sourceElement.angle) ? sourceElement.angle ?? 0 : 0 : Number.isFinite(obj.angle) ? obj.angle ?? 0 : void 0 : void 0;
|
|
16488
16375
|
const normalizedFinalAbsoluteMatrix = normalizeMatrixForPersistedFlip(
|
|
16489
16376
|
toggleLogicalFlipInMatrix(
|
|
16490
16377
|
finalAbsoluteMatrix,
|
|
@@ -16498,7 +16385,7 @@ const PageCanvas = forwardRef(
|
|
|
16498
16385
|
const cleanTransformMatrix = toggleLogicalFlipInMatrix(normalizedFinalAbsoluteMatrix, persistedFlipX, persistedFlipY);
|
|
16499
16386
|
const persistedDecomposed = fabric.util.qrDecompose(cleanTransformMatrix);
|
|
16500
16387
|
if (isActiveSelection && (obj instanceof fabric.FabricImage || obj instanceof fabric.Group && obj.__cropGroup)) {
|
|
16501
|
-
activeSelectionFlipRestores.push({ obj, flipX: persistedFlipX, flipY: persistedFlipY });
|
|
16388
|
+
activeSelectionFlipRestores.push({ obj, flipX: persistedFlipX, flipY: persistedFlipY, angle: persistedAngle });
|
|
16502
16389
|
}
|
|
16503
16390
|
const elementUpdate = {
|
|
16504
16391
|
left: storePos.left,
|
|
@@ -16724,14 +16611,14 @@ const PageCanvas = forwardRef(
|
|
|
16724
16611
|
skipActiveSelectionBakeOnClearRef.current = true;
|
|
16725
16612
|
try {
|
|
16726
16613
|
for (const restore of activeSelectionFlipRestores) {
|
|
16727
|
-
restorePersistedFlipState(restore.obj, restore.flipX, restore.flipY);
|
|
16614
|
+
restorePersistedFlipState(restore.obj, restore.flipX, restore.flipY, restore.angle);
|
|
16728
16615
|
}
|
|
16729
16616
|
fabricCanvas.discardActiveObject();
|
|
16730
16617
|
} finally {
|
|
16731
16618
|
skipActiveSelectionBakeOnClearRef.current = false;
|
|
16732
16619
|
}
|
|
16733
16620
|
for (const restore of activeSelectionFlipRestores) {
|
|
16734
|
-
restorePersistedFlipState(restore.obj, restore.flipX, restore.flipY);
|
|
16621
|
+
restorePersistedFlipState(restore.obj, restore.flipX, restore.flipY, restore.angle);
|
|
16735
16622
|
}
|
|
16736
16623
|
for (const bake of pendingCropGroupFrameBakes) {
|
|
16737
16624
|
const ct = bake.obj.__cropData;
|
|
@@ -16752,6 +16639,9 @@ const PageCanvas = forwardRef(
|
|
|
16752
16639
|
updateCoverLayout(bake.obj);
|
|
16753
16640
|
bake.obj.setCoords();
|
|
16754
16641
|
}
|
|
16642
|
+
for (const restore of activeSelectionFlipRestores) {
|
|
16643
|
+
restorePersistedFlipState(restore.obj, restore.flipX, restore.flipY, restore.angle);
|
|
16644
|
+
}
|
|
16755
16645
|
if (membersToReselect.length > 1) {
|
|
16756
16646
|
const newSel = new fabric.ActiveSelection(membersToReselect, { canvas: fabricCanvas });
|
|
16757
16647
|
if (wasGroupSel) restoreGroupSelectionVisualState(newSel, wasGroupSel);
|
|
@@ -25919,9 +25809,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
25919
25809
|
}
|
|
25920
25810
|
return svgString;
|
|
25921
25811
|
}
|
|
25922
|
-
const resolvedPackageVersion = "0.5.
|
|
25812
|
+
const resolvedPackageVersion = "0.5.446";
|
|
25923
25813
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
25924
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
25814
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.446";
|
|
25925
25815
|
const roundParityValue = (value) => {
|
|
25926
25816
|
if (typeof value !== "number") return value;
|
|
25927
25817
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -26735,7 +26625,7 @@ class PixldocsRenderer {
|
|
|
26735
26625
|
await this.waitForCanvasScene(container, cloned, i);
|
|
26736
26626
|
}
|
|
26737
26627
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
26738
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
26628
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DNSgRVdW.js");
|
|
26739
26629
|
const prepared = preparePagesForExport(
|
|
26740
26630
|
cloned.pages,
|
|
26741
26631
|
canvasWidth,
|
|
@@ -29055,7 +28945,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
29055
28945
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
29056
28946
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
29057
28947
|
try {
|
|
29058
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
28948
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DNSgRVdW.js");
|
|
29059
28949
|
try {
|
|
29060
28950
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
29061
28951
|
} catch {
|
|
@@ -29455,4 +29345,4 @@ export {
|
|
|
29455
29345
|
buildTeaserBlurFlatKeys as y,
|
|
29456
29346
|
collectFontDescriptorsFromConfig as z
|
|
29457
29347
|
};
|
|
29458
|
-
//# sourceMappingURL=index-
|
|
29348
|
+
//# sourceMappingURL=index-BhfNlcH_.js.map
|