@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
|
@@ -11679,10 +11679,10 @@ const applyTransformPreservingFlip = (obj, matrix) => {
|
|
|
11679
11679
|
}
|
|
11680
11680
|
obj.set({ scaleX: sx, scaleY: sy, flipX, flipY });
|
|
11681
11681
|
};
|
|
11682
|
-
const restorePersistedFlipState = (obj, flipX, flipY) => {
|
|
11682
|
+
const restorePersistedFlipState = (obj, flipX, flipY, angle) => {
|
|
11683
11683
|
const sx = Math.abs(Number(obj.scaleX ?? 1)) || 1;
|
|
11684
11684
|
const sy = Math.abs(Number(obj.scaleY ?? 1)) || 1;
|
|
11685
|
-
obj.set({ scaleX: sx, scaleY: sy, flipX, flipY });
|
|
11685
|
+
obj.set({ scaleX: sx, scaleY: sy, skewX: 0, skewY: 0, flipX, flipY, ...Number.isFinite(angle) ? { angle } : {} });
|
|
11686
11686
|
obj.setCoords();
|
|
11687
11687
|
obj.dirty = true;
|
|
11688
11688
|
};
|
|
@@ -11793,11 +11793,16 @@ function applyWarpAwareSelectionBorders(selection) {
|
|
|
11793
11793
|
selection.calcTransformMatrix()
|
|
11794
11794
|
);
|
|
11795
11795
|
kids.forEach((k, index) => {
|
|
11796
|
+
var _a3;
|
|
11796
11797
|
const beforeRestore = summarizeRotDriftObject(k);
|
|
11797
11798
|
const localMatrix = fabric__namespace.util.multiplyTransformMatrices(
|
|
11798
11799
|
invSelection,
|
|
11799
11800
|
worldMatrices[index]
|
|
11800
11801
|
);
|
|
11802
|
+
const isImageLikeKid = k instanceof fabric__namespace.FabricImage || k instanceof fabric__namespace.Group && (k.__cropGroup || ((_a3 = k._ct) == null ? void 0 : _a3.isCropGroup));
|
|
11803
|
+
const persistedKidFlipX = !!k.flipX;
|
|
11804
|
+
const persistedKidFlipY = !!k.flipY;
|
|
11805
|
+
const expectedCleanKidAngle = isImageLikeKid && (persistedKidFlipX || persistedKidFlipY) ? fabric__namespace.util.qrDecompose(toggleLogicalFlipInMatrix(localMatrix, persistedKidFlipX, persistedKidFlipY)).angle ?? 0 : void 0;
|
|
11801
11806
|
const savedLayout = k.layoutManager;
|
|
11802
11807
|
try {
|
|
11803
11808
|
if (savedLayout) k.layoutManager = void 0;
|
|
@@ -11807,6 +11812,9 @@ function applyWarpAwareSelectionBorders(selection) {
|
|
|
11807
11812
|
);
|
|
11808
11813
|
const expectedCenter = new fabric__namespace.Point(decomposed.translateX, decomposed.translateY);
|
|
11809
11814
|
k.setPositionByOrigin(expectedCenter, "center", "center");
|
|
11815
|
+
if (isImageLikeKid && (persistedKidFlipX || persistedKidFlipY)) {
|
|
11816
|
+
restorePersistedFlipState(k, persistedKidFlipX, persistedKidFlipY, expectedCleanKidAngle);
|
|
11817
|
+
}
|
|
11810
11818
|
} finally {
|
|
11811
11819
|
if (savedLayout) k.layoutManager = savedLayout;
|
|
11812
11820
|
}
|
|
@@ -14885,22 +14893,6 @@ const PageCanvas = react.forwardRef(
|
|
|
14885
14893
|
const startSy = Math.abs(Number(((_h = _cur == null ? void 0 : _cur.original) == null ? void 0 : _h.scaleY) ?? 1)) || 1;
|
|
14886
14894
|
const sAxis = isXSide ? Math.abs((obj.scaleX ?? 1) / startSx) : Math.abs((obj.scaleY ?? 1) / startSy);
|
|
14887
14895
|
if (sAxis > 1e-3) {
|
|
14888
|
-
const captureAsLiveWorldSnapshot = (childObj, liveW, liveH) => {
|
|
14889
|
-
try {
|
|
14890
|
-
const selectionMatrix = obj.calcTransformMatrix();
|
|
14891
|
-
const childMatrix = childObj.calcOwnMatrix();
|
|
14892
|
-
const worldMatrix = fabric__namespace.util.multiplyTransformMatrices(selectionMatrix, childMatrix);
|
|
14893
|
-
const live = fabric__namespace.util.qrDecompose(worldMatrix);
|
|
14894
|
-
const childOrigLocalAngle = Number.isFinite(childObj.__asLiveOrigAngle) ? childObj.__asLiveOrigAngle : childObj.angle ?? 0;
|
|
14895
|
-
childObj.__asLiveWorldAngle = (obj.angle ?? 0) + childOrigLocalAngle;
|
|
14896
|
-
childObj.__asLiveWorldCenterX = live.translateX;
|
|
14897
|
-
childObj.__asLiveWorldCenterY = live.translateY;
|
|
14898
|
-
childObj.__asLiveParentWorldAngle = obj.angle ?? 0;
|
|
14899
|
-
if (Number.isFinite(liveW)) childObj.__asLiveFinalW = liveW;
|
|
14900
|
-
if (Number.isFinite(liveH)) childObj.__asLiveFinalH = liveH;
|
|
14901
|
-
} catch {
|
|
14902
|
-
}
|
|
14903
|
-
};
|
|
14904
14896
|
if (isXSide && ((_i = groupShiftReflowSnapshotRef.current) == null ? void 0 : _i.selection) !== obj) {
|
|
14905
14897
|
groupShiftReflowSnapshotRef.current = null;
|
|
14906
14898
|
const logicalGroupId = obj.__pixldocsGroupSelection;
|
|
@@ -14943,118 +14935,12 @@ const PageCanvas = react.forwardRef(
|
|
|
14943
14935
|
child.__asLiveOrigAngle = Number.isFinite(child.angle) ? child.angle ?? 0 : 0;
|
|
14944
14936
|
}
|
|
14945
14937
|
if (child instanceof fabric__namespace.Group && (child.__cropGroup || ((_m = child._ct) == null ? void 0 : _m.isCropGroup))) {
|
|
14946
|
-
const ct = child.__cropData;
|
|
14947
|
-
if (!ct) continue;
|
|
14948
|
-
if (child.__asLiveOrigAngle == null) {
|
|
14949
|
-
child.__asLiveOrigAngle = child.angle ?? 0;
|
|
14950
|
-
}
|
|
14951
|
-
const childAngleDegC = child.__asLiveOrigAngle;
|
|
14952
|
-
const asSxC = isXSide ? sAxis : 1;
|
|
14953
|
-
const asSyC = isXSide ? 1 : sAxis;
|
|
14954
|
-
const thetaC = fabric__namespace.util.degreesToRadians(childAngleDegC);
|
|
14955
|
-
const cosTC = Math.cos(thetaC);
|
|
14956
|
-
const sinTC = Math.sin(thetaC);
|
|
14957
|
-
const sLocalC = isXSide ? asSxC * cosTC * cosTC + sinTC * sinTC : asSyC * cosTC * cosTC + sinTC * sinTC;
|
|
14958
|
-
if (isXSide) {
|
|
14959
|
-
if (child.__asLiveOrigW == null) {
|
|
14960
|
-
const baseW = child.width ?? ct.frameW ?? 0;
|
|
14961
|
-
child.__asLiveOrigW = baseW * (child.scaleX ?? 1);
|
|
14962
|
-
}
|
|
14963
|
-
const origW = child.__asLiveOrigW;
|
|
14964
|
-
const newW = Math.max(20, origW * sLocalC);
|
|
14965
|
-
if (Math.abs((child.width ?? 0) - newW) > 0.5) {
|
|
14966
|
-
ct.frameW = newW;
|
|
14967
|
-
child._set("width", newW);
|
|
14968
|
-
}
|
|
14969
|
-
} else {
|
|
14970
|
-
if (child.__asLiveOrigH == null) {
|
|
14971
|
-
const baseH = child.height ?? ct.frameH ?? 0;
|
|
14972
|
-
child.__asLiveOrigH = baseH * (child.scaleY ?? 1);
|
|
14973
|
-
}
|
|
14974
|
-
const origH = child.__asLiveOrigH;
|
|
14975
|
-
const newH = Math.max(20, origH * sLocalC);
|
|
14976
|
-
if (Math.abs((child.height ?? 0) - newH) > 0.5) {
|
|
14977
|
-
ct.frameH = newH;
|
|
14978
|
-
child._set("height", newH);
|
|
14979
|
-
}
|
|
14980
|
-
}
|
|
14981
|
-
try {
|
|
14982
|
-
const invC = [1 / asSxC, 0, 0, 1 / asSyC, 0, 0];
|
|
14983
|
-
const RthetaC = fabric__namespace.util.composeMatrix({
|
|
14984
|
-
angle: childAngleDegC,
|
|
14985
|
-
scaleX: 1,
|
|
14986
|
-
scaleY: 1,
|
|
14987
|
-
translateX: 0,
|
|
14988
|
-
translateY: 0
|
|
14989
|
-
});
|
|
14990
|
-
const MC = fabric__namespace.util.multiplyTransformMatrices(invC, RthetaC);
|
|
14991
|
-
const decC = fabric__namespace.util.qrDecompose(MC);
|
|
14992
|
-
child._set("angle", decC.angle);
|
|
14993
|
-
child._set("scaleX", decC.scaleX);
|
|
14994
|
-
child._set("scaleY", decC.scaleY);
|
|
14995
|
-
child._set("skewX", decC.skewX);
|
|
14996
|
-
child._set("skewY", decC.skewY);
|
|
14997
|
-
} catch {
|
|
14998
|
-
}
|
|
14999
|
-
try {
|
|
15000
|
-
updateCoverLayout(child);
|
|
15001
|
-
} catch {
|
|
15002
|
-
}
|
|
15003
14938
|
child.setCoords();
|
|
15004
|
-
captureAsLiveWorldSnapshot(child, ct.frameW ?? child.width ?? 0, ct.frameH ?? child.height ?? 0);
|
|
15005
14939
|
child.dirty = true;
|
|
15006
14940
|
continue;
|
|
15007
14941
|
}
|
|
15008
14942
|
if (child instanceof fabric__namespace.FabricImage && !child.__cropGroup && !child.smartElementType) {
|
|
15009
|
-
if (child.__asLiveOrigAngle == null) {
|
|
15010
|
-
child.__asLiveOrigAngle = child.angle ?? 0;
|
|
15011
|
-
}
|
|
15012
|
-
const childAngleDegI = child.__asLiveOrigAngle;
|
|
15013
|
-
const asSxI = isXSide ? sAxis : 1;
|
|
15014
|
-
const asSyI = isXSide ? 1 : sAxis;
|
|
15015
|
-
const thetaI = fabric__namespace.util.degreesToRadians(childAngleDegI);
|
|
15016
|
-
const cosTI = Math.cos(thetaI);
|
|
15017
|
-
const sinTI = Math.sin(thetaI);
|
|
15018
|
-
const sLocalI = isXSide ? asSxI * cosTI * cosTI + sinTI * sinTI : asSyI * cosTI * cosTI + sinTI * sinTI;
|
|
15019
|
-
if (isXSide) {
|
|
15020
|
-
if (child.__asLiveOrigW == null) {
|
|
15021
|
-
child.__asLiveOrigW = (child.width ?? 0) * (child.scaleX ?? 1);
|
|
15022
|
-
}
|
|
15023
|
-
const origW = child.__asLiveOrigW;
|
|
15024
|
-
const newW = Math.max(1, origW * sLocalI);
|
|
15025
|
-
if (Math.abs((child.width ?? 0) - newW) > 0.5) {
|
|
15026
|
-
child._set("width", newW);
|
|
15027
|
-
}
|
|
15028
|
-
} else {
|
|
15029
|
-
if (child.__asLiveOrigH == null) {
|
|
15030
|
-
child.__asLiveOrigH = (child.height ?? 0) * (child.scaleY ?? 1);
|
|
15031
|
-
}
|
|
15032
|
-
const origH = child.__asLiveOrigH;
|
|
15033
|
-
const newH = Math.max(1, origH * sLocalI);
|
|
15034
|
-
if (Math.abs((child.height ?? 0) - newH) > 0.5) {
|
|
15035
|
-
child._set("height", newH);
|
|
15036
|
-
}
|
|
15037
|
-
}
|
|
15038
|
-
try {
|
|
15039
|
-
const invI = [1 / asSxI, 0, 0, 1 / asSyI, 0, 0];
|
|
15040
|
-
const RthetaI = fabric__namespace.util.composeMatrix({
|
|
15041
|
-
angle: childAngleDegI,
|
|
15042
|
-
scaleX: 1,
|
|
15043
|
-
scaleY: 1,
|
|
15044
|
-
translateX: 0,
|
|
15045
|
-
translateY: 0
|
|
15046
|
-
});
|
|
15047
|
-
const MI = fabric__namespace.util.multiplyTransformMatrices(invI, RthetaI);
|
|
15048
|
-
const decI = fabric__namespace.util.qrDecompose(MI);
|
|
15049
|
-
child._set("angle", decI.angle);
|
|
15050
|
-
child._set("scaleX", decI.scaleX);
|
|
15051
|
-
child._set("scaleY", decI.scaleY);
|
|
15052
|
-
child._set("skewX", decI.skewX);
|
|
15053
|
-
child._set("skewY", decI.skewY);
|
|
15054
|
-
} catch {
|
|
15055
|
-
}
|
|
15056
14943
|
child.setCoords();
|
|
15057
|
-
captureAsLiveWorldSnapshot(child, child.width ?? 0, child.height ?? 0);
|
|
15058
14944
|
child.dirty = true;
|
|
15059
14945
|
continue;
|
|
15060
14946
|
}
|
|
@@ -16501,8 +16387,9 @@ const PageCanvas = react.forwardRef(
|
|
|
16501
16387
|
const objectFlipY = obj.flipY ?? false;
|
|
16502
16388
|
const persistedFlipX = (sourceElement == null ? void 0 : sourceElement.flipX) ?? objectFlipX;
|
|
16503
16389
|
const persistedFlipY = (sourceElement == null ? void 0 : sourceElement.flipY) ?? objectFlipY;
|
|
16390
|
+
const persistedAngle = sourceElement ? Number.isFinite(sourceElement.angle) ? sourceElement.angle ?? 0 : 0 : Number.isFinite(obj.angle) ? obj.angle ?? 0 : void 0;
|
|
16504
16391
|
const isActiveSelectionResizeGesture = activeSelectionResizeHandle === "ml" || activeSelectionResizeHandle === "mr" || activeSelectionResizeHandle === "mt" || activeSelectionResizeHandle === "mb" || activeSelectionResizeHandle === "tl" || activeSelectionResizeHandle === "tr" || activeSelectionResizeHandle === "bl" || activeSelectionResizeHandle === "br";
|
|
16505
|
-
const expectedCleanAngle = isActiveSelection && isActiveSelectionResizeGesture ? Number.isFinite(sourceElement
|
|
16392
|
+
const expectedCleanAngle = isActiveSelection && isActiveSelectionResizeGesture ? sourceElement ? Number.isFinite(sourceElement.angle) ? sourceElement.angle ?? 0 : 0 : Number.isFinite(obj.angle) ? obj.angle ?? 0 : void 0 : void 0;
|
|
16506
16393
|
const normalizedFinalAbsoluteMatrix = normalizeMatrixForPersistedFlip(
|
|
16507
16394
|
toggleLogicalFlipInMatrix(
|
|
16508
16395
|
finalAbsoluteMatrix,
|
|
@@ -16516,7 +16403,7 @@ const PageCanvas = react.forwardRef(
|
|
|
16516
16403
|
const cleanTransformMatrix = toggleLogicalFlipInMatrix(normalizedFinalAbsoluteMatrix, persistedFlipX, persistedFlipY);
|
|
16517
16404
|
const persistedDecomposed = fabric__namespace.util.qrDecompose(cleanTransformMatrix);
|
|
16518
16405
|
if (isActiveSelection && (obj instanceof fabric__namespace.FabricImage || obj instanceof fabric__namespace.Group && obj.__cropGroup)) {
|
|
16519
|
-
activeSelectionFlipRestores.push({ obj, flipX: persistedFlipX, flipY: persistedFlipY });
|
|
16406
|
+
activeSelectionFlipRestores.push({ obj, flipX: persistedFlipX, flipY: persistedFlipY, angle: persistedAngle });
|
|
16520
16407
|
}
|
|
16521
16408
|
const elementUpdate = {
|
|
16522
16409
|
left: storePos.left,
|
|
@@ -16742,14 +16629,14 @@ const PageCanvas = react.forwardRef(
|
|
|
16742
16629
|
skipActiveSelectionBakeOnClearRef.current = true;
|
|
16743
16630
|
try {
|
|
16744
16631
|
for (const restore of activeSelectionFlipRestores) {
|
|
16745
|
-
restorePersistedFlipState(restore.obj, restore.flipX, restore.flipY);
|
|
16632
|
+
restorePersistedFlipState(restore.obj, restore.flipX, restore.flipY, restore.angle);
|
|
16746
16633
|
}
|
|
16747
16634
|
fabricCanvas.discardActiveObject();
|
|
16748
16635
|
} finally {
|
|
16749
16636
|
skipActiveSelectionBakeOnClearRef.current = false;
|
|
16750
16637
|
}
|
|
16751
16638
|
for (const restore of activeSelectionFlipRestores) {
|
|
16752
|
-
restorePersistedFlipState(restore.obj, restore.flipX, restore.flipY);
|
|
16639
|
+
restorePersistedFlipState(restore.obj, restore.flipX, restore.flipY, restore.angle);
|
|
16753
16640
|
}
|
|
16754
16641
|
for (const bake of pendingCropGroupFrameBakes) {
|
|
16755
16642
|
const ct = bake.obj.__cropData;
|
|
@@ -16770,6 +16657,9 @@ const PageCanvas = react.forwardRef(
|
|
|
16770
16657
|
updateCoverLayout(bake.obj);
|
|
16771
16658
|
bake.obj.setCoords();
|
|
16772
16659
|
}
|
|
16660
|
+
for (const restore of activeSelectionFlipRestores) {
|
|
16661
|
+
restorePersistedFlipState(restore.obj, restore.flipX, restore.flipY, restore.angle);
|
|
16662
|
+
}
|
|
16773
16663
|
if (membersToReselect.length > 1) {
|
|
16774
16664
|
const newSel = new fabric__namespace.ActiveSelection(membersToReselect, { canvas: fabricCanvas });
|
|
16775
16665
|
if (wasGroupSel) restoreGroupSelectionVisualState(newSel, wasGroupSel);
|
|
@@ -25937,9 +25827,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
25937
25827
|
}
|
|
25938
25828
|
return svgString;
|
|
25939
25829
|
}
|
|
25940
|
-
const resolvedPackageVersion = "0.5.
|
|
25830
|
+
const resolvedPackageVersion = "0.5.446";
|
|
25941
25831
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
25942
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
25832
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.446";
|
|
25943
25833
|
const roundParityValue = (value) => {
|
|
25944
25834
|
if (typeof value !== "number") return value;
|
|
25945
25835
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -26753,7 +26643,7 @@ class PixldocsRenderer {
|
|
|
26753
26643
|
await this.waitForCanvasScene(container, cloned, i);
|
|
26754
26644
|
}
|
|
26755
26645
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
26756
|
-
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
26646
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-D7WHhcGD.cjs"));
|
|
26757
26647
|
const prepared = preparePagesForExport(
|
|
26758
26648
|
cloned.pages,
|
|
26759
26649
|
canvasWidth,
|
|
@@ -29073,7 +28963,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
29073
28963
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
29074
28964
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
29075
28965
|
try {
|
|
29076
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
28966
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-D7WHhcGD.cjs"));
|
|
29077
28967
|
try {
|
|
29078
28968
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
29079
28969
|
} catch {
|
|
@@ -29470,4 +29360,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
29470
29360
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
29471
29361
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
29472
29362
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
29473
|
-
//# sourceMappingURL=index-
|
|
29363
|
+
//# sourceMappingURL=index-BAQIJf_b.cjs.map
|