@pixldocs/canvas-renderer 0.5.405 → 0.5.407
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-uJf5RraI.cjs → index-DYykToy0.cjs} +41 -12
- package/dist/index-DYykToy0.cjs.map +1 -0
- package/dist/{index-A1mT_rQo.js → index-Dxlbnksl.js} +41 -12
- package/dist/index-Dxlbnksl.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-DSku6Anm.cjs → vectorPdfExport-DRPD9NOQ.cjs} +4 -4
- package/dist/{vectorPdfExport-DSku6Anm.cjs.map → vectorPdfExport-DRPD9NOQ.cjs.map} +1 -1
- package/dist/{vectorPdfExport-C3La67Vw.js → vectorPdfExport-DuXVrbKW.js} +4 -4
- package/dist/{vectorPdfExport-C3La67Vw.js.map → vectorPdfExport-DuXVrbKW.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-A1mT_rQo.js.map +0 -1
- package/dist/index-uJf5RraI.cjs.map +0 -1
|
@@ -13237,9 +13237,37 @@ const PageCanvas = forwardRef(
|
|
|
13237
13237
|
transformingIdsRef.current.clear();
|
|
13238
13238
|
};
|
|
13239
13239
|
const prepareGroupSelectionTransformStart = (target) => {
|
|
13240
|
-
var _a2, _b2, _c2;
|
|
13240
|
+
var _a2, _b2, _c2, _d, _e;
|
|
13241
13241
|
const active = target instanceof fabric.ActiveSelection ? target : fabricCanvas.getActiveObject();
|
|
13242
13242
|
if (!(active instanceof fabric.ActiveSelection)) return;
|
|
13243
|
+
try {
|
|
13244
|
+
const canvasWithTransform = fabricCanvas;
|
|
13245
|
+
const ct = canvasWithTransform._currentTransform;
|
|
13246
|
+
const rawScaleX = Number(active.scaleX ?? 1) || 1;
|
|
13247
|
+
const rawScaleY = Number(active.scaleY ?? 1) || 1;
|
|
13248
|
+
const originalScaleX = Number((ct == null ? void 0 : ct.target) === active ? (_a2 = ct == null ? void 0 : ct.original) == null ? void 0 : _a2.scaleX : rawScaleX) || 1;
|
|
13249
|
+
const originalScaleY = Number((ct == null ? void 0 : ct.target) === active ? (_b2 = ct == null ? void 0 : ct.original) == null ? void 0 : _b2.scaleY : rawScaleY) || 1;
|
|
13250
|
+
const liveDeltaX = Math.abs(rawScaleX / originalScaleX);
|
|
13251
|
+
const liveDeltaY = Math.abs(rawScaleY / originalScaleY);
|
|
13252
|
+
const hasResidualOriginal = Math.abs(Math.abs(originalScaleX) - 1) > 1e-4 || Math.abs(Math.abs(originalScaleY) - 1) > 1e-4;
|
|
13253
|
+
const hasNoLiveDragDelta = Math.abs(liveDeltaX - 1) < 5e-4 && Math.abs(liveDeltaY - 1) < 5e-4;
|
|
13254
|
+
const canBakeResidual = (ct == null ? void 0 : ct.target) === active ? hasResidualOriginal && hasNoLiveDragDelta : Math.abs(Math.abs(rawScaleX) - 1) > 1e-4 || Math.abs(Math.abs(rawScaleY) - 1) > 1e-4;
|
|
13255
|
+
if (canBakeResidual) {
|
|
13256
|
+
const asScaleX = Math.abs((ct == null ? void 0 : ct.target) === active ? originalScaleX : rawScaleX);
|
|
13257
|
+
const asScaleY = Math.abs((ct == null ? void 0 : ct.target) === active ? originalScaleY : rawScaleY);
|
|
13258
|
+
const newW = Math.max(1, (active.width ?? 0) * asScaleX);
|
|
13259
|
+
const newH = Math.max(1, (active.height ?? 0) * asScaleY);
|
|
13260
|
+
active.set({ width: newW, height: newH, scaleX: 1, scaleY: 1 });
|
|
13261
|
+
active.setCoords();
|
|
13262
|
+
if (ct && ct.target === active && ct.original) {
|
|
13263
|
+
ct.original.scaleX = 1;
|
|
13264
|
+
ct.original.scaleY = 1;
|
|
13265
|
+
ct.original.width = newW;
|
|
13266
|
+
ct.original.height = newH;
|
|
13267
|
+
}
|
|
13268
|
+
}
|
|
13269
|
+
} catch {
|
|
13270
|
+
}
|
|
13243
13271
|
if (!activeSelectionMoveStartRef.current || activeSelectionMoveStartRef.current.selection !== active) {
|
|
13244
13272
|
const rect2 = active.getBoundingRect();
|
|
13245
13273
|
activeSelectionMoveStartRef.current = {
|
|
@@ -13250,14 +13278,14 @@ const PageCanvas = forwardRef(
|
|
|
13250
13278
|
}
|
|
13251
13279
|
const groupId = active.__pixldocsGroupSelection;
|
|
13252
13280
|
if (!groupId) return;
|
|
13253
|
-
if (((
|
|
13254
|
-
const pageChildren2 = ((
|
|
13281
|
+
if (((_c2 = groupSelectionTransformStartRef.current) == null ? void 0 : _c2.groupId) === groupId && groupSelectionTransformStartRef.current.selection === active) return;
|
|
13282
|
+
const pageChildren2 = ((_d = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _d.children) ?? [];
|
|
13255
13283
|
const groupNode = findNodeById(pageChildren2, groupId);
|
|
13256
13284
|
if (!groupNode) return;
|
|
13257
13285
|
const groupAbs = getAbsoluteBounds(groupNode, pageChildren2);
|
|
13258
13286
|
const rect = active.getBoundingRect();
|
|
13259
13287
|
const currentTransform = fabricCanvas._currentTransform;
|
|
13260
|
-
const originalSelectionAngle = (currentTransform == null ? void 0 : currentTransform.target) === active && typeof ((
|
|
13288
|
+
const originalSelectionAngle = (currentTransform == null ? void 0 : currentTransform.target) === active && typeof ((_e = currentTransform == null ? void 0 : currentTransform.original) == null ? void 0 : _e.angle) === "number" ? currentTransform.original.angle : active.angle ?? 0;
|
|
13261
13289
|
groupSelectionTransformStartRef.current = {
|
|
13262
13290
|
groupId,
|
|
13263
13291
|
selection: active,
|
|
@@ -14640,14 +14668,15 @@ const PageCanvas = forwardRef(
|
|
|
14640
14668
|
}
|
|
14641
14669
|
const normalizedScaleAngle = ((obj.angle ?? 0) % 360 + 360) % 360;
|
|
14642
14670
|
const isRotatedActiveSelectionCorner = obj instanceof fabric.ActiveSelection && isCornerResizeHandle(corner) && Math.min(normalizedScaleAngle, 360 - normalizedScaleAngle) > 0.5;
|
|
14643
|
-
|
|
14671
|
+
const isRotatedActiveSelectionSide = obj instanceof fabric.ActiveSelection && (corner === "mt" || corner === "mb" || corner === "ml" || corner === "mr") && Math.min(normalizedScaleAngle, 360 - normalizedScaleAngle) > 0.5;
|
|
14672
|
+
if (!isRotatedActiveSelectionCorner && !isRotatedActiveSelectionSide) {
|
|
14644
14673
|
snapDuringScaleCallback(obj, corner);
|
|
14645
14674
|
}
|
|
14646
|
-
const scaleGuides = isRotatedActiveSelectionCorner ? [] : calculateScaleSnapGuidesCallback(obj, corner);
|
|
14675
|
+
const scaleGuides = isRotatedActiveSelectionCorner || isRotatedActiveSelectionSide ? [] : calculateScaleSnapGuidesCallback(obj, corner);
|
|
14647
14676
|
const gridGuidesForScale = [];
|
|
14648
14677
|
try {
|
|
14649
14678
|
const psGrid = projectSettingsRef.current;
|
|
14650
|
-
const canApplyGridSnap = psGrid.snapToGrid && corner && !isRotatedActiveSelectionCorner && !obj.__cropGroup && !obj.__resizeSnapHandler;
|
|
14679
|
+
const canApplyGridSnap = psGrid.snapToGrid && corner && !isRotatedActiveSelectionCorner && !isRotatedActiveSelectionSide && !obj.__cropGroup && !obj.__resizeSnapHandler;
|
|
14651
14680
|
if (canApplyGridSnap) {
|
|
14652
14681
|
const gridX = psGrid.gridSizeX ?? psGrid.gridSize ?? 0;
|
|
14653
14682
|
const gridY = psGrid.gridSizeY ?? psGrid.gridSize ?? 0;
|
|
@@ -25138,9 +25167,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
25138
25167
|
}
|
|
25139
25168
|
return svgString;
|
|
25140
25169
|
}
|
|
25141
|
-
const resolvedPackageVersion = "0.5.
|
|
25170
|
+
const resolvedPackageVersion = "0.5.407";
|
|
25142
25171
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
25143
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
25172
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.407";
|
|
25144
25173
|
const roundParityValue = (value) => {
|
|
25145
25174
|
if (typeof value !== "number") return value;
|
|
25146
25175
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -25954,7 +25983,7 @@ class PixldocsRenderer {
|
|
|
25954
25983
|
await this.waitForCanvasScene(container, cloned, i);
|
|
25955
25984
|
}
|
|
25956
25985
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
25957
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
25986
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DuXVrbKW.js");
|
|
25958
25987
|
const prepared = preparePagesForExport(
|
|
25959
25988
|
cloned.pages,
|
|
25960
25989
|
canvasWidth,
|
|
@@ -28274,7 +28303,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
28274
28303
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
28275
28304
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
28276
28305
|
try {
|
|
28277
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
28306
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DuXVrbKW.js");
|
|
28278
28307
|
try {
|
|
28279
28308
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
28280
28309
|
} catch {
|
|
@@ -28674,4 +28703,4 @@ export {
|
|
|
28674
28703
|
buildTeaserBlurFlatKeys as y,
|
|
28675
28704
|
collectFontDescriptorsFromConfig as z
|
|
28676
28705
|
};
|
|
28677
|
-
//# sourceMappingURL=index-
|
|
28706
|
+
//# sourceMappingURL=index-Dxlbnksl.js.map
|