@pixldocs/canvas-renderer 0.5.297 → 0.5.299
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-CrvU0g7N.cjs → index-DUUr9uZ0.cjs} +124 -8
- package/dist/{index-CrvU0g7N.cjs.map → index-DUUr9uZ0.cjs.map} +1 -1
- package/dist/{index-BDVGR-oo.js → index-Ddn4TvlA.js} +124 -8
- package/dist/{index-BDVGR-oo.js.map → index-Ddn4TvlA.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-DOAlZclW.js → vectorPdfExport-C1obEkji.js} +4 -4
- package/dist/{vectorPdfExport-DOAlZclW.js.map → vectorPdfExport-C1obEkji.js.map} +1 -1
- package/dist/{vectorPdfExport-hvIfS0b3.cjs → vectorPdfExport-DeL1bsjM.cjs} +4 -4
- package/dist/{vectorPdfExport-hvIfS0b3.cjs.map → vectorPdfExport-DeL1bsjM.cjs.map} +1 -1
- package/package.json +1 -1
|
@@ -13618,6 +13618,34 @@ const PageCanvas = react.forwardRef(
|
|
|
13618
13618
|
const asRect0 = obj.getBoundingRect();
|
|
13619
13619
|
let didReflowTextChild = false;
|
|
13620
13620
|
for (const child of obj.getObjects()) {
|
|
13621
|
+
if (child instanceof fabric__namespace.FabricImage && !child.__cropGroup && !child.smartElementType) {
|
|
13622
|
+
if (isXSide) {
|
|
13623
|
+
if (child.__asLiveOrigW == null) {
|
|
13624
|
+
child.__asLiveOrigW = (child.width ?? 0) * (child.scaleX ?? 1);
|
|
13625
|
+
}
|
|
13626
|
+
const origW = child.__asLiveOrigW;
|
|
13627
|
+
const newW = Math.max(1, origW * sAxis);
|
|
13628
|
+
if (Math.abs((child.width ?? 0) - newW) > 0.5) {
|
|
13629
|
+
child._set("width", newW);
|
|
13630
|
+
child._set("scaleX", 1 / sAxis);
|
|
13631
|
+
child.setCoords();
|
|
13632
|
+
child.dirty = true;
|
|
13633
|
+
}
|
|
13634
|
+
} else {
|
|
13635
|
+
if (child.__asLiveOrigH == null) {
|
|
13636
|
+
child.__asLiveOrigH = (child.height ?? 0) * (child.scaleY ?? 1);
|
|
13637
|
+
}
|
|
13638
|
+
const origH = child.__asLiveOrigH;
|
|
13639
|
+
const newH = Math.max(1, origH * sAxis);
|
|
13640
|
+
if (Math.abs((child.height ?? 0) - newH) > 0.5) {
|
|
13641
|
+
child._set("height", newH);
|
|
13642
|
+
child._set("scaleY", 1 / sAxis);
|
|
13643
|
+
child.setCoords();
|
|
13644
|
+
child.dirty = true;
|
|
13645
|
+
}
|
|
13646
|
+
}
|
|
13647
|
+
continue;
|
|
13648
|
+
}
|
|
13621
13649
|
if (!(child instanceof fabric__namespace.Textbox)) continue;
|
|
13622
13650
|
if (isXSide) {
|
|
13623
13651
|
if (child.__asLiveOrigW == null) {
|
|
@@ -13955,7 +13983,7 @@ const PageCanvas = react.forwardRef(
|
|
|
13955
13983
|
});
|
|
13956
13984
|
let cropGroupSaveTimer = null;
|
|
13957
13985
|
fabricCanvas.on("object:modified", (e) => {
|
|
13958
|
-
var _a2, _b2, _c, _d, _e, _f, _g, _h;
|
|
13986
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
|
|
13959
13987
|
try {
|
|
13960
13988
|
dragStarted = false;
|
|
13961
13989
|
setGuides([]);
|
|
@@ -14562,6 +14590,94 @@ const PageCanvas = react.forwardRef(
|
|
|
14562
14590
|
};
|
|
14563
14591
|
useEditorStore.getState().updateElement(objId, { src: newSrc }, { recordHistory: false, skipLayoutRecalc: true });
|
|
14564
14592
|
}
|
|
14593
|
+
} else if (isActiveSelection && (Math.abs((decomposed.scaleX ?? 1) - 1) > 1e-3 || Math.abs((decomposed.scaleY ?? 1) - 1) > 1e-3)) {
|
|
14594
|
+
const sx = Math.abs(decomposed.scaleX || 1);
|
|
14595
|
+
const sy = Math.abs(decomposed.scaleY || 1);
|
|
14596
|
+
const handle = activeSelectionResizeHandle;
|
|
14597
|
+
const isCornerHandle = handle === "tl" || handle === "tr" || handle === "bl" || handle === "br" || // Fallback: if handle ref is missing and sx≈sy with non-1 magnitude,
|
|
14598
|
+
// treat as a uniform corner drag.
|
|
14599
|
+
!handle && Math.abs(sx - sy) < 0.01 && Math.abs(sx - 1) > 1e-3;
|
|
14600
|
+
let fx;
|
|
14601
|
+
let fy;
|
|
14602
|
+
if (isCornerHandle) {
|
|
14603
|
+
const u = Math.max(1e-3, Math.sqrt(sx * sy));
|
|
14604
|
+
fx = u;
|
|
14605
|
+
fy = u;
|
|
14606
|
+
} else {
|
|
14607
|
+
fx = sx;
|
|
14608
|
+
fy = sy;
|
|
14609
|
+
}
|
|
14610
|
+
const bakedW = Math.max(1, intrinsicWidth * fx);
|
|
14611
|
+
const bakedH = Math.max(1, intrinsicHeight * fy);
|
|
14612
|
+
try {
|
|
14613
|
+
const preBakeCenter = obj.getCenterPoint();
|
|
14614
|
+
const prevObjCaching = obj.objectCaching;
|
|
14615
|
+
obj.set({
|
|
14616
|
+
width: bakedW,
|
|
14617
|
+
height: bakedH,
|
|
14618
|
+
scaleX: 1,
|
|
14619
|
+
scaleY: 1,
|
|
14620
|
+
objectCaching: false
|
|
14621
|
+
});
|
|
14622
|
+
obj.objectCaching = prevObjCaching;
|
|
14623
|
+
if (sx > 0 && sy > 0) {
|
|
14624
|
+
const localScaleX = 1 / sx;
|
|
14625
|
+
const localScaleY = 1 / sy;
|
|
14626
|
+
obj.set({ scaleX: localScaleX, scaleY: localScaleY });
|
|
14627
|
+
const selectionMatrix = (_g = activeObj == null ? void 0 : activeObj.calcTransformMatrix) == null ? void 0 : _g.call(activeObj);
|
|
14628
|
+
const localCenter = selectionMatrix ? fabric__namespace.util.transformPoint(preBakeCenter, fabric__namespace.util.invertTransform(selectionMatrix)) : preBakeCenter;
|
|
14629
|
+
const localWidth = bakedW * localScaleX;
|
|
14630
|
+
const localHeight = bakedH * localScaleY;
|
|
14631
|
+
const isCenterOrigin = obj.originX === "center" || obj.originY === "center";
|
|
14632
|
+
if (isCenterOrigin) {
|
|
14633
|
+
obj.set({
|
|
14634
|
+
left: localCenter.x,
|
|
14635
|
+
top: localCenter.y
|
|
14636
|
+
});
|
|
14637
|
+
} else {
|
|
14638
|
+
obj.set({
|
|
14639
|
+
left: localCenter.x - localWidth / 2,
|
|
14640
|
+
top: localCenter.y - localHeight / 2
|
|
14641
|
+
});
|
|
14642
|
+
}
|
|
14643
|
+
}
|
|
14644
|
+
obj.dirty = true;
|
|
14645
|
+
if (activeObj) activeObj.dirty = true;
|
|
14646
|
+
obj.setCoords();
|
|
14647
|
+
} catch {
|
|
14648
|
+
}
|
|
14649
|
+
finalWidth = bakedW;
|
|
14650
|
+
finalHeight = bakedH;
|
|
14651
|
+
finalScaleX = 1;
|
|
14652
|
+
finalScaleY = 1;
|
|
14653
|
+
try {
|
|
14654
|
+
const angleRad = (decomposed.angle ?? 0) * Math.PI / 180;
|
|
14655
|
+
const cos = Math.cos(angleRad);
|
|
14656
|
+
const sin = Math.sin(angleRad);
|
|
14657
|
+
const hw = finalWidth / 2;
|
|
14658
|
+
const hh = finalHeight / 2;
|
|
14659
|
+
const corners = [
|
|
14660
|
+
{ x: -hw, y: -hh },
|
|
14661
|
+
{ x: hw, y: -hh },
|
|
14662
|
+
{ x: hw, y: hh },
|
|
14663
|
+
{ x: -hw, y: hh }
|
|
14664
|
+
].map((p) => ({
|
|
14665
|
+
x: decomposed.translateX + p.x * cos - p.y * sin,
|
|
14666
|
+
y: decomposed.translateY + p.x * sin + p.y * cos
|
|
14667
|
+
}));
|
|
14668
|
+
absoluteLeft = Math.min(...corners.map((p) => p.x));
|
|
14669
|
+
absoluteTop = Math.min(...corners.map((p) => p.y));
|
|
14670
|
+
} catch {
|
|
14671
|
+
}
|
|
14672
|
+
finalAbsoluteMatrix = fabric__namespace.util.composeMatrix({
|
|
14673
|
+
translateX: decomposed.translateX,
|
|
14674
|
+
translateY: decomposed.translateY,
|
|
14675
|
+
angle: decomposed.angle ?? 0,
|
|
14676
|
+
scaleX: 1,
|
|
14677
|
+
scaleY: 1,
|
|
14678
|
+
skewX: 0,
|
|
14679
|
+
skewY: 0
|
|
14680
|
+
});
|
|
14565
14681
|
} else {
|
|
14566
14682
|
finalWidth = intrinsicWidth;
|
|
14567
14683
|
finalHeight = intrinsicHeight;
|
|
@@ -14605,7 +14721,7 @@ const PageCanvas = react.forwardRef(
|
|
|
14605
14721
|
const localScaleX = 1 / sx;
|
|
14606
14722
|
const localScaleY = 1 / sy;
|
|
14607
14723
|
obj.set({ scaleX: localScaleX, scaleY: localScaleY });
|
|
14608
|
-
const selectionMatrix = (
|
|
14724
|
+
const selectionMatrix = (_h = activeObj == null ? void 0 : activeObj.calcTransformMatrix) == null ? void 0 : _h.call(activeObj);
|
|
14609
14725
|
const localCenter = selectionMatrix ? fabric__namespace.util.transformPoint(preBakeCenter, fabric__namespace.util.invertTransform(selectionMatrix)) : preBakeCenter;
|
|
14610
14726
|
const localWidth = bakedWidth * localScaleX;
|
|
14611
14727
|
const localHeight = (obj.height ?? intrinsicHeight) * localScaleY;
|
|
@@ -14757,7 +14873,7 @@ const PageCanvas = react.forwardRef(
|
|
|
14757
14873
|
updateElement(objId, elementUpdate, { recordHistory: false, skipLayoutRecalc: true });
|
|
14758
14874
|
obj.setCoords();
|
|
14759
14875
|
}
|
|
14760
|
-
const pageChildrenForReflow = ((
|
|
14876
|
+
const pageChildrenForReflow = ((_i = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _i.children) ?? [];
|
|
14761
14877
|
const stackGroupsToReflow = /* @__PURE__ */ new Set();
|
|
14762
14878
|
for (const id of modifiedIdsThisRound) {
|
|
14763
14879
|
const parent = findParentGroup(pageChildrenForReflow, id);
|
|
@@ -23857,9 +23973,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
23857
23973
|
}
|
|
23858
23974
|
return svgString;
|
|
23859
23975
|
}
|
|
23860
|
-
const resolvedPackageVersion = "0.5.
|
|
23976
|
+
const resolvedPackageVersion = "0.5.299";
|
|
23861
23977
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
23862
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
23978
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.299";
|
|
23863
23979
|
const roundParityValue = (value) => {
|
|
23864
23980
|
if (typeof value !== "number") return value;
|
|
23865
23981
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -24673,7 +24789,7 @@ class PixldocsRenderer {
|
|
|
24673
24789
|
await this.waitForCanvasScene(container, cloned, i);
|
|
24674
24790
|
}
|
|
24675
24791
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
24676
|
-
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
24792
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-DeL1bsjM.cjs"));
|
|
24677
24793
|
const prepared = preparePagesForExport(
|
|
24678
24794
|
cloned.pages,
|
|
24679
24795
|
canvasWidth,
|
|
@@ -26993,7 +27109,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
26993
27109
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
26994
27110
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
26995
27111
|
try {
|
|
26996
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
27112
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-DeL1bsjM.cjs"));
|
|
26997
27113
|
try {
|
|
26998
27114
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
26999
27115
|
} catch {
|
|
@@ -27390,4 +27506,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
27390
27506
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
27391
27507
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
27392
27508
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
27393
|
-
//# sourceMappingURL=index-
|
|
27509
|
+
//# sourceMappingURL=index-DUUr9uZ0.cjs.map
|