@pixldocs/canvas-renderer 0.5.288 → 0.5.289
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-Dc3vuyOU.js → index-8DBd7ACA.js} +32 -8
- package/dist/index-8DBd7ACA.js.map +1 -0
- package/dist/{index-BJkc3Hss.cjs → index-p4V6omIL.cjs} +32 -8
- package/dist/index-p4V6omIL.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-DUVeRe5f.cjs → vectorPdfExport-BqZjcl8_.cjs} +4 -4
- package/dist/{vectorPdfExport-DUVeRe5f.cjs.map → vectorPdfExport-BqZjcl8_.cjs.map} +1 -1
- package/dist/{vectorPdfExport-BeBLRc4B.js → vectorPdfExport-rGdZJ7ux.js} +4 -4
- package/dist/{vectorPdfExport-BeBLRc4B.js.map → vectorPdfExport-rGdZJ7ux.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-BJkc3Hss.cjs.map +0 -1
- package/dist/index-Dc3vuyOU.js.map +0 -1
|
@@ -11238,6 +11238,7 @@ const PageCanvas = react.forwardRef(
|
|
|
11238
11238
|
react.useRef(null);
|
|
11239
11239
|
const lastTextEditDimensionsRef = react.useRef(null);
|
|
11240
11240
|
const lastResizeScaleTargetRef = react.useRef(null);
|
|
11241
|
+
const activeSelectionResizeHandleRef = react.useRef(null);
|
|
11241
11242
|
const preserveSelectionAfterTransformIdRef = react.useRef(null);
|
|
11242
11243
|
const groupSelectionTransformStartRef = react.useRef(null);
|
|
11243
11244
|
const activeSelectionMoveStartRef = react.useRef(null);
|
|
@@ -12060,6 +12061,7 @@ const PageCanvas = react.forwardRef(
|
|
|
12060
12061
|
fabricCanvas.on("mouse:down", () => {
|
|
12061
12062
|
groupSelectionTransformStartRef.current = null;
|
|
12062
12063
|
activeSelectionMoveStartRef.current = null;
|
|
12064
|
+
activeSelectionResizeHandleRef.current = null;
|
|
12063
12065
|
const active = fabricCanvas.getActiveObject();
|
|
12064
12066
|
if (active instanceof fabric__namespace.ActiveSelection) {
|
|
12065
12067
|
const rect = active.getBoundingRect();
|
|
@@ -13526,6 +13528,9 @@ const PageCanvas = react.forwardRef(
|
|
|
13526
13528
|
}
|
|
13527
13529
|
const transform = e.transform;
|
|
13528
13530
|
const corner = (transform == null ? void 0 : transform.corner) || "";
|
|
13531
|
+
if (obj instanceof fabric__namespace.ActiveSelection && corner) {
|
|
13532
|
+
activeSelectionResizeHandleRef.current = corner;
|
|
13533
|
+
}
|
|
13529
13534
|
if (obj instanceof fabric__namespace.ActiveSelection && (corner === "ml" || corner === "mr" || corner === "mt" || corner === "mb")) {
|
|
13530
13535
|
const isXSide = corner === "ml" || corner === "mr";
|
|
13531
13536
|
const sAxis = isXSide ? Math.abs(obj.scaleX ?? 1) : Math.abs(obj.scaleY ?? 1);
|
|
@@ -14148,6 +14153,7 @@ const PageCanvas = react.forwardRef(
|
|
|
14148
14153
|
activeObjects = activeObjects[0].getObjects();
|
|
14149
14154
|
}
|
|
14150
14155
|
const isActiveSelection = activeObj instanceof fabric__namespace.ActiveSelection || activeObjects.length > 1;
|
|
14156
|
+
const activeSelectionResizeHandle = isActiveSelection ? activeSelectionResizeHandleRef.current : null;
|
|
14151
14157
|
if (activeObj instanceof fabric__namespace.ActiveSelection && activeObjects.length > 1) {
|
|
14152
14158
|
const memberIds = activeObjects.map((o) => getObjectId(o)).filter((id) => !!id && id !== "__background__");
|
|
14153
14159
|
if (memberIds.length > 1) {
|
|
@@ -14480,15 +14486,32 @@ const PageCanvas = react.forwardRef(
|
|
|
14480
14486
|
} else if (obj instanceof fabric__namespace.Textbox && isActiveSelection && (Math.abs((decomposed.scaleX ?? 1) - 1) > 1e-3 || Math.abs((decomposed.scaleY ?? 1) - 1) > 1e-3)) {
|
|
14481
14487
|
const sx = Math.abs(decomposed.scaleX || 1);
|
|
14482
14488
|
const sy = Math.abs(decomposed.scaleY || 1);
|
|
14489
|
+
const isLikelyUniformCorner = !activeSelectionResizeHandle && Math.abs(sx - sy) < 0.01 && Math.abs(sx - 1) > 1e-3;
|
|
14490
|
+
const isCornerHandle = activeSelectionResizeHandle === "tl" || activeSelectionResizeHandle === "tr" || activeSelectionResizeHandle === "bl" || activeSelectionResizeHandle === "br" || isLikelyUniformCorner;
|
|
14491
|
+
const isHeightSideHandle = activeSelectionResizeHandle === "mt" || activeSelectionResizeHandle === "mb";
|
|
14492
|
+
const fontScale = isCornerHandle ? Math.max(1e-3, Math.sqrt(sx * sy)) : 1;
|
|
14483
14493
|
const bakedWidth = Math.max(20, intrinsicWidth * sx);
|
|
14484
|
-
const
|
|
14485
|
-
|
|
14486
|
-
|
|
14494
|
+
const baseMinH = Number(obj.minBoxHeight ?? (sourceElement == null ? void 0 : sourceElement.minBoxHeight));
|
|
14495
|
+
const nextMinH = Number.isFinite(baseMinH) && baseMinH > 0 ? baseMinH * sy : isHeightSideHandle ? Math.max(1, intrinsicHeight * sy) : void 0;
|
|
14496
|
+
const bakedTextScaleUpdates = { width: bakedWidth };
|
|
14487
14497
|
finalScaleX = 1;
|
|
14488
14498
|
finalScaleY = 1;
|
|
14489
14499
|
try {
|
|
14500
|
+
if (isCornerHandle) {
|
|
14501
|
+
const baseFontSize = Number((sourceElement == null ? void 0 : sourceElement.fontSize) ?? obj.fontSize ?? 16);
|
|
14502
|
+
const nextFontSize = Math.max(1, baseFontSize * fontScale);
|
|
14503
|
+
bakedTextScaleUpdates.fontSize = nextFontSize;
|
|
14504
|
+
obj.set({ fontSize: nextFontSize });
|
|
14505
|
+
}
|
|
14506
|
+
if (nextMinH !== void 0) {
|
|
14507
|
+
bakedTextScaleUpdates.minBoxHeight = Math.max(0, nextMinH);
|
|
14508
|
+
obj.minBoxHeight = bakedTextScaleUpdates.minBoxHeight;
|
|
14509
|
+
}
|
|
14490
14510
|
obj.set({ width: bakedWidth, scaleX: 1, scaleY: 1 });
|
|
14491
14511
|
obj.initDimensions();
|
|
14512
|
+
finalWidth = bakedWidth;
|
|
14513
|
+
finalHeight = Math.max(1, obj.height ?? intrinsicHeight * sy);
|
|
14514
|
+
obj.__pixldocsBakedTextScaleUpdates = bakedTextScaleUpdates;
|
|
14492
14515
|
obj.setCoords();
|
|
14493
14516
|
} catch {
|
|
14494
14517
|
}
|
|
@@ -14632,6 +14655,7 @@ const PageCanvas = react.forwardRef(
|
|
|
14632
14655
|
}
|
|
14633
14656
|
groupSelectionTransformStartRef.current = null;
|
|
14634
14657
|
activeSelectionMoveStartRef.current = null;
|
|
14658
|
+
activeSelectionResizeHandleRef.current = null;
|
|
14635
14659
|
setTimeout(() => modifiedIdsThisRound.forEach((id) => justModifiedIdsRef.current.delete(id)), 150);
|
|
14636
14660
|
commitHistory();
|
|
14637
14661
|
unlockEditsSoon();
|
|
@@ -23643,9 +23667,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
23643
23667
|
}
|
|
23644
23668
|
return svgString;
|
|
23645
23669
|
}
|
|
23646
|
-
const resolvedPackageVersion = "0.5.
|
|
23670
|
+
const resolvedPackageVersion = "0.5.289";
|
|
23647
23671
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
23648
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
23672
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.289";
|
|
23649
23673
|
const roundParityValue = (value) => {
|
|
23650
23674
|
if (typeof value !== "number") return value;
|
|
23651
23675
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -24459,7 +24483,7 @@ class PixldocsRenderer {
|
|
|
24459
24483
|
await this.waitForCanvasScene(container, cloned, i);
|
|
24460
24484
|
}
|
|
24461
24485
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
24462
|
-
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
24486
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-BqZjcl8_.cjs"));
|
|
24463
24487
|
const prepared = preparePagesForExport(
|
|
24464
24488
|
cloned.pages,
|
|
24465
24489
|
canvasWidth,
|
|
@@ -26779,7 +26803,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
26779
26803
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
26780
26804
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
26781
26805
|
try {
|
|
26782
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
26806
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-BqZjcl8_.cjs"));
|
|
26783
26807
|
try {
|
|
26784
26808
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
26785
26809
|
} catch {
|
|
@@ -27176,4 +27200,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
27176
27200
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
27177
27201
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
27178
27202
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
27179
|
-
//# sourceMappingURL=index-
|
|
27203
|
+
//# sourceMappingURL=index-p4V6omIL.cjs.map
|