@pixldocs/canvas-renderer 0.5.292 → 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-CgvNkm0U.js → index-CRNg3m2o.js} +131 -7
- package/dist/index-CRNg3m2o.js.map +1 -0
- package/dist/{index-BnsuaZL0.cjs → index-CvP_zeI7.cjs} +131 -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-Q0sI218Z.cjs → vectorPdfExport-B089WLSf.cjs} +4 -4
- package/dist/{vectorPdfExport-Q0sI218Z.cjs.map → vectorPdfExport-B089WLSf.cjs.map} +1 -1
- package/dist/{vectorPdfExport-DS6A8tQu.js → vectorPdfExport-BtxsxKxp.js} +4 -4
- package/dist/{vectorPdfExport-DS6A8tQu.js.map → vectorPdfExport-BtxsxKxp.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-BnsuaZL0.cjs.map +0 -1
- package/dist/index-CgvNkm0U.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 {
|
|
@@ -14531,6 +14596,36 @@ const PageCanvas = forwardRef(
|
|
|
14531
14596
|
skewX: 0,
|
|
14532
14597
|
skewY: 0
|
|
14533
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
|
+
}
|
|
14534
14629
|
} else if (preserveCornerGeometry) {
|
|
14535
14630
|
const scaledW = Math.max(1, intrinsicWidth * Math.abs(decomposed.scaleX || 1));
|
|
14536
14631
|
const scaledH = Math.max(1, intrinsicHeight * Math.abs(decomposed.scaleY || 1));
|
|
@@ -14594,6 +14689,15 @@ const PageCanvas = forwardRef(
|
|
|
14594
14689
|
if (sourceElement && sourceElement.opacity !== void 0) {
|
|
14595
14690
|
elementUpdate.opacity = sourceElement.opacity;
|
|
14596
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
|
+
}
|
|
14597
14701
|
updateElement(objId, elementUpdate, { recordHistory: false, skipLayoutRecalc: true });
|
|
14598
14702
|
obj.setCoords();
|
|
14599
14703
|
}
|
|
@@ -14614,6 +14718,16 @@ const PageCanvas = forwardRef(
|
|
|
14614
14718
|
const oid = getObjectId(o);
|
|
14615
14719
|
return !!oid && oid !== "__background__";
|
|
14616
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
|
+
}
|
|
14617
14731
|
const prevRenderOnAddRemove = fabricCanvas.renderOnAddRemove;
|
|
14618
14732
|
fabricCanvas.renderOnAddRemove = false;
|
|
14619
14733
|
skipSelectionClearOnDiscardRef.current = true;
|
|
@@ -14647,6 +14761,16 @@ const PageCanvas = forwardRef(
|
|
|
14647
14761
|
if (wasGroupSel) restoreGroupSelectionVisualState(newSel, wasGroupSel);
|
|
14648
14762
|
fabricCanvas.setActiveObject(newSel);
|
|
14649
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
|
+
}
|
|
14650
14774
|
} else if (membersToReselect.length === 1) {
|
|
14651
14775
|
fabricCanvas.setActiveObject(membersToReselect[0]);
|
|
14652
14776
|
}
|
|
@@ -23677,9 +23801,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
23677
23801
|
}
|
|
23678
23802
|
return svgString;
|
|
23679
23803
|
}
|
|
23680
|
-
const resolvedPackageVersion = "0.5.
|
|
23804
|
+
const resolvedPackageVersion = "0.5.293";
|
|
23681
23805
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
23682
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
23806
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.293";
|
|
23683
23807
|
const roundParityValue = (value) => {
|
|
23684
23808
|
if (typeof value !== "number") return value;
|
|
23685
23809
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -24493,7 +24617,7 @@ class PixldocsRenderer {
|
|
|
24493
24617
|
await this.waitForCanvasScene(container, cloned, i);
|
|
24494
24618
|
}
|
|
24495
24619
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
24496
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
24620
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-BtxsxKxp.js");
|
|
24497
24621
|
const prepared = preparePagesForExport(
|
|
24498
24622
|
cloned.pages,
|
|
24499
24623
|
canvasWidth,
|
|
@@ -26813,7 +26937,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
26813
26937
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
26814
26938
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
26815
26939
|
try {
|
|
26816
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
26940
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-BtxsxKxp.js");
|
|
26817
26941
|
try {
|
|
26818
26942
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
26819
26943
|
} catch {
|
|
@@ -27213,4 +27337,4 @@ export {
|
|
|
27213
27337
|
buildTeaserBlurFlatKeys as y,
|
|
27214
27338
|
collectFontDescriptorsFromConfig as z
|
|
27215
27339
|
};
|
|
27216
|
-
//# sourceMappingURL=index-
|
|
27340
|
+
//# sourceMappingURL=index-CRNg3m2o.js.map
|