@pixldocs/canvas-renderer 0.5.291 → 0.5.293
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-Dhpqd_ZU.js → index-CRNg3m2o.js} +150 -7
- package/dist/index-CRNg3m2o.js.map +1 -0
- package/dist/{index-DUC4YCF2.cjs → index-CvP_zeI7.cjs} +150 -7
- package/dist/index-CvP_zeI7.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-CFg39g3k.cjs → vectorPdfExport-B089WLSf.cjs} +4 -4
- package/dist/{vectorPdfExport-CFg39g3k.cjs.map → vectorPdfExport-B089WLSf.cjs.map} +1 -1
- package/dist/{vectorPdfExport-BNuwZ-JH.js → vectorPdfExport-BtxsxKxp.js} +4 -4
- package/dist/{vectorPdfExport-BNuwZ-JH.js.map → vectorPdfExport-BtxsxKxp.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-DUC4YCF2.cjs.map +0 -1
- package/dist/index-Dhpqd_ZU.js.map +0 -1
|
@@ -10995,6 +10995,46 @@ const scaleUpdateNumber = (updates, source, key, factor) => {
|
|
|
10995
10995
|
const value = Number(source == null ? void 0 : source[key]);
|
|
10996
10996
|
if (Number.isFinite(value)) updates[key] = value * factor;
|
|
10997
10997
|
};
|
|
10998
|
+
const GROUP_TEXT_RESIZE_DEBUG_PREFIX = "[Pixldocs][group-text-corner-resize]";
|
|
10999
|
+
const isCornerResizeHandle = (handle) => handle === "tl" || handle === "tr" || handle === "bl" || handle === "br";
|
|
11000
|
+
const summarizeFabricObjectForResizeDebug = (obj) => {
|
|
11001
|
+
var _a2;
|
|
11002
|
+
if (!obj) return null;
|
|
11003
|
+
try {
|
|
11004
|
+
const rect = obj.getBoundingRect();
|
|
11005
|
+
const center = obj.getCenterPoint();
|
|
11006
|
+
const matrix = obj.calcTransformMatrix();
|
|
11007
|
+
const decomposed = fabric.util.qrDecompose(matrix);
|
|
11008
|
+
return {
|
|
11009
|
+
id: getObjectId(obj),
|
|
11010
|
+
kind: obj instanceof fabric.ActiveSelection ? "ActiveSelection" : obj instanceof fabric.Textbox ? "Textbox" : obj.type ?? ((_a2 = obj.constructor) == null ? void 0 : _a2.name),
|
|
11011
|
+
left: obj.left,
|
|
11012
|
+
top: obj.top,
|
|
11013
|
+
width: obj.width,
|
|
11014
|
+
height: obj.height,
|
|
11015
|
+
scaleX: obj.scaleX,
|
|
11016
|
+
scaleY: obj.scaleY,
|
|
11017
|
+
angle: obj.angle,
|
|
11018
|
+
originX: obj.originX,
|
|
11019
|
+
originY: obj.originY,
|
|
11020
|
+
center: { x: center.x, y: center.y },
|
|
11021
|
+
boundingRect: rect,
|
|
11022
|
+
decomposed
|
|
11023
|
+
};
|
|
11024
|
+
} catch (error) {
|
|
11025
|
+
return { id: getObjectId(obj), error: String(error) };
|
|
11026
|
+
}
|
|
11027
|
+
};
|
|
11028
|
+
const logGroupTextResizeDebug = (phase, payload) => {
|
|
11029
|
+
if (typeof console === "undefined") return;
|
|
11030
|
+
try {
|
|
11031
|
+
console.groupCollapsed(`${GROUP_TEXT_RESIZE_DEBUG_PREFIX} ${phase}`);
|
|
11032
|
+
console.log(payload);
|
|
11033
|
+
console.groupEnd();
|
|
11034
|
+
} catch {
|
|
11035
|
+
console.log(GROUP_TEXT_RESIZE_DEBUG_PREFIX, phase, payload);
|
|
11036
|
+
}
|
|
11037
|
+
};
|
|
10998
11038
|
const bakeTextboxScaleIntoTypography = (obj, sourceElement) => {
|
|
10999
11039
|
const sx = Math.abs(obj.scaleX ?? 1) || 1;
|
|
11000
11040
|
const sy = Math.abs(obj.scaleY ?? 1) || 1;
|
|
@@ -13350,7 +13390,7 @@ const PageCanvas = forwardRef(
|
|
|
13350
13390
|
fabricCanvas.on("selection:cleared", () => {
|
|
13351
13391
|
});
|
|
13352
13392
|
fabricCanvas.on("object:scaling", (e) => {
|
|
13353
|
-
var _a2;
|
|
13393
|
+
var _a2, _b2;
|
|
13354
13394
|
if (!isActiveRef.current) return;
|
|
13355
13395
|
const t = e.target;
|
|
13356
13396
|
if (t) lastResizeScaleTargetRef.current = t;
|
|
@@ -13512,6 +13552,16 @@ const PageCanvas = forwardRef(
|
|
|
13512
13552
|
const corner = (transform == null ? void 0 : transform.corner) || "";
|
|
13513
13553
|
if (obj instanceof fabric.ActiveSelection && corner) {
|
|
13514
13554
|
activeSelectionResizeHandleRef.current = corner;
|
|
13555
|
+
if (isCornerResizeHandle(corner) && obj.getObjects().some((child) => child instanceof fabric.Textbox)) {
|
|
13556
|
+
obj.__pixldocsLastGroupTextScaleDebug = {
|
|
13557
|
+
time: Math.round(performance.now()),
|
|
13558
|
+
corner,
|
|
13559
|
+
groupSelectionId: obj.__pixldocsGroupSelection,
|
|
13560
|
+
currentTransformAction: (_a2 = fabricCanvas._currentTransform) == null ? void 0 : _a2.action,
|
|
13561
|
+
selection: summarizeFabricObjectForResizeDebug(obj),
|
|
13562
|
+
textChildren: obj.getObjects().filter((child) => child instanceof fabric.Textbox).map((child) => summarizeFabricObjectForResizeDebug(child))
|
|
13563
|
+
};
|
|
13564
|
+
}
|
|
13515
13565
|
}
|
|
13516
13566
|
if (obj instanceof fabric.ActiveSelection && (corner === "ml" || corner === "mr" || corner === "mt" || corner === "mb")) {
|
|
13517
13567
|
const isXSide = corner === "ml" || corner === "mr";
|
|
@@ -13674,7 +13724,7 @@ const PageCanvas = forwardRef(
|
|
|
13674
13724
|
setGuides(gridGuidesForScale.length ? [...scaleGuides, ...gridGuidesForScale] : scaleGuides);
|
|
13675
13725
|
if (drilledGroupIdRef.current) {
|
|
13676
13726
|
try {
|
|
13677
|
-
(
|
|
13727
|
+
(_b2 = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _b2.call(fabricCanvas);
|
|
13678
13728
|
} catch {
|
|
13679
13729
|
}
|
|
13680
13730
|
}
|
|
@@ -14136,6 +14186,20 @@ const PageCanvas = forwardRef(
|
|
|
14136
14186
|
}
|
|
14137
14187
|
const isActiveSelection = activeObj instanceof fabric.ActiveSelection || activeObjects.length > 1;
|
|
14138
14188
|
const activeSelectionResizeHandle = isActiveSelection ? activeSelectionResizeHandleRef.current : null;
|
|
14189
|
+
const debugGroupTextCornerResize = activeObj instanceof fabric.ActiveSelection && isCornerResizeHandle(activeSelectionResizeHandle) && activeObjects.some((candidate) => candidate instanceof fabric.Textbox);
|
|
14190
|
+
if (debugGroupTextCornerResize) {
|
|
14191
|
+
logGroupTextResizeDebug("modified-start", {
|
|
14192
|
+
time: Math.round(performance.now()),
|
|
14193
|
+
handle: activeSelectionResizeHandle,
|
|
14194
|
+
target: summarizeFabricObjectForResizeDebug(modifiedTarget),
|
|
14195
|
+
selection: summarizeFabricObjectForResizeDebug(activeObj),
|
|
14196
|
+
activeObjectCount: activeObjects.length,
|
|
14197
|
+
activeObjectIds: activeObjects.map((candidate) => getObjectId(candidate)),
|
|
14198
|
+
selectedStoreIds: useEditorStore.getState().canvas.selectedIds,
|
|
14199
|
+
transformStart: groupSelectionTransformStartRef.current,
|
|
14200
|
+
lastScalingFrame: activeObj.__pixldocsLastGroupTextScaleDebug
|
|
14201
|
+
});
|
|
14202
|
+
}
|
|
14139
14203
|
if (activeObj instanceof fabric.ActiveSelection && activeObjects.length > 1) {
|
|
14140
14204
|
const memberIds = activeObjects.map((o) => getObjectId(o)).filter((id) => !!id && id !== "__background__");
|
|
14141
14205
|
if (memberIds.length > 1) {
|
|
@@ -14476,6 +14540,7 @@ const PageCanvas = forwardRef(
|
|
|
14476
14540
|
const baseMinH = Number(obj.minBoxHeight ?? (sourceElement == null ? void 0 : sourceElement.minBoxHeight));
|
|
14477
14541
|
const nextMinH = Number.isFinite(baseMinH) && baseMinH > 0 ? baseMinH * sy : isHeightSideHandle ? Math.max(1, intrinsicHeight * sy) : void 0;
|
|
14478
14542
|
const bakedTextScaleUpdates = { width: bakedWidth };
|
|
14543
|
+
const debugTextBeforeBake = debugGroupTextCornerResize ? summarizeFabricObjectForResizeDebug(obj) : null;
|
|
14479
14544
|
finalScaleX = 1;
|
|
14480
14545
|
finalScaleY = 1;
|
|
14481
14546
|
try {
|
|
@@ -14503,6 +14568,25 @@ const PageCanvas = forwardRef(
|
|
|
14503
14568
|
obj.setCoords();
|
|
14504
14569
|
} catch {
|
|
14505
14570
|
}
|
|
14571
|
+
try {
|
|
14572
|
+
const angleRad = (decomposed.angle ?? 0) * Math.PI / 180;
|
|
14573
|
+
const cos = Math.cos(angleRad);
|
|
14574
|
+
const sin = Math.sin(angleRad);
|
|
14575
|
+
const hw = finalWidth / 2;
|
|
14576
|
+
const hh = finalHeight / 2;
|
|
14577
|
+
const corners = [
|
|
14578
|
+
{ x: -hw, y: -hh },
|
|
14579
|
+
{ x: hw, y: -hh },
|
|
14580
|
+
{ x: hw, y: hh },
|
|
14581
|
+
{ x: -hw, y: hh }
|
|
14582
|
+
].map((p) => ({
|
|
14583
|
+
x: decomposed.translateX + p.x * cos - p.y * sin,
|
|
14584
|
+
y: decomposed.translateY + p.x * sin + p.y * cos
|
|
14585
|
+
}));
|
|
14586
|
+
absoluteLeft = Math.min(...corners.map((p) => p.x));
|
|
14587
|
+
absoluteTop = Math.min(...corners.map((p) => p.y));
|
|
14588
|
+
} catch {
|
|
14589
|
+
}
|
|
14506
14590
|
finalAbsoluteMatrix = fabric.util.composeMatrix({
|
|
14507
14591
|
translateX: decomposed.translateX,
|
|
14508
14592
|
translateY: decomposed.translateY,
|
|
@@ -14512,6 +14596,36 @@ const PageCanvas = forwardRef(
|
|
|
14512
14596
|
skewX: 0,
|
|
14513
14597
|
skewY: 0
|
|
14514
14598
|
});
|
|
14599
|
+
if (debugGroupTextCornerResize) {
|
|
14600
|
+
logGroupTextResizeDebug("text-bake", {
|
|
14601
|
+
time: Math.round(performance.now()),
|
|
14602
|
+
handle: activeSelectionResizeHandle,
|
|
14603
|
+
textId: objId,
|
|
14604
|
+
source: sourceElement ? {
|
|
14605
|
+
left: sourceElement.left,
|
|
14606
|
+
top: sourceElement.top,
|
|
14607
|
+
width: sourceElement.width,
|
|
14608
|
+
height: sourceElement.height,
|
|
14609
|
+
fontSize: sourceElement.fontSize,
|
|
14610
|
+
scaleX: sourceElement.scaleX,
|
|
14611
|
+
scaleY: sourceElement.scaleY
|
|
14612
|
+
} : null,
|
|
14613
|
+
factors: { sx, sy, fontScale, isCornerHandle, isHeightSideHandle },
|
|
14614
|
+
beforeBake: debugTextBeforeBake,
|
|
14615
|
+
afterBake: summarizeFabricObjectForResizeDebug(obj),
|
|
14616
|
+
persistedGeometry: {
|
|
14617
|
+
absoluteLeft,
|
|
14618
|
+
absoluteTop,
|
|
14619
|
+
finalWidth,
|
|
14620
|
+
finalHeight,
|
|
14621
|
+
finalScaleX,
|
|
14622
|
+
finalScaleY,
|
|
14623
|
+
decomposed,
|
|
14624
|
+
finalAbsoluteMatrix,
|
|
14625
|
+
bakedTextScaleUpdates
|
|
14626
|
+
}
|
|
14627
|
+
});
|
|
14628
|
+
}
|
|
14515
14629
|
} else if (preserveCornerGeometry) {
|
|
14516
14630
|
const scaledW = Math.max(1, intrinsicWidth * Math.abs(decomposed.scaleX || 1));
|
|
14517
14631
|
const scaledH = Math.max(1, intrinsicHeight * Math.abs(decomposed.scaleY || 1));
|
|
@@ -14575,6 +14689,15 @@ const PageCanvas = forwardRef(
|
|
|
14575
14689
|
if (sourceElement && sourceElement.opacity !== void 0) {
|
|
14576
14690
|
elementUpdate.opacity = sourceElement.opacity;
|
|
14577
14691
|
}
|
|
14692
|
+
if (debugGroupTextCornerResize && obj instanceof fabric.Textbox) {
|
|
14693
|
+
logGroupTextResizeDebug("store-update-text", {
|
|
14694
|
+
time: Math.round(performance.now()),
|
|
14695
|
+
handle: activeSelectionResizeHandle,
|
|
14696
|
+
textId: objId,
|
|
14697
|
+
elementUpdate,
|
|
14698
|
+
objectBeforeStoreWrite: summarizeFabricObjectForResizeDebug(obj)
|
|
14699
|
+
});
|
|
14700
|
+
}
|
|
14578
14701
|
updateElement(objId, elementUpdate, { recordHistory: false, skipLayoutRecalc: true });
|
|
14579
14702
|
obj.setCoords();
|
|
14580
14703
|
}
|
|
@@ -14595,6 +14718,16 @@ const PageCanvas = forwardRef(
|
|
|
14595
14718
|
const oid = getObjectId(o);
|
|
14596
14719
|
return !!oid && oid !== "__background__";
|
|
14597
14720
|
});
|
|
14721
|
+
if (debugGroupTextCornerResize) {
|
|
14722
|
+
logGroupTextResizeDebug("before-reselect", {
|
|
14723
|
+
time: Math.round(performance.now()),
|
|
14724
|
+
handle: activeSelectionResizeHandle,
|
|
14725
|
+
wasGroupSel,
|
|
14726
|
+
selection: summarizeFabricObjectForResizeDebug(activeObj),
|
|
14727
|
+
members: membersToReselect.map((member) => summarizeFabricObjectForResizeDebug(member)),
|
|
14728
|
+
renderOnAddRemove: fabricCanvas.renderOnAddRemove
|
|
14729
|
+
});
|
|
14730
|
+
}
|
|
14598
14731
|
const prevRenderOnAddRemove = fabricCanvas.renderOnAddRemove;
|
|
14599
14732
|
fabricCanvas.renderOnAddRemove = false;
|
|
14600
14733
|
skipSelectionClearOnDiscardRef.current = true;
|
|
@@ -14628,6 +14761,16 @@ const PageCanvas = forwardRef(
|
|
|
14628
14761
|
if (wasGroupSel) restoreGroupSelectionVisualState(newSel, wasGroupSel);
|
|
14629
14762
|
fabricCanvas.setActiveObject(newSel);
|
|
14630
14763
|
newSel.setCoords();
|
|
14764
|
+
if (debugGroupTextCornerResize) {
|
|
14765
|
+
logGroupTextResizeDebug("after-reselect", {
|
|
14766
|
+
time: Math.round(performance.now()),
|
|
14767
|
+
handle: activeSelectionResizeHandle,
|
|
14768
|
+
wasGroupSel,
|
|
14769
|
+
selection: summarizeFabricObjectForResizeDebug(newSel),
|
|
14770
|
+
members: membersToReselect.map((member) => summarizeFabricObjectForResizeDebug(member)),
|
|
14771
|
+
renderOnAddRemove: fabricCanvas.renderOnAddRemove
|
|
14772
|
+
});
|
|
14773
|
+
}
|
|
14631
14774
|
} else if (membersToReselect.length === 1) {
|
|
14632
14775
|
fabricCanvas.setActiveObject(membersToReselect[0]);
|
|
14633
14776
|
}
|
|
@@ -23658,9 +23801,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
23658
23801
|
}
|
|
23659
23802
|
return svgString;
|
|
23660
23803
|
}
|
|
23661
|
-
const resolvedPackageVersion = "0.5.
|
|
23804
|
+
const resolvedPackageVersion = "0.5.293";
|
|
23662
23805
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
23663
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
23806
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.293";
|
|
23664
23807
|
const roundParityValue = (value) => {
|
|
23665
23808
|
if (typeof value !== "number") return value;
|
|
23666
23809
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -24474,7 +24617,7 @@ class PixldocsRenderer {
|
|
|
24474
24617
|
await this.waitForCanvasScene(container, cloned, i);
|
|
24475
24618
|
}
|
|
24476
24619
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
24477
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
24620
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-BtxsxKxp.js");
|
|
24478
24621
|
const prepared = preparePagesForExport(
|
|
24479
24622
|
cloned.pages,
|
|
24480
24623
|
canvasWidth,
|
|
@@ -26794,7 +26937,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
26794
26937
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
26795
26938
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
26796
26939
|
try {
|
|
26797
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
26940
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-BtxsxKxp.js");
|
|
26798
26941
|
try {
|
|
26799
26942
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
26800
26943
|
} catch {
|
|
@@ -27194,4 +27337,4 @@ export {
|
|
|
27194
27337
|
buildTeaserBlurFlatKeys as y,
|
|
27195
27338
|
collectFontDescriptorsFromConfig as z
|
|
27196
27339
|
};
|
|
27197
|
-
//# sourceMappingURL=index-
|
|
27340
|
+
//# sourceMappingURL=index-CRNg3m2o.js.map
|