@pixldocs/canvas-renderer 0.5.352 → 0.5.354
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-BBwoWejC.cjs → index-BUYWcO1C.cjs} +63 -28
- package/dist/index-BUYWcO1C.cjs.map +1 -0
- package/dist/{index-CJLS3Ey3.js → index-yEgXeiie.js} +63 -28
- package/dist/index-yEgXeiie.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-DyD0q_mD.js → vectorPdfExport-B54V1hcn.js} +4 -4
- package/dist/{vectorPdfExport-DyD0q_mD.js.map → vectorPdfExport-B54V1hcn.js.map} +1 -1
- package/dist/{vectorPdfExport-DssfP9Fv.cjs → vectorPdfExport-DnoKFr-R.cjs} +4 -4
- package/dist/{vectorPdfExport-DssfP9Fv.cjs.map → vectorPdfExport-DnoKFr-R.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/index-BBwoWejC.cjs.map +0 -1
- package/dist/index-CJLS3Ey3.js.map +0 -1
|
@@ -13294,6 +13294,30 @@ const PageCanvas = forwardRef(
|
|
|
13294
13294
|
});
|
|
13295
13295
|
};
|
|
13296
13296
|
fabricCanvas.__updateDrilledGroupOutline = updateDrilledGroupOutline;
|
|
13297
|
+
const isPointerOnSelectionControl = (selection, event) => {
|
|
13298
|
+
var _a2;
|
|
13299
|
+
try {
|
|
13300
|
+
selection.setCoords();
|
|
13301
|
+
const controls = selection.oCoords ?? ((_a2 = selection.calcOCoords) == null ? void 0 : _a2.call(selection));
|
|
13302
|
+
const el = fabricCanvas.upperCanvasEl ?? fabricCanvas.lowerCanvasEl;
|
|
13303
|
+
const rect = el == null ? void 0 : el.getBoundingClientRect();
|
|
13304
|
+
if (!controls || !rect || !event) return false;
|
|
13305
|
+
const x = Number(event.clientX) - rect.left;
|
|
13306
|
+
const y = Number(event.clientY) - rect.top;
|
|
13307
|
+
return Object.values(controls).some((control) => {
|
|
13308
|
+
const pts = (control == null ? void 0 : control.touchCorner) ?? (control == null ? void 0 : control.corner);
|
|
13309
|
+
const corners = pts ? Object.values(pts) : [];
|
|
13310
|
+
if (!corners.length) return false;
|
|
13311
|
+
const minX = Math.min(...corners.map((p) => p.x)) - 2;
|
|
13312
|
+
const maxX = Math.max(...corners.map((p) => p.x)) + 2;
|
|
13313
|
+
const minY = Math.min(...corners.map((p) => p.y)) - 2;
|
|
13314
|
+
const maxY = Math.max(...corners.map((p) => p.y)) + 2;
|
|
13315
|
+
return x >= minX && x <= maxX && y >= minY && y <= maxY;
|
|
13316
|
+
});
|
|
13317
|
+
} catch {
|
|
13318
|
+
return false;
|
|
13319
|
+
}
|
|
13320
|
+
};
|
|
13297
13321
|
fabricCanvas.on("mouse:down:before", (opt) => {
|
|
13298
13322
|
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
13299
13323
|
const activeBeforeMouseDown = fabricCanvas.getActiveObject();
|
|
@@ -13317,7 +13341,8 @@ const PageCanvas = forwardRef(
|
|
|
13317
13341
|
}
|
|
13318
13342
|
let target = opt.target;
|
|
13319
13343
|
let targetId = target ? getObjectId(target) : null;
|
|
13320
|
-
|
|
13344
|
+
const pointerOnActiveSelectionControl = activeBeforeMouseDown instanceof fabric.ActiveSelection ? isPointerOnSelectionControl(activeBeforeMouseDown, opt.e) : false;
|
|
13345
|
+
if (target instanceof fabric.ActiveSelection && target.__pixldocsGroupSelection && target === fabricCanvas.getActiveObject() && !target.__corner && !pointerOnActiveSelectionControl) {
|
|
13321
13346
|
const child = pickChildInActiveSelectionAtPointer(target, opt.e);
|
|
13322
13347
|
const childId = child ? getObjectId(child) : null;
|
|
13323
13348
|
if (child && childId) {
|
|
@@ -13366,7 +13391,7 @@ const PageCanvas = forwardRef(
|
|
|
13366
13391
|
let effectiveTargetId = targetId;
|
|
13367
13392
|
const activeNowEarly = fabricCanvas.getActiveObject();
|
|
13368
13393
|
const asGroupId = target instanceof fabric.ActiveSelection ? target.__pixldocsGroupSelection : void 0;
|
|
13369
|
-
if (target instanceof fabric.ActiveSelection && asGroupId && target === activeNowEarly) {
|
|
13394
|
+
if (target instanceof fabric.ActiveSelection && asGroupId && target === activeNowEarly && !target.__corner && !pointerOnActiveSelectionControl) {
|
|
13370
13395
|
const child = pickChildInActiveSelectionAtPointer(target, opt.e);
|
|
13371
13396
|
const childId = child ? getObjectId(child) : null;
|
|
13372
13397
|
if (child && childId) {
|
|
@@ -14169,6 +14194,10 @@ const PageCanvas = forwardRef(
|
|
|
14169
14194
|
if (child.__asLiveOrigH == null) {
|
|
14170
14195
|
child.__asLiveOrigH = (child.height ?? 0) * (child.scaleY ?? 1);
|
|
14171
14196
|
}
|
|
14197
|
+
if (child.__asLiveOrigMinH == null) {
|
|
14198
|
+
const m = Number(child.minBoxHeight);
|
|
14199
|
+
if (Number.isFinite(m) && m > 0) child.__asLiveOrigMinH = m;
|
|
14200
|
+
}
|
|
14172
14201
|
const origH = child.__asLiveOrigH;
|
|
14173
14202
|
const newH = Math.max(20, origH * sAxis);
|
|
14174
14203
|
child.minBoxHeight = newH;
|
|
@@ -14456,6 +14485,7 @@ const PageCanvas = forwardRef(
|
|
|
14456
14485
|
});
|
|
14457
14486
|
fabricCanvas.on("object:rotating", (e) => {
|
|
14458
14487
|
var _a2, _b2;
|
|
14488
|
+
prepareGroupSelectionTransformStart(e.target);
|
|
14459
14489
|
markSimpleTransform(e);
|
|
14460
14490
|
didTransformRef.current = true;
|
|
14461
14491
|
const tr = e.target;
|
|
@@ -14624,16 +14654,6 @@ const PageCanvas = forwardRef(
|
|
|
14624
14654
|
unlockEditsSoon();
|
|
14625
14655
|
return;
|
|
14626
14656
|
}
|
|
14627
|
-
try {
|
|
14628
|
-
const t = e.target;
|
|
14629
|
-
if (t instanceof fabric.ActiveSelection) {
|
|
14630
|
-
for (const child of t.getObjects()) {
|
|
14631
|
-
delete child.__asLiveOrigW;
|
|
14632
|
-
delete child.__asLiveOrigH;
|
|
14633
|
-
}
|
|
14634
|
-
}
|
|
14635
|
-
} catch {
|
|
14636
|
-
}
|
|
14637
14657
|
groupShiftReflowSnapshotRef.current = null;
|
|
14638
14658
|
lockEdits();
|
|
14639
14659
|
const modifiedTargetId = modifiedTarget ? getObjectId(modifiedTarget) : null;
|
|
@@ -15461,16 +15481,27 @@ const PageCanvas = forwardRef(
|
|
|
15461
15481
|
finalSkewY = (sourceElement == null ? void 0 : sourceElement.skewY) ?? obj.skewY ?? 0;
|
|
15462
15482
|
if ((sourceElement == null ? void 0 : sourceElement.angle) !== void 0 || obj.angle !== void 0) finalAngleFromDecomposed = false;
|
|
15463
15483
|
}
|
|
15464
|
-
} else if (obj instanceof fabric.Textbox && isActiveSelection && (Math.abs((decomposed.scaleX ?? 1) - 1) > 1e-3 || Math.abs((decomposed.scaleY ?? 1) - 1) > 1e-3)) {
|
|
15465
|
-
const
|
|
15466
|
-
const
|
|
15484
|
+
} else if (obj instanceof fabric.Textbox && isActiveSelection && (activeSelectionResizeHandle != null || obj.__asLiveOrigW != null || obj.__asLiveOrigH != null || Math.abs((decomposed.scaleX ?? 1) - 1) > 1e-3 || Math.abs((decomposed.scaleY ?? 1) - 1) > 1e-3)) {
|
|
15485
|
+
const liveOrigW = obj.__asLiveOrigW;
|
|
15486
|
+
const liveOrigH = obj.__asLiveOrigH;
|
|
15487
|
+
const decSx = Math.abs(decomposed.scaleX || 1);
|
|
15488
|
+
const decSy = Math.abs(decomposed.scaleY || 1);
|
|
15489
|
+
const sx = Math.abs(decSx - 1) < 1e-3 && liveOrigW && liveOrigW > 0 ? Math.max(1e-3, (obj.width ?? liveOrigW) / liveOrigW) : decSx;
|
|
15490
|
+
const baseHForRecover = Number(
|
|
15491
|
+
obj.minBoxHeight ?? obj.height ?? liveOrigH ?? 1
|
|
15492
|
+
);
|
|
15493
|
+
const sy = Math.abs(decSy - 1) < 1e-3 && liveOrigH && liveOrigH > 0 ? Math.max(1e-3, baseHForRecover / liveOrigH) : decSy;
|
|
15467
15494
|
const isLikelyUniformCorner = !activeSelectionResizeHandle && Math.abs(sx - sy) < 0.01 && Math.abs(sx - 1) > 1e-3;
|
|
15468
15495
|
const isCornerHandle = activeSelectionResizeHandle === "tl" || activeSelectionResizeHandle === "tr" || activeSelectionResizeHandle === "bl" || activeSelectionResizeHandle === "br" || isLikelyUniformCorner;
|
|
15469
15496
|
const isHeightSideHandle = activeSelectionResizeHandle === "mt" || activeSelectionResizeHandle === "mb";
|
|
15470
15497
|
const fontScale = isCornerHandle ? Math.max(1e-3, Math.sqrt(sx * sy)) : 1;
|
|
15471
|
-
const
|
|
15472
|
-
const
|
|
15473
|
-
const
|
|
15498
|
+
const widthBase = liveOrigW && liveOrigW > 0 ? liveOrigW : intrinsicWidth;
|
|
15499
|
+
const heightBase = liveOrigH && liveOrigH > 0 ? liveOrigH : intrinsicHeight;
|
|
15500
|
+
const bakedWidth = Math.max(20, widthBase * sx);
|
|
15501
|
+
const liveMinHOrig = obj.__asLiveOrigMinH;
|
|
15502
|
+
const currentMinH = Number(obj.minBoxHeight ?? (sourceElement == null ? void 0 : sourceElement.minBoxHeight));
|
|
15503
|
+
const minHBase = Number.isFinite(liveMinHOrig) && liveMinHOrig > 0 ? liveMinHOrig : liveOrigH && liveOrigH > 0 ? currentMinH / sy : currentMinH;
|
|
15504
|
+
const nextMinH = Number.isFinite(minHBase) && minHBase > 0 ? minHBase * sy : isHeightSideHandle ? Math.max(1, heightBase * sy) : void 0;
|
|
15474
15505
|
const bakedTextScaleUpdates = { width: bakedWidth };
|
|
15475
15506
|
const debugTextBeforeBake = debugGroupTextCornerResize ? summarizeFabricObjectForResizeDebug(obj) : null;
|
|
15476
15507
|
finalScaleX = 1;
|
|
@@ -15694,6 +15725,9 @@ const PageCanvas = forwardRef(
|
|
|
15694
15725
|
}
|
|
15695
15726
|
updateElement(objId, elementUpdate, { recordHistory: false, skipLayoutRecalc: true });
|
|
15696
15727
|
obj.setCoords();
|
|
15728
|
+
delete obj.__asLiveOrigW;
|
|
15729
|
+
delete obj.__asLiveOrigH;
|
|
15730
|
+
delete obj.__asLiveOrigMinH;
|
|
15697
15731
|
}
|
|
15698
15732
|
if (isLogicalGroupAS && logicalGroupSelectionId && activeObj instanceof fabric.ActiveSelection) {
|
|
15699
15733
|
try {
|
|
@@ -17276,6 +17310,7 @@ const PageCanvas = forwardRef(
|
|
|
17276
17310
|
const node = findNodeById(currentPageTree, element.id);
|
|
17277
17311
|
return node && isElement(node) ? getElementFabricPlacement(node, currentPageTree) : { left: element.left ?? 0, top: element.top ?? 0, angle: element.angle ?? 0 };
|
|
17278
17312
|
})() : { left: element.left ?? 0, top: element.top ?? 0, angle: element.angle ?? 0 };
|
|
17313
|
+
const fabricAngle = fabricPos.angle ?? element.angle ?? 0;
|
|
17279
17314
|
const resolvedSize = currentPageTree.length > 0 ? getNodeBounds(element, currentPageTree) : { width: typeof element.width === "number" ? element.width : 200, height: typeof element.height === "number" ? element.height : 50 };
|
|
17280
17315
|
const shouldPreserveSmallSize = typeof element.width === "number" && Number.isFinite(element.width) && element.width > 0 && typeof element.height === "number" && Number.isFinite(element.height) && element.height > 0;
|
|
17281
17316
|
const minVisible = shouldPreserveSmallSize ? 1 : 20;
|
|
@@ -17532,7 +17567,7 @@ const PageCanvas = forwardRef(
|
|
|
17532
17567
|
y1: 0,
|
|
17533
17568
|
x2: lineLen,
|
|
17534
17569
|
y2: 0,
|
|
17535
|
-
angle:
|
|
17570
|
+
angle: fabricAngle,
|
|
17536
17571
|
scaleX: 1,
|
|
17537
17572
|
scaleY: 1,
|
|
17538
17573
|
skewX: 0,
|
|
@@ -17562,7 +17597,7 @@ const PageCanvas = forwardRef(
|
|
|
17562
17597
|
width: rW,
|
|
17563
17598
|
scaleX: effectiveScaleX,
|
|
17564
17599
|
scaleY: effectiveScaleY,
|
|
17565
|
-
angle:
|
|
17600
|
+
angle: fabricAngle,
|
|
17566
17601
|
skewX: element.skewX ?? 0,
|
|
17567
17602
|
skewY: appliedSkewY
|
|
17568
17603
|
});
|
|
@@ -17571,7 +17606,7 @@ const PageCanvas = forwardRef(
|
|
|
17571
17606
|
...posIfNotSkipped,
|
|
17572
17607
|
scaleX: effectiveScaleX,
|
|
17573
17608
|
scaleY: effectiveScaleY,
|
|
17574
|
-
angle:
|
|
17609
|
+
angle: fabricAngle,
|
|
17575
17610
|
skewX: element.skewX ?? 0,
|
|
17576
17611
|
skewY: element.skewY ?? 0
|
|
17577
17612
|
});
|
|
@@ -17582,7 +17617,7 @@ const PageCanvas = forwardRef(
|
|
|
17582
17617
|
obj.set({
|
|
17583
17618
|
...posIfNotSkipped,
|
|
17584
17619
|
width: rW,
|
|
17585
|
-
angle:
|
|
17620
|
+
angle: fabricAngle,
|
|
17586
17621
|
skewX: element.skewX ?? 0,
|
|
17587
17622
|
skewY: appliedSkewY,
|
|
17588
17623
|
scaleX: effectiveScaleX * baseScaleX,
|
|
@@ -17591,7 +17626,7 @@ const PageCanvas = forwardRef(
|
|
|
17591
17626
|
} else {
|
|
17592
17627
|
obj.set({
|
|
17593
17628
|
...posIfNotSkipped,
|
|
17594
|
-
angle:
|
|
17629
|
+
angle: fabricAngle,
|
|
17595
17630
|
skewX: element.skewX ?? 0,
|
|
17596
17631
|
skewY: element.skewY ?? 0,
|
|
17597
17632
|
scaleX: effectiveScaleX * baseScaleX,
|
|
@@ -24852,9 +24887,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
24852
24887
|
}
|
|
24853
24888
|
return svgString;
|
|
24854
24889
|
}
|
|
24855
|
-
const resolvedPackageVersion = "0.5.
|
|
24890
|
+
const resolvedPackageVersion = "0.5.354";
|
|
24856
24891
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
24857
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
24892
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.354";
|
|
24858
24893
|
const roundParityValue = (value) => {
|
|
24859
24894
|
if (typeof value !== "number") return value;
|
|
24860
24895
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -25668,7 +25703,7 @@ class PixldocsRenderer {
|
|
|
25668
25703
|
await this.waitForCanvasScene(container, cloned, i);
|
|
25669
25704
|
}
|
|
25670
25705
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
25671
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
25706
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-B54V1hcn.js");
|
|
25672
25707
|
const prepared = preparePagesForExport(
|
|
25673
25708
|
cloned.pages,
|
|
25674
25709
|
canvasWidth,
|
|
@@ -27988,7 +28023,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
27988
28023
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
27989
28024
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
27990
28025
|
try {
|
|
27991
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
28026
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-B54V1hcn.js");
|
|
27992
28027
|
try {
|
|
27993
28028
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
27994
28029
|
} catch {
|
|
@@ -28388,4 +28423,4 @@ export {
|
|
|
28388
28423
|
buildTeaserBlurFlatKeys as y,
|
|
28389
28424
|
collectFontDescriptorsFromConfig as z
|
|
28390
28425
|
};
|
|
28391
|
-
//# sourceMappingURL=index-
|
|
28426
|
+
//# sourceMappingURL=index-yEgXeiie.js.map
|