@pixldocs/canvas-renderer 0.5.328 → 0.5.330
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-36ORX_k2.js → index-B6Ucv-_d.js} +51 -72
- package/dist/index-B6Ucv-_d.js.map +1 -0
- package/dist/{index-DhowYy-T.cjs → index-DyarJoo_.cjs} +51 -72
- package/dist/index-DyarJoo_.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-CKg43wpe.js → vectorPdfExport-BIkOnJF2.js} +4 -4
- package/dist/{vectorPdfExport-CKg43wpe.js.map → vectorPdfExport-BIkOnJF2.js.map} +1 -1
- package/dist/{vectorPdfExport-B4Vpz8di.cjs → vectorPdfExport-CJBVK7bd.cjs} +4 -4
- package/dist/{vectorPdfExport-B4Vpz8di.cjs.map → vectorPdfExport-CJBVK7bd.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/index-36ORX_k2.js.map +0 -1
- package/dist/index-DhowYy-T.cjs.map +0 -1
|
@@ -13740,7 +13740,7 @@ const PageCanvas = forwardRef(
|
|
|
13740
13740
|
const a = ((c.angle ?? 0) % 180 + 180) % 180;
|
|
13741
13741
|
return !(a < 0.5 || a > 179.5);
|
|
13742
13742
|
});
|
|
13743
|
-
if (isXSide && ((_b2 = groupShiftReflowSnapshotRef.current) == null ? void 0 : _b2.selection) !== obj) {
|
|
13743
|
+
if ((isXSide || hasRotatedChild) && ((_b2 = groupShiftReflowSnapshotRef.current) == null ? void 0 : _b2.selection) !== obj) {
|
|
13744
13744
|
groupShiftReflowSnapshotRef.current = null;
|
|
13745
13745
|
const logicalGroupId = obj.__pixldocsGroupSelection;
|
|
13746
13746
|
if (logicalGroupId) {
|
|
@@ -13752,7 +13752,9 @@ const PageCanvas = forwardRef(
|
|
|
13752
13752
|
const entries = obj.getObjects().map((c) => ({
|
|
13753
13753
|
obj: c,
|
|
13754
13754
|
id: getObjectId(c) ?? "",
|
|
13755
|
+
left0: c.left ?? 0,
|
|
13755
13756
|
top0: c.top ?? 0,
|
|
13757
|
+
width0: (c.width ?? 0) * Math.abs(c.scaleX ?? 1),
|
|
13756
13758
|
height0: (c.height ?? 0) * Math.abs(c.scaleY ?? 1)
|
|
13757
13759
|
})).filter((e2) => e2.id).sort((a, b) => a.top0 - b.top0);
|
|
13758
13760
|
if (entries.length > 1) {
|
|
@@ -13785,78 +13787,50 @@ const PageCanvas = forwardRef(
|
|
|
13785
13787
|
}
|
|
13786
13788
|
}
|
|
13787
13789
|
const childCounterScale = hasRotatedChild ? 1 : 1 / sAxis;
|
|
13790
|
+
const restoreNonTextChildren = (pins) => {
|
|
13791
|
+
var _a3, _b3;
|
|
13792
|
+
if (!hasRotatedChild || ((_a3 = groupShiftReflowSnapshotRef.current) == null ? void 0 : _a3.selection) !== obj) return;
|
|
13793
|
+
for (const entry of groupShiftReflowSnapshotRef.current.children) {
|
|
13794
|
+
const child = entry.obj;
|
|
13795
|
+
if (child instanceof fabric.Textbox) continue;
|
|
13796
|
+
if (child instanceof fabric.FabricImage || child instanceof fabric.Group && (child.__cropGroup || ((_b3 = child._ct) == null ? void 0 : _b3.isCropGroup))) {
|
|
13797
|
+
const pin = pins == null ? void 0 : pins.get(child);
|
|
13798
|
+
const targetLeft = (pin == null ? void 0 : pin.left) ?? (isXSide ? entry.left0 * sAxis : entry.left0);
|
|
13799
|
+
const targetTop = (pin == null ? void 0 : pin.top) ?? (isXSide ? entry.top0 : entry.top0 * sAxis);
|
|
13800
|
+
if (Math.abs((child.left ?? 0) - targetLeft) > 0.01) child._set("left", targetLeft);
|
|
13801
|
+
if (Math.abs((child.top ?? 0) - targetTop) > 0.01) child._set("top", targetTop);
|
|
13802
|
+
if (isXSide) child._set("scaleX", childCounterScale);
|
|
13803
|
+
else child._set("scaleY", childCounterScale);
|
|
13804
|
+
child.setCoords();
|
|
13805
|
+
child.dirty = true;
|
|
13806
|
+
}
|
|
13807
|
+
}
|
|
13808
|
+
};
|
|
13809
|
+
const projectRotatedTextPosition = (child) => {
|
|
13810
|
+
var _a3;
|
|
13811
|
+
if (!hasRotatedChild || ((_a3 = groupShiftReflowSnapshotRef.current) == null ? void 0 : _a3.selection) !== obj) return;
|
|
13812
|
+
const entry = groupShiftReflowSnapshotRef.current.children.find((candidate) => candidate.obj === child);
|
|
13813
|
+
if (!entry) return;
|
|
13814
|
+
if (isXSide) child._set("left", entry.left0 * sAxis);
|
|
13815
|
+
else child._set("top", entry.top0 * sAxis);
|
|
13816
|
+
};
|
|
13788
13817
|
for (const child of obj.getObjects()) {
|
|
13789
13818
|
if (child instanceof fabric.Group && (child.__cropGroup || ((_d = child._ct) == null ? void 0 : _d.isCropGroup))) {
|
|
13790
|
-
|
|
13791
|
-
|
|
13792
|
-
|
|
13793
|
-
|
|
13794
|
-
const baseW = child.width ?? ct.frameW ?? 0;
|
|
13795
|
-
child.__asLiveOrigW = baseW * (child.scaleX ?? 1);
|
|
13796
|
-
}
|
|
13797
|
-
const origW = child.__asLiveOrigW;
|
|
13798
|
-
const newW = Math.max(20, origW * sAxis);
|
|
13799
|
-
if (Math.abs((child.width ?? 0) - newW) > 0.5) {
|
|
13800
|
-
ct.frameW = newW;
|
|
13801
|
-
child._set("width", newW);
|
|
13802
|
-
child._set("scaleX", childCounterScale);
|
|
13803
|
-
try {
|
|
13804
|
-
updateCoverLayout(child);
|
|
13805
|
-
} catch {
|
|
13806
|
-
}
|
|
13807
|
-
child.setCoords();
|
|
13808
|
-
child.dirty = true;
|
|
13809
|
-
}
|
|
13810
|
-
} else {
|
|
13811
|
-
if (child.__asLiveOrigH == null) {
|
|
13812
|
-
const baseH = child.height ?? ct.frameH ?? 0;
|
|
13813
|
-
child.__asLiveOrigH = baseH * (child.scaleY ?? 1);
|
|
13814
|
-
}
|
|
13815
|
-
const origH = child.__asLiveOrigH;
|
|
13816
|
-
const newH = Math.max(20, origH * sAxis);
|
|
13817
|
-
if (Math.abs((child.height ?? 0) - newH) > 0.5) {
|
|
13818
|
-
ct.frameH = newH;
|
|
13819
|
-
child._set("height", newH);
|
|
13820
|
-
child._set("scaleY", childCounterScale);
|
|
13821
|
-
try {
|
|
13822
|
-
updateCoverLayout(child);
|
|
13823
|
-
} catch {
|
|
13824
|
-
}
|
|
13825
|
-
child.setCoords();
|
|
13826
|
-
child.dirty = true;
|
|
13827
|
-
}
|
|
13828
|
-
}
|
|
13819
|
+
if (isXSide) child._set("scaleX", childCounterScale);
|
|
13820
|
+
else child._set("scaleY", childCounterScale);
|
|
13821
|
+
child.setCoords();
|
|
13822
|
+
child.dirty = true;
|
|
13829
13823
|
continue;
|
|
13830
13824
|
}
|
|
13831
13825
|
if (child instanceof fabric.FabricImage && !child.__cropGroup && !child.smartElementType) {
|
|
13832
|
-
if (isXSide)
|
|
13833
|
-
|
|
13834
|
-
|
|
13835
|
-
|
|
13836
|
-
const origW = child.__asLiveOrigW;
|
|
13837
|
-
const newW = Math.max(1, origW * sAxis);
|
|
13838
|
-
if (Math.abs((child.width ?? 0) - newW) > 0.5) {
|
|
13839
|
-
child._set("width", newW);
|
|
13840
|
-
child._set("scaleX", childCounterScale);
|
|
13841
|
-
child.setCoords();
|
|
13842
|
-
child.dirty = true;
|
|
13843
|
-
}
|
|
13844
|
-
} else {
|
|
13845
|
-
if (child.__asLiveOrigH == null) {
|
|
13846
|
-
child.__asLiveOrigH = (child.height ?? 0) * (child.scaleY ?? 1);
|
|
13847
|
-
}
|
|
13848
|
-
const origH = child.__asLiveOrigH;
|
|
13849
|
-
const newH = Math.max(1, origH * sAxis);
|
|
13850
|
-
if (Math.abs((child.height ?? 0) - newH) > 0.5) {
|
|
13851
|
-
child._set("height", newH);
|
|
13852
|
-
child._set("scaleY", childCounterScale);
|
|
13853
|
-
child.setCoords();
|
|
13854
|
-
child.dirty = true;
|
|
13855
|
-
}
|
|
13856
|
-
}
|
|
13826
|
+
if (isXSide) child._set("scaleX", childCounterScale);
|
|
13827
|
+
else child._set("scaleY", childCounterScale);
|
|
13828
|
+
child.setCoords();
|
|
13829
|
+
child.dirty = true;
|
|
13857
13830
|
continue;
|
|
13858
13831
|
}
|
|
13859
13832
|
if (!(child instanceof fabric.Textbox)) continue;
|
|
13833
|
+
projectRotatedTextPosition(child);
|
|
13860
13834
|
if (isXSide) {
|
|
13861
13835
|
if (child.__asLiveOrigW == null) {
|
|
13862
13836
|
child.__asLiveOrigW = (child.width ?? 0) * (child.scaleX ?? 1);
|
|
@@ -13924,10 +13898,12 @@ const PageCanvas = forwardRef(
|
|
|
13924
13898
|
if (cornersBefore) {
|
|
13925
13899
|
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 };
|
|
13926
13900
|
}
|
|
13901
|
+
const nonTextPinsBeforeLayout = hasRotatedChild ? new Map(obj.getObjects().map((child) => [child, { left: child.left ?? 0, top: child.top ?? 0 }])) : void 0;
|
|
13927
13902
|
try {
|
|
13928
13903
|
obj.triggerLayout();
|
|
13929
13904
|
} catch {
|
|
13930
13905
|
}
|
|
13906
|
+
restoreNonTextChildren(nonTextPinsBeforeLayout);
|
|
13931
13907
|
obj._set("width", asW0);
|
|
13932
13908
|
obj._set("scaleX", asSx0);
|
|
13933
13909
|
obj._set("scaleY", asSy0);
|
|
@@ -13953,6 +13929,7 @@ const PageCanvas = forwardRef(
|
|
|
13953
13929
|
obj._set("left", asLeft0);
|
|
13954
13930
|
obj._set("top", asTop0);
|
|
13955
13931
|
}
|
|
13932
|
+
restoreNonTextChildren();
|
|
13956
13933
|
obj._set("width", asW0);
|
|
13957
13934
|
obj._set("scaleX", asSx0);
|
|
13958
13935
|
obj._set("scaleY", asSy0);
|
|
@@ -14593,6 +14570,7 @@ const PageCanvas = forwardRef(
|
|
|
14593
14570
|
return;
|
|
14594
14571
|
}
|
|
14595
14572
|
}
|
|
14573
|
+
const isActiveSelectionSideResize = isActiveSelection && (activeSelectionResizeHandle === "ml" || activeSelectionResizeHandle === "mr" || activeSelectionResizeHandle === "mt" || activeSelectionResizeHandle === "mb");
|
|
14596
14574
|
if (selectedElementIds.length > 0 && !anyCropGroup) {
|
|
14597
14575
|
const firstObj = activeObjects[0];
|
|
14598
14576
|
const firstId = getObjectId(firstObj);
|
|
@@ -14654,7 +14632,8 @@ const PageCanvas = forwardRef(
|
|
|
14654
14632
|
}
|
|
14655
14633
|
const deltaX = movedGroupLeft - groupAbs.left;
|
|
14656
14634
|
const deltaY = movedGroupTop - groupAbs.top;
|
|
14657
|
-
const
|
|
14635
|
+
const hadResizeHandle = isActiveSelection && !!activeSelectionResizeHandle;
|
|
14636
|
+
const hadScale = isActiveSelection && activeObj && (hadResizeHandle || Math.abs((activeObj.scaleX ?? 1) - 1) > 0.01 || Math.abs((activeObj.scaleY ?? 1) - 1) > 0.01);
|
|
14658
14637
|
const startSelAngle = (((transformStart == null ? void 0 : transformStart.selectionAngle) ?? 0) % 360 + 360) % 360;
|
|
14659
14638
|
const currentSelAngle = isActiveSelection && activeObj ? ((activeObj.angle ?? 0) % 360 + 360) % 360 : 0;
|
|
14660
14639
|
const angleDelta = Math.min(
|
|
@@ -14662,7 +14641,7 @@ const PageCanvas = forwardRef(
|
|
|
14662
14641
|
360 - Math.abs(currentSelAngle - startSelAngle)
|
|
14663
14642
|
);
|
|
14664
14643
|
const hadRotation = isActiveSelection && activeObj && angleDelta > 0.01;
|
|
14665
|
-
if (!hadScale && !hadRotation && (Math.abs(deltaX) > 0.1 || Math.abs(deltaY) > 0.1)) {
|
|
14644
|
+
if (!isActiveSelectionSideResize && !hadScale && !hadRotation && (Math.abs(deltaX) > 0.1 || Math.abs(deltaY) > 0.1)) {
|
|
14666
14645
|
const { updateNode: updateNodeStore, commitHistory: commitHistoryStore, getCurrentElements } = useEditorStore.getState();
|
|
14667
14646
|
const newLeft = (groupToMove.left ?? 0) + deltaX;
|
|
14668
14647
|
const newTop = (groupToMove.top ?? 0) + deltaY;
|
|
@@ -24268,9 +24247,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
24268
24247
|
}
|
|
24269
24248
|
return svgString;
|
|
24270
24249
|
}
|
|
24271
|
-
const resolvedPackageVersion = "0.5.
|
|
24250
|
+
const resolvedPackageVersion = "0.5.330";
|
|
24272
24251
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
24273
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
24252
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.330";
|
|
24274
24253
|
const roundParityValue = (value) => {
|
|
24275
24254
|
if (typeof value !== "number") return value;
|
|
24276
24255
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -25084,7 +25063,7 @@ class PixldocsRenderer {
|
|
|
25084
25063
|
await this.waitForCanvasScene(container, cloned, i);
|
|
25085
25064
|
}
|
|
25086
25065
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
25087
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
25066
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-BIkOnJF2.js");
|
|
25088
25067
|
const prepared = preparePagesForExport(
|
|
25089
25068
|
cloned.pages,
|
|
25090
25069
|
canvasWidth,
|
|
@@ -27404,7 +27383,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
27404
27383
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
27405
27384
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
27406
27385
|
try {
|
|
27407
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
27386
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-BIkOnJF2.js");
|
|
27408
27387
|
try {
|
|
27409
27388
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
27410
27389
|
} catch {
|
|
@@ -27804,4 +27783,4 @@ export {
|
|
|
27804
27783
|
buildTeaserBlurFlatKeys as y,
|
|
27805
27784
|
collectFontDescriptorsFromConfig as z
|
|
27806
27785
|
};
|
|
27807
|
-
//# sourceMappingURL=index-
|
|
27786
|
+
//# sourceMappingURL=index-B6Ucv-_d.js.map
|