@pixldocs/canvas-renderer 0.5.331 → 0.5.332
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-COZR9zOa.cjs → index-B9Lpo1N6.cjs} +46 -17
- package/dist/index-B9Lpo1N6.cjs.map +1 -0
- package/dist/{index-C9n6xrCt.js → index-xMYBX3BX.js} +46 -17
- package/dist/index-xMYBX3BX.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-DvpRTaGb.js → vectorPdfExport-BE-V6kqQ.js} +4 -4
- package/dist/{vectorPdfExport-DvpRTaGb.js.map → vectorPdfExport-BE-V6kqQ.js.map} +1 -1
- package/dist/{vectorPdfExport-07IeD7w3.cjs → vectorPdfExport-BnF6Lk4i.cjs} +4 -4
- package/dist/{vectorPdfExport-07IeD7w3.cjs.map → vectorPdfExport-BnF6Lk4i.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/index-C9n6xrCt.js.map +0 -1
- package/dist/index-COZR9zOa.cjs.map +0 -1
|
@@ -13743,7 +13743,10 @@ const PageCanvas = forwardRef(
|
|
|
13743
13743
|
const a = ((c.angle ?? 0) % 180 + 180) % 180;
|
|
13744
13744
|
return !(a < 0.5 || a > 179.5);
|
|
13745
13745
|
});
|
|
13746
|
-
|
|
13746
|
+
const selectionAngle = ((obj.angle ?? 0) % 180 + 180) % 180;
|
|
13747
|
+
const isSelectionRotated = !(selectionAngle < 0.5 || selectionAngle > 179.5);
|
|
13748
|
+
const shouldPinNonTextChildren = hasRotatedChild || isSelectionRotated;
|
|
13749
|
+
if ((isXSide || shouldPinNonTextChildren) && ((_b2 = groupShiftReflowSnapshotRef.current) == null ? void 0 : _b2.selection) !== obj) {
|
|
13747
13750
|
groupShiftReflowSnapshotRef.current = null;
|
|
13748
13751
|
const logicalGroupId = obj.__pixldocsGroupSelection;
|
|
13749
13752
|
if (logicalGroupId) {
|
|
@@ -13790,16 +13793,31 @@ const PageCanvas = forwardRef(
|
|
|
13790
13793
|
}
|
|
13791
13794
|
}
|
|
13792
13795
|
const childCounterScale = hasRotatedChild ? 1 : 1 / sAxis;
|
|
13796
|
+
let restoredNonTextAfterLayout = false;
|
|
13793
13797
|
const restoreNonTextChildren = (pins) => {
|
|
13794
13798
|
var _a3, _b3;
|
|
13795
|
-
if (!
|
|
13799
|
+
if (!shouldPinNonTextChildren || ((_a3 = groupShiftReflowSnapshotRef.current) == null ? void 0 : _a3.selection) !== obj) return;
|
|
13796
13800
|
for (const entry of groupShiftReflowSnapshotRef.current.children) {
|
|
13797
13801
|
const child = entry.obj;
|
|
13798
13802
|
if (child instanceof fabric.Textbox) continue;
|
|
13799
13803
|
if (child instanceof fabric.FabricImage || child instanceof fabric.Group && (child.__cropGroup || ((_b3 = child._ct) == null ? void 0 : _b3.isCropGroup))) {
|
|
13800
13804
|
const pin = pins == null ? void 0 : pins.get(child);
|
|
13801
|
-
|
|
13802
|
-
|
|
13805
|
+
let targetLeft = hasRotatedChild && isXSide ? entry.left0 * sAxis : entry.left0;
|
|
13806
|
+
let targetTop = hasRotatedChild && !isXSide ? entry.top0 * sAxis : entry.top0;
|
|
13807
|
+
if (pin == null ? void 0 : pin.worldCenter) {
|
|
13808
|
+
try {
|
|
13809
|
+
const invSelectionMatrix = fabric.util.invertTransform(obj.calcTransformMatrix());
|
|
13810
|
+
const localCenter = fabric.util.transformPoint(pin.worldCenter, invSelectionMatrix);
|
|
13811
|
+
targetLeft = localCenter.x;
|
|
13812
|
+
targetTop = localCenter.y;
|
|
13813
|
+
} catch {
|
|
13814
|
+
targetLeft = pin.left ?? targetLeft;
|
|
13815
|
+
targetTop = pin.top ?? targetTop;
|
|
13816
|
+
}
|
|
13817
|
+
} else {
|
|
13818
|
+
targetLeft = (pin == null ? void 0 : pin.left) ?? targetLeft;
|
|
13819
|
+
targetTop = (pin == null ? void 0 : pin.top) ?? targetTop;
|
|
13820
|
+
}
|
|
13803
13821
|
if (Math.abs((child.left ?? 0) - targetLeft) > 0.01) child._set("left", targetLeft);
|
|
13804
13822
|
if (Math.abs((child.top ?? 0) - targetTop) > 0.01) child._set("top", targetTop);
|
|
13805
13823
|
if (isXSide) child._set("scaleX", childCounterScale);
|
|
@@ -13905,7 +13923,7 @@ const PageCanvas = forwardRef(
|
|
|
13905
13923
|
didReflowTextChild = true;
|
|
13906
13924
|
}
|
|
13907
13925
|
}
|
|
13908
|
-
if (isXSide && ((_e = groupShiftReflowSnapshotRef.current) == null ? void 0 : _e.selection) === obj) {
|
|
13926
|
+
if (isXSide && !shouldPinNonTextChildren && ((_e = groupShiftReflowSnapshotRef.current) == null ? void 0 : _e.selection) === obj) {
|
|
13909
13927
|
const snap = groupShiftReflowSnapshotRef.current;
|
|
13910
13928
|
const anchorEntry = snap.children[0];
|
|
13911
13929
|
const anchorTopLive = anchorEntry.obj.top ?? 0;
|
|
@@ -13938,12 +13956,17 @@ const PageCanvas = forwardRef(
|
|
|
13938
13956
|
if (cornersBefore) {
|
|
13939
13957
|
fixedMidBefore = corner === "ml" ? { x: (cornersBefore.tr.x + cornersBefore.br.x) / 2, y: (cornersBefore.tr.y + cornersBefore.br.y) / 2 } : { x: (cornersBefore.tl.x + cornersBefore.bl.x) / 2, y: (cornersBefore.tl.y + cornersBefore.bl.y) / 2 };
|
|
13940
13958
|
}
|
|
13941
|
-
const nonTextPinsBeforeLayout =
|
|
13959
|
+
const nonTextPinsBeforeLayout = shouldPinNonTextChildren ? new Map(obj.getObjects().map((child) => [child, {
|
|
13960
|
+
left: child.left ?? 0,
|
|
13961
|
+
top: child.top ?? 0,
|
|
13962
|
+
worldCenter: child instanceof fabric.Textbox ? void 0 : child.getCenterPoint()
|
|
13963
|
+
}])) : void 0;
|
|
13942
13964
|
try {
|
|
13943
13965
|
obj.triggerLayout();
|
|
13944
13966
|
} catch {
|
|
13945
13967
|
}
|
|
13946
13968
|
restoreNonTextChildren(nonTextPinsBeforeLayout);
|
|
13969
|
+
restoredNonTextAfterLayout = !!nonTextPinsBeforeLayout;
|
|
13947
13970
|
obj._set("width", asW0);
|
|
13948
13971
|
obj._set("scaleX", asSx0);
|
|
13949
13972
|
obj._set("scaleY", asSy0);
|
|
@@ -13969,7 +13992,7 @@ const PageCanvas = forwardRef(
|
|
|
13969
13992
|
obj._set("left", asLeft0);
|
|
13970
13993
|
obj._set("top", asTop0);
|
|
13971
13994
|
}
|
|
13972
|
-
restoreNonTextChildren();
|
|
13995
|
+
if (!restoredNonTextAfterLayout) restoreNonTextChildren();
|
|
13973
13996
|
obj._set("width", asW0);
|
|
13974
13997
|
obj._set("scaleX", asSx0);
|
|
13975
13998
|
obj._set("scaleY", asSy0);
|
|
@@ -14793,11 +14816,17 @@ const PageCanvas = forwardRef(
|
|
|
14793
14816
|
absoluteTop = (decomposed.translateY ?? absoluteTop ?? 0) - w / 2 * Math.sin(angleRad) - h / 2 * Math.cos(angleRad);
|
|
14794
14817
|
}
|
|
14795
14818
|
} else if (obj instanceof fabric.FabricImage && (obj.originX === "center" || obj.originY === "center")) {
|
|
14796
|
-
|
|
14797
|
-
|
|
14798
|
-
|
|
14799
|
-
|
|
14800
|
-
|
|
14819
|
+
if (isActiveSelection && activeObj instanceof fabric.ActiveSelection) {
|
|
14820
|
+
const frameBounds = getObjectFrameBoundsInSelection(activeObj, obj, obj.width ?? 0, obj.height ?? 0);
|
|
14821
|
+
absoluteLeft = frameBounds.left;
|
|
14822
|
+
absoluteTop = frameBounds.top;
|
|
14823
|
+
} else {
|
|
14824
|
+
const w = (obj.width ?? 0) * (obj.scaleX ?? 1);
|
|
14825
|
+
const h = (obj.height ?? 0) * (obj.scaleY ?? 1);
|
|
14826
|
+
const angleRad = (decomposed.angle ?? obj.angle ?? 0) * Math.PI / 180;
|
|
14827
|
+
absoluteLeft = (decomposed.translateX ?? absoluteLeft ?? 0) - w / 2 * Math.cos(angleRad) + h / 2 * Math.sin(angleRad);
|
|
14828
|
+
absoluteTop = (decomposed.translateY ?? absoluteTop ?? 0) - w / 2 * Math.sin(angleRad) - h / 2 * Math.cos(angleRad);
|
|
14829
|
+
}
|
|
14801
14830
|
}
|
|
14802
14831
|
const preserveCornerGeometry = (sourceElement == null ? void 0 : sourceElement.type) === "shape" && (sourceElement.shapeType === "circle" || sourceElement.shapeType === "rounded-rect" || sourceElement.shapeType === "triangle");
|
|
14803
14832
|
let finalWidth = intrinsicWidth;
|
|
@@ -24296,9 +24325,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
24296
24325
|
}
|
|
24297
24326
|
return svgString;
|
|
24298
24327
|
}
|
|
24299
|
-
const resolvedPackageVersion = "0.5.
|
|
24328
|
+
const resolvedPackageVersion = "0.5.332";
|
|
24300
24329
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
24301
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
24330
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.332";
|
|
24302
24331
|
const roundParityValue = (value) => {
|
|
24303
24332
|
if (typeof value !== "number") return value;
|
|
24304
24333
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -25112,7 +25141,7 @@ class PixldocsRenderer {
|
|
|
25112
25141
|
await this.waitForCanvasScene(container, cloned, i);
|
|
25113
25142
|
}
|
|
25114
25143
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
25115
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
25144
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-BE-V6kqQ.js");
|
|
25116
25145
|
const prepared = preparePagesForExport(
|
|
25117
25146
|
cloned.pages,
|
|
25118
25147
|
canvasWidth,
|
|
@@ -27432,7 +27461,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
27432
27461
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
27433
27462
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
27434
27463
|
try {
|
|
27435
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
27464
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-BE-V6kqQ.js");
|
|
27436
27465
|
try {
|
|
27437
27466
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
27438
27467
|
} catch {
|
|
@@ -27832,4 +27861,4 @@ export {
|
|
|
27832
27861
|
buildTeaserBlurFlatKeys as y,
|
|
27833
27862
|
collectFontDescriptorsFromConfig as z
|
|
27834
27863
|
};
|
|
27835
|
-
//# sourceMappingURL=index-
|
|
27864
|
+
//# sourceMappingURL=index-xMYBX3BX.js.map
|