@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
|
@@ -11000,10 +11000,12 @@ const bakeTextboxScaleIntoTypography = (obj, sourceElement) => {
|
|
|
11000
11000
|
const sy = Math.abs(obj.scaleY ?? 1) || 1;
|
|
11001
11001
|
if (Math.abs(sx - 1) < 1e-3 && Math.abs(sy - 1) < 1e-3) return null;
|
|
11002
11002
|
const isUniform = Math.abs(sx - sy) < 0.01;
|
|
11003
|
-
const
|
|
11003
|
+
const isHeightOnly = !isUniform && Math.abs(sx - 1) < 0.01 && Math.abs(sy - 1) > 1e-3;
|
|
11004
|
+
const fontScale = isUniform ? (sx + sy) / 2 : 1;
|
|
11004
11005
|
const effectScale = isUniform ? fontScale : Math.max(1e-3, Math.sqrt(sx * sy));
|
|
11006
|
+
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);
|
|
11005
11007
|
const updates = {
|
|
11006
|
-
width:
|
|
11008
|
+
width: newWidth,
|
|
11007
11009
|
scaleX: 1,
|
|
11008
11010
|
scaleY: 1
|
|
11009
11011
|
};
|
|
@@ -11011,6 +11013,10 @@ const bakeTextboxScaleIntoTypography = (obj, sourceElement) => {
|
|
|
11011
11013
|
updates.fontSize = Math.max(1, Number(obj.fontSize || (sourceElement == null ? void 0 : sourceElement.fontSize) || 16) * fontScale);
|
|
11012
11014
|
const minBoxHeight = Number(obj.minBoxHeight ?? (sourceElement == null ? void 0 : sourceElement.minBoxHeight));
|
|
11013
11015
|
if (Number.isFinite(minBoxHeight) && minBoxHeight > 0) updates.minBoxHeight = minBoxHeight * sy;
|
|
11016
|
+
} else if (isHeightOnly) {
|
|
11017
|
+
const baseMinH = Number(obj.minBoxHeight ?? (sourceElement == null ? void 0 : sourceElement.minBoxHeight));
|
|
11018
|
+
const baselineH = Number.isFinite(baseMinH) && baseMinH > 0 ? baseMinH : obj.height ?? (sourceElement == null ? void 0 : sourceElement.height) ?? 0;
|
|
11019
|
+
if (baselineH > 0) updates.minBoxHeight = Math.max(0, baselineH * sy);
|
|
11014
11020
|
}
|
|
11015
11021
|
scaleUpdateNumber(updates, sourceElement ?? void 0, "strokeWidth", effectScale);
|
|
11016
11022
|
scaleUpdateNumber(updates, sourceElement ?? void 0, "textShadowBlur", effectScale);
|
|
@@ -11214,6 +11220,7 @@ const PageCanvas = forwardRef(
|
|
|
11214
11220
|
useRef(null);
|
|
11215
11221
|
const lastTextEditDimensionsRef = useRef(null);
|
|
11216
11222
|
const lastResizeScaleTargetRef = useRef(null);
|
|
11223
|
+
const activeSelectionResizeHandleRef = useRef(null);
|
|
11217
11224
|
const preserveSelectionAfterTransformIdRef = useRef(null);
|
|
11218
11225
|
const groupSelectionTransformStartRef = useRef(null);
|
|
11219
11226
|
const activeSelectionMoveStartRef = useRef(null);
|
|
@@ -12036,6 +12043,7 @@ const PageCanvas = forwardRef(
|
|
|
12036
12043
|
fabricCanvas.on("mouse:down", () => {
|
|
12037
12044
|
groupSelectionTransformStartRef.current = null;
|
|
12038
12045
|
activeSelectionMoveStartRef.current = null;
|
|
12046
|
+
activeSelectionResizeHandleRef.current = null;
|
|
12039
12047
|
const active = fabricCanvas.getActiveObject();
|
|
12040
12048
|
if (active instanceof fabric.ActiveSelection) {
|
|
12041
12049
|
const rect = active.getBoundingRect();
|
|
@@ -13502,6 +13510,9 @@ const PageCanvas = forwardRef(
|
|
|
13502
13510
|
}
|
|
13503
13511
|
const transform = e.transform;
|
|
13504
13512
|
const corner = (transform == null ? void 0 : transform.corner) || "";
|
|
13513
|
+
if (obj instanceof fabric.ActiveSelection && corner) {
|
|
13514
|
+
activeSelectionResizeHandleRef.current = corner;
|
|
13515
|
+
}
|
|
13505
13516
|
if (obj instanceof fabric.ActiveSelection && (corner === "ml" || corner === "mr" || corner === "mt" || corner === "mb")) {
|
|
13506
13517
|
const isXSide = corner === "ml" || corner === "mr";
|
|
13507
13518
|
const sAxis = isXSide ? Math.abs(obj.scaleX ?? 1) : Math.abs(obj.scaleY ?? 1);
|
|
@@ -14124,6 +14135,7 @@ const PageCanvas = forwardRef(
|
|
|
14124
14135
|
activeObjects = activeObjects[0].getObjects();
|
|
14125
14136
|
}
|
|
14126
14137
|
const isActiveSelection = activeObj instanceof fabric.ActiveSelection || activeObjects.length > 1;
|
|
14138
|
+
const activeSelectionResizeHandle = isActiveSelection ? activeSelectionResizeHandleRef.current : null;
|
|
14127
14139
|
if (activeObj instanceof fabric.ActiveSelection && activeObjects.length > 1) {
|
|
14128
14140
|
const memberIds = activeObjects.map((o) => getObjectId(o)).filter((id) => !!id && id !== "__background__");
|
|
14129
14141
|
if (memberIds.length > 1) {
|
|
@@ -14456,15 +14468,32 @@ const PageCanvas = forwardRef(
|
|
|
14456
14468
|
} else if (obj instanceof fabric.Textbox && isActiveSelection && (Math.abs((decomposed.scaleX ?? 1) - 1) > 1e-3 || Math.abs((decomposed.scaleY ?? 1) - 1) > 1e-3)) {
|
|
14457
14469
|
const sx = Math.abs(decomposed.scaleX || 1);
|
|
14458
14470
|
const sy = Math.abs(decomposed.scaleY || 1);
|
|
14471
|
+
const isLikelyUniformCorner = !activeSelectionResizeHandle && Math.abs(sx - sy) < 0.01 && Math.abs(sx - 1) > 1e-3;
|
|
14472
|
+
const isCornerHandle = activeSelectionResizeHandle === "tl" || activeSelectionResizeHandle === "tr" || activeSelectionResizeHandle === "bl" || activeSelectionResizeHandle === "br" || isLikelyUniformCorner;
|
|
14473
|
+
const isHeightSideHandle = activeSelectionResizeHandle === "mt" || activeSelectionResizeHandle === "mb";
|
|
14474
|
+
const fontScale = isCornerHandle ? Math.max(1e-3, Math.sqrt(sx * sy)) : 1;
|
|
14459
14475
|
const bakedWidth = Math.max(20, intrinsicWidth * sx);
|
|
14460
|
-
const
|
|
14461
|
-
|
|
14462
|
-
|
|
14476
|
+
const baseMinH = Number(obj.minBoxHeight ?? (sourceElement == null ? void 0 : sourceElement.minBoxHeight));
|
|
14477
|
+
const nextMinH = Number.isFinite(baseMinH) && baseMinH > 0 ? baseMinH * sy : isHeightSideHandle ? Math.max(1, intrinsicHeight * sy) : void 0;
|
|
14478
|
+
const bakedTextScaleUpdates = { width: bakedWidth };
|
|
14463
14479
|
finalScaleX = 1;
|
|
14464
14480
|
finalScaleY = 1;
|
|
14465
14481
|
try {
|
|
14482
|
+
if (isCornerHandle) {
|
|
14483
|
+
const baseFontSize = Number((sourceElement == null ? void 0 : sourceElement.fontSize) ?? obj.fontSize ?? 16);
|
|
14484
|
+
const nextFontSize = Math.max(1, baseFontSize * fontScale);
|
|
14485
|
+
bakedTextScaleUpdates.fontSize = nextFontSize;
|
|
14486
|
+
obj.set({ fontSize: nextFontSize });
|
|
14487
|
+
}
|
|
14488
|
+
if (nextMinH !== void 0) {
|
|
14489
|
+
bakedTextScaleUpdates.minBoxHeight = Math.max(0, nextMinH);
|
|
14490
|
+
obj.minBoxHeight = bakedTextScaleUpdates.minBoxHeight;
|
|
14491
|
+
}
|
|
14466
14492
|
obj.set({ width: bakedWidth, scaleX: 1, scaleY: 1 });
|
|
14467
14493
|
obj.initDimensions();
|
|
14494
|
+
finalWidth = bakedWidth;
|
|
14495
|
+
finalHeight = Math.max(1, obj.height ?? intrinsicHeight * sy);
|
|
14496
|
+
obj.__pixldocsBakedTextScaleUpdates = bakedTextScaleUpdates;
|
|
14468
14497
|
obj.setCoords();
|
|
14469
14498
|
} catch {
|
|
14470
14499
|
}
|
|
@@ -14608,6 +14637,7 @@ const PageCanvas = forwardRef(
|
|
|
14608
14637
|
}
|
|
14609
14638
|
groupSelectionTransformStartRef.current = null;
|
|
14610
14639
|
activeSelectionMoveStartRef.current = null;
|
|
14640
|
+
activeSelectionResizeHandleRef.current = null;
|
|
14611
14641
|
setTimeout(() => modifiedIdsThisRound.forEach((id) => justModifiedIdsRef.current.delete(id)), 150);
|
|
14612
14642
|
commitHistory();
|
|
14613
14643
|
unlockEditsSoon();
|
|
@@ -23619,9 +23649,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
23619
23649
|
}
|
|
23620
23650
|
return svgString;
|
|
23621
23651
|
}
|
|
23622
|
-
const resolvedPackageVersion = "0.5.
|
|
23652
|
+
const resolvedPackageVersion = "0.5.289";
|
|
23623
23653
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
23624
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
23654
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.289";
|
|
23625
23655
|
const roundParityValue = (value) => {
|
|
23626
23656
|
if (typeof value !== "number") return value;
|
|
23627
23657
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -24435,7 +24465,7 @@ class PixldocsRenderer {
|
|
|
24435
24465
|
await this.waitForCanvasScene(container, cloned, i);
|
|
24436
24466
|
}
|
|
24437
24467
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
24438
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
24468
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-rGdZJ7ux.js");
|
|
24439
24469
|
const prepared = preparePagesForExport(
|
|
24440
24470
|
cloned.pages,
|
|
24441
24471
|
canvasWidth,
|
|
@@ -26755,7 +26785,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
26755
26785
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
26756
26786
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
26757
26787
|
try {
|
|
26758
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
26788
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-rGdZJ7ux.js");
|
|
26759
26789
|
try {
|
|
26760
26790
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
26761
26791
|
} catch {
|
|
@@ -27155,4 +27185,4 @@ export {
|
|
|
27155
27185
|
buildTeaserBlurFlatKeys as y,
|
|
27156
27186
|
collectFontDescriptorsFromConfig as z
|
|
27157
27187
|
};
|
|
27158
|
-
//# sourceMappingURL=index-
|
|
27188
|
+
//# sourceMappingURL=index-8DBd7ACA.js.map
|