@pixldocs/canvas-renderer 0.5.287 → 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-SOarDnbw.js → index-8DBd7ACA.js} +40 -10
- package/dist/index-8DBd7ACA.js.map +1 -0
- package/dist/{index-B8mo_6bC.cjs → index-p4V6omIL.cjs} +40 -10
- package/dist/index-p4V6omIL.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-PuXmC5oW.cjs → vectorPdfExport-BqZjcl8_.cjs} +4 -4
- package/dist/{vectorPdfExport-PuXmC5oW.cjs.map → vectorPdfExport-BqZjcl8_.cjs.map} +1 -1
- package/dist/{vectorPdfExport-Cdzd1M4c.js → vectorPdfExport-rGdZJ7ux.js} +4 -4
- package/dist/{vectorPdfExport-Cdzd1M4c.js.map → vectorPdfExport-rGdZJ7ux.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-B8mo_6bC.cjs.map +0 -1
- package/dist/index-SOarDnbw.js.map +0 -1
|
@@ -11018,10 +11018,12 @@ const bakeTextboxScaleIntoTypography = (obj, sourceElement) => {
|
|
|
11018
11018
|
const sy = Math.abs(obj.scaleY ?? 1) || 1;
|
|
11019
11019
|
if (Math.abs(sx - 1) < 1e-3 && Math.abs(sy - 1) < 1e-3) return null;
|
|
11020
11020
|
const isUniform = Math.abs(sx - sy) < 0.01;
|
|
11021
|
-
const
|
|
11021
|
+
const isHeightOnly = !isUniform && Math.abs(sx - 1) < 0.01 && Math.abs(sy - 1) > 1e-3;
|
|
11022
|
+
const fontScale = isUniform ? (sx + sy) / 2 : 1;
|
|
11022
11023
|
const effectScale = isUniform ? fontScale : Math.max(1e-3, Math.sqrt(sx * sy));
|
|
11024
|
+
const newWidth = isHeightOnly ? obj.width ?? (sourceElement == null ? void 0 : sourceElement.width) ?? 20 : Math.max(20, (obj.width ?? (sourceElement == null ? void 0 : sourceElement.width) ?? 20) * sx);
|
|
11023
11025
|
const updates = {
|
|
11024
|
-
width:
|
|
11026
|
+
width: newWidth,
|
|
11025
11027
|
scaleX: 1,
|
|
11026
11028
|
scaleY: 1
|
|
11027
11029
|
};
|
|
@@ -11029,6 +11031,10 @@ const bakeTextboxScaleIntoTypography = (obj, sourceElement) => {
|
|
|
11029
11031
|
updates.fontSize = Math.max(1, Number(obj.fontSize || (sourceElement == null ? void 0 : sourceElement.fontSize) || 16) * fontScale);
|
|
11030
11032
|
const minBoxHeight = Number(obj.minBoxHeight ?? (sourceElement == null ? void 0 : sourceElement.minBoxHeight));
|
|
11031
11033
|
if (Number.isFinite(minBoxHeight) && minBoxHeight > 0) updates.minBoxHeight = minBoxHeight * sy;
|
|
11034
|
+
} else if (isHeightOnly) {
|
|
11035
|
+
const baseMinH = Number(obj.minBoxHeight ?? (sourceElement == null ? void 0 : sourceElement.minBoxHeight));
|
|
11036
|
+
const baselineH = Number.isFinite(baseMinH) && baseMinH > 0 ? baseMinH : obj.height ?? (sourceElement == null ? void 0 : sourceElement.height) ?? 0;
|
|
11037
|
+
if (baselineH > 0) updates.minBoxHeight = Math.max(0, baselineH * sy);
|
|
11032
11038
|
}
|
|
11033
11039
|
scaleUpdateNumber(updates, sourceElement ?? void 0, "strokeWidth", effectScale);
|
|
11034
11040
|
scaleUpdateNumber(updates, sourceElement ?? void 0, "textShadowBlur", effectScale);
|
|
@@ -11232,6 +11238,7 @@ const PageCanvas = react.forwardRef(
|
|
|
11232
11238
|
react.useRef(null);
|
|
11233
11239
|
const lastTextEditDimensionsRef = react.useRef(null);
|
|
11234
11240
|
const lastResizeScaleTargetRef = react.useRef(null);
|
|
11241
|
+
const activeSelectionResizeHandleRef = react.useRef(null);
|
|
11235
11242
|
const preserveSelectionAfterTransformIdRef = react.useRef(null);
|
|
11236
11243
|
const groupSelectionTransformStartRef = react.useRef(null);
|
|
11237
11244
|
const activeSelectionMoveStartRef = react.useRef(null);
|
|
@@ -12054,6 +12061,7 @@ const PageCanvas = react.forwardRef(
|
|
|
12054
12061
|
fabricCanvas.on("mouse:down", () => {
|
|
12055
12062
|
groupSelectionTransformStartRef.current = null;
|
|
12056
12063
|
activeSelectionMoveStartRef.current = null;
|
|
12064
|
+
activeSelectionResizeHandleRef.current = null;
|
|
12057
12065
|
const active = fabricCanvas.getActiveObject();
|
|
12058
12066
|
if (active instanceof fabric__namespace.ActiveSelection) {
|
|
12059
12067
|
const rect = active.getBoundingRect();
|
|
@@ -13520,6 +13528,9 @@ const PageCanvas = react.forwardRef(
|
|
|
13520
13528
|
}
|
|
13521
13529
|
const transform = e.transform;
|
|
13522
13530
|
const corner = (transform == null ? void 0 : transform.corner) || "";
|
|
13531
|
+
if (obj instanceof fabric__namespace.ActiveSelection && corner) {
|
|
13532
|
+
activeSelectionResizeHandleRef.current = corner;
|
|
13533
|
+
}
|
|
13523
13534
|
if (obj instanceof fabric__namespace.ActiveSelection && (corner === "ml" || corner === "mr" || corner === "mt" || corner === "mb")) {
|
|
13524
13535
|
const isXSide = corner === "ml" || corner === "mr";
|
|
13525
13536
|
const sAxis = isXSide ? Math.abs(obj.scaleX ?? 1) : Math.abs(obj.scaleY ?? 1);
|
|
@@ -14142,6 +14153,7 @@ const PageCanvas = react.forwardRef(
|
|
|
14142
14153
|
activeObjects = activeObjects[0].getObjects();
|
|
14143
14154
|
}
|
|
14144
14155
|
const isActiveSelection = activeObj instanceof fabric__namespace.ActiveSelection || activeObjects.length > 1;
|
|
14156
|
+
const activeSelectionResizeHandle = isActiveSelection ? activeSelectionResizeHandleRef.current : null;
|
|
14145
14157
|
if (activeObj instanceof fabric__namespace.ActiveSelection && activeObjects.length > 1) {
|
|
14146
14158
|
const memberIds = activeObjects.map((o) => getObjectId(o)).filter((id) => !!id && id !== "__background__");
|
|
14147
14159
|
if (memberIds.length > 1) {
|
|
@@ -14474,15 +14486,32 @@ const PageCanvas = react.forwardRef(
|
|
|
14474
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)) {
|
|
14475
14487
|
const sx = Math.abs(decomposed.scaleX || 1);
|
|
14476
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;
|
|
14477
14493
|
const bakedWidth = Math.max(20, intrinsicWidth * sx);
|
|
14478
|
-
const
|
|
14479
|
-
|
|
14480
|
-
|
|
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 };
|
|
14481
14497
|
finalScaleX = 1;
|
|
14482
14498
|
finalScaleY = 1;
|
|
14483
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
|
+
}
|
|
14484
14510
|
obj.set({ width: bakedWidth, scaleX: 1, scaleY: 1 });
|
|
14485
14511
|
obj.initDimensions();
|
|
14512
|
+
finalWidth = bakedWidth;
|
|
14513
|
+
finalHeight = Math.max(1, obj.height ?? intrinsicHeight * sy);
|
|
14514
|
+
obj.__pixldocsBakedTextScaleUpdates = bakedTextScaleUpdates;
|
|
14486
14515
|
obj.setCoords();
|
|
14487
14516
|
} catch {
|
|
14488
14517
|
}
|
|
@@ -14626,6 +14655,7 @@ const PageCanvas = react.forwardRef(
|
|
|
14626
14655
|
}
|
|
14627
14656
|
groupSelectionTransformStartRef.current = null;
|
|
14628
14657
|
activeSelectionMoveStartRef.current = null;
|
|
14658
|
+
activeSelectionResizeHandleRef.current = null;
|
|
14629
14659
|
setTimeout(() => modifiedIdsThisRound.forEach((id) => justModifiedIdsRef.current.delete(id)), 150);
|
|
14630
14660
|
commitHistory();
|
|
14631
14661
|
unlockEditsSoon();
|
|
@@ -23637,9 +23667,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
23637
23667
|
}
|
|
23638
23668
|
return svgString;
|
|
23639
23669
|
}
|
|
23640
|
-
const resolvedPackageVersion = "0.5.
|
|
23670
|
+
const resolvedPackageVersion = "0.5.289";
|
|
23641
23671
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
23642
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
23672
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.289";
|
|
23643
23673
|
const roundParityValue = (value) => {
|
|
23644
23674
|
if (typeof value !== "number") return value;
|
|
23645
23675
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -24453,7 +24483,7 @@ class PixldocsRenderer {
|
|
|
24453
24483
|
await this.waitForCanvasScene(container, cloned, i);
|
|
24454
24484
|
}
|
|
24455
24485
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
24456
|
-
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
24486
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-BqZjcl8_.cjs"));
|
|
24457
24487
|
const prepared = preparePagesForExport(
|
|
24458
24488
|
cloned.pages,
|
|
24459
24489
|
canvasWidth,
|
|
@@ -26773,7 +26803,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
26773
26803
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
26774
26804
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
26775
26805
|
try {
|
|
26776
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
26806
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-BqZjcl8_.cjs"));
|
|
26777
26807
|
try {
|
|
26778
26808
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
26779
26809
|
} catch {
|
|
@@ -27170,4 +27200,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
27170
27200
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
27171
27201
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
27172
27202
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
27173
|
-
//# sourceMappingURL=index-
|
|
27203
|
+
//# sourceMappingURL=index-p4V6omIL.cjs.map
|