@pixldocs/canvas-renderer 0.5.288 → 0.5.290
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-B6JMRs-J.js} +39 -9
- package/dist/index-B6JMRs-J.js.map +1 -0
- package/dist/{index-BJkc3Hss.cjs → index-CFmJlPUO.cjs} +39 -9
- package/dist/index-CFmJlPUO.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-BeBLRc4B.js → vectorPdfExport-BW4Ihi3j.js} +4 -4
- package/dist/{vectorPdfExport-BeBLRc4B.js.map → vectorPdfExport-BW4Ihi3j.js.map} +1 -1
- package/dist/{vectorPdfExport-DUVeRe5f.cjs → vectorPdfExport-CPqt8-Dd.cjs} +4 -4
- package/dist/{vectorPdfExport-DUVeRe5f.cjs.map → vectorPdfExport-CPqt8-Dd.cjs.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,38 @@ 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 {
|
|
14490
|
-
obj.
|
|
14500
|
+
const preBakeCenter = obj.getCenterPoint();
|
|
14501
|
+
if (isCornerHandle) {
|
|
14502
|
+
const baseFontSize = Number((sourceElement == null ? void 0 : sourceElement.fontSize) ?? obj.fontSize ?? 16);
|
|
14503
|
+
const nextFontSize = Math.max(1, baseFontSize * fontScale);
|
|
14504
|
+
bakedTextScaleUpdates.fontSize = nextFontSize;
|
|
14505
|
+
obj.set({ fontSize: nextFontSize });
|
|
14506
|
+
}
|
|
14507
|
+
if (nextMinH !== void 0) {
|
|
14508
|
+
bakedTextScaleUpdates.minBoxHeight = Math.max(0, nextMinH);
|
|
14509
|
+
obj.minBoxHeight = bakedTextScaleUpdates.minBoxHeight;
|
|
14510
|
+
}
|
|
14511
|
+
const prevObjCaching = obj.objectCaching;
|
|
14512
|
+
obj.set({ width: bakedWidth, scaleX: 1, scaleY: 1, objectCaching: false });
|
|
14491
14513
|
obj.initDimensions();
|
|
14514
|
+
obj.setPositionByOrigin(preBakeCenter, "center", "center");
|
|
14515
|
+
obj.objectCaching = prevObjCaching;
|
|
14516
|
+
obj.dirty = true;
|
|
14517
|
+
if (activeObj) activeObj.dirty = true;
|
|
14518
|
+
finalWidth = bakedWidth;
|
|
14519
|
+
finalHeight = Math.max(1, obj.height ?? intrinsicHeight * sy);
|
|
14520
|
+
obj.__pixldocsBakedTextScaleUpdates = bakedTextScaleUpdates;
|
|
14492
14521
|
obj.setCoords();
|
|
14493
14522
|
} catch {
|
|
14494
14523
|
}
|
|
@@ -14632,6 +14661,7 @@ const PageCanvas = react.forwardRef(
|
|
|
14632
14661
|
}
|
|
14633
14662
|
groupSelectionTransformStartRef.current = null;
|
|
14634
14663
|
activeSelectionMoveStartRef.current = null;
|
|
14664
|
+
activeSelectionResizeHandleRef.current = null;
|
|
14635
14665
|
setTimeout(() => modifiedIdsThisRound.forEach((id) => justModifiedIdsRef.current.delete(id)), 150);
|
|
14636
14666
|
commitHistory();
|
|
14637
14667
|
unlockEditsSoon();
|
|
@@ -23643,9 +23673,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
23643
23673
|
}
|
|
23644
23674
|
return svgString;
|
|
23645
23675
|
}
|
|
23646
|
-
const resolvedPackageVersion = "0.5.
|
|
23676
|
+
const resolvedPackageVersion = "0.5.290";
|
|
23647
23677
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
23648
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
23678
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.290";
|
|
23649
23679
|
const roundParityValue = (value) => {
|
|
23650
23680
|
if (typeof value !== "number") return value;
|
|
23651
23681
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -24459,7 +24489,7 @@ class PixldocsRenderer {
|
|
|
24459
24489
|
await this.waitForCanvasScene(container, cloned, i);
|
|
24460
24490
|
}
|
|
24461
24491
|
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-
|
|
24492
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-CPqt8-Dd.cjs"));
|
|
24463
24493
|
const prepared = preparePagesForExport(
|
|
24464
24494
|
cloned.pages,
|
|
24465
24495
|
canvasWidth,
|
|
@@ -26779,7 +26809,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
26779
26809
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
26780
26810
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
26781
26811
|
try {
|
|
26782
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
26812
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-CPqt8-Dd.cjs"));
|
|
26783
26813
|
try {
|
|
26784
26814
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
26785
26815
|
} catch {
|
|
@@ -27176,4 +27206,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
27176
27206
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
27177
27207
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
27178
27208
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
27179
|
-
//# sourceMappingURL=index-
|
|
27209
|
+
//# sourceMappingURL=index-CFmJlPUO.cjs.map
|