@pixldocs/canvas-renderer 0.5.377 → 0.5.379
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-iKxOfMVS.js → index-DQaiAXYK.js} +57 -17
- package/dist/index-DQaiAXYK.js.map +1 -0
- package/dist/{index-DFJKBhgU.cjs → index-D_l8rDHU.cjs} +57 -17
- package/dist/index-D_l8rDHU.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-DvH_Vhmg.cjs → vectorPdfExport-C1UzGCn0.cjs} +4 -4
- package/dist/{vectorPdfExport-DvH_Vhmg.cjs.map → vectorPdfExport-C1UzGCn0.cjs.map} +1 -1
- package/dist/{vectorPdfExport-B8ZK-SIt.js → vectorPdfExport-CzLwUclq.js} +4 -4
- package/dist/{vectorPdfExport-B8ZK-SIt.js.map → vectorPdfExport-CzLwUclq.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-DFJKBhgU.cjs.map +0 -1
- package/dist/index-iKxOfMVS.js.map +0 -1
|
@@ -10818,6 +10818,28 @@ try {
|
|
|
10818
10818
|
if (atLeftRight && atTopBottom) return `${y < 0 ? "t" : "b"}${x < 0 ? "l" : "r"}`;
|
|
10819
10819
|
return null;
|
|
10820
10820
|
};
|
|
10821
|
+
const isRotateControl = (control, controlKey) => {
|
|
10822
|
+
const actionName = String((control == null ? void 0 : control.actionName) ?? "");
|
|
10823
|
+
return controlKey === "mtr" || actionName === "rotate" || Math.abs(Number((control == null ? void 0 : control.x) ?? 0)) < 1e-3 && Math.abs(Number((control == null ? void 0 : control.y) ?? 0) + 0.5) < 1e-3 && Number((control == null ? void 0 : control.offsetY) ?? 0) < 0;
|
|
10824
|
+
};
|
|
10825
|
+
const resolveCanvaControlCursor = (fabricObject, controlKey, control) => {
|
|
10826
|
+
if (!fabricObject) return null;
|
|
10827
|
+
const key = typeof controlKey === "string" ? controlKey : null;
|
|
10828
|
+
const resolvedControl = control ?? (key && (fabricObject == null ? void 0 : fabricObject.controls) ? fabricObject.controls[key] : null);
|
|
10829
|
+
if (isRotateControl(resolvedControl, key)) return getRotateCursor(fabricObject);
|
|
10830
|
+
const resizeKey = key && baseAngleFor[key] !== void 0 ? key : inferControlKey(resolvedControl);
|
|
10831
|
+
return resizeKey && baseAngleFor[resizeKey] !== void 0 ? getRotatedCursor(resizeKey, fabricObject) : null;
|
|
10832
|
+
};
|
|
10833
|
+
const resolveCanvasControlCursor = (canvasLike, target) => {
|
|
10834
|
+
var _a2, _b2, _c2, _d, _e, _f;
|
|
10835
|
+
const transform = canvasLike == null ? void 0 : canvasLike._currentTransform;
|
|
10836
|
+
const fabricObject = target ?? (transform == null ? void 0 : transform.target) ?? ((_a2 = canvasLike == null ? void 0 : canvasLike.getActiveObject) == null ? void 0 : _a2.call(canvasLike));
|
|
10837
|
+
if (!fabricObject) return null;
|
|
10838
|
+
const key = typeof (transform == null ? void 0 : transform.corner) === "string" ? transform.corner : typeof fabricObject.__corner === "string" ? fabricObject.__corner : (_c2 = (_b2 = fabricObject.getActiveControl) == null ? void 0 : _b2.call(fabricObject)) == null ? void 0 : _c2.key;
|
|
10839
|
+
if (!key) return null;
|
|
10840
|
+
const control = ((_d = fabricObject.controls) == null ? void 0 : _d[key]) ?? ((_f = (_e = fabricObject.getActiveControl) == null ? void 0 : _e.call(fabricObject)) == null ? void 0 : _f.control);
|
|
10841
|
+
return resolveCanvaControlCursor(fabricObject, key, control);
|
|
10842
|
+
};
|
|
10821
10843
|
const installPillRenders = (controls) => {
|
|
10822
10844
|
var _a2;
|
|
10823
10845
|
const MOVE_PATHS_2D = [
|
|
@@ -11002,13 +11024,14 @@ try {
|
|
|
11002
11024
|
};
|
|
11003
11025
|
ControlProto.__pixldocsCanvaRenderFallback = true;
|
|
11004
11026
|
}
|
|
11005
|
-
if (ControlProto &&
|
|
11006
|
-
const originalCursorHandler = ControlProto.cursorStyleHandler;
|
|
11027
|
+
if (ControlProto && ControlProto.__pixldocsCanvaCursorFallbackVersion !== 2) {
|
|
11028
|
+
const originalCursorHandler = ControlProto.__pixldocsOriginalCursorStyleHandler ?? ControlProto.cursorStyleHandler;
|
|
11029
|
+
ControlProto.__pixldocsOriginalCursorStyleHandler = originalCursorHandler;
|
|
11007
11030
|
ControlProto.cursorStyleHandler = function(eventData, control, fabricObject) {
|
|
11008
|
-
const
|
|
11009
|
-
const
|
|
11010
|
-
|
|
11011
|
-
|
|
11031
|
+
const activeCorner = typeof (fabricObject == null ? void 0 : fabricObject.__corner) === "string" ? fabricObject.__corner : null;
|
|
11032
|
+
const key = activeCorner ?? inferControlKey(this) ?? inferControlKey(control);
|
|
11033
|
+
const cursor = resolveCanvaControlCursor(fabricObject, key, this ?? control);
|
|
11034
|
+
if (cursor) {
|
|
11012
11035
|
try {
|
|
11013
11036
|
const canvas = fabricObject == null ? void 0 : fabricObject.canvas;
|
|
11014
11037
|
if (canvas) canvas.__pixldocsGetRotateCursor = getRotateCursor;
|
|
@@ -11018,16 +11041,13 @@ try {
|
|
|
11018
11041
|
}
|
|
11019
11042
|
return cursor;
|
|
11020
11043
|
}
|
|
11021
|
-
const key = inferControlKey(this);
|
|
11022
|
-
if (key && baseAngleFor[key] !== void 0) {
|
|
11023
|
-
return getRotatedCursor(key, fabricObject);
|
|
11024
|
-
}
|
|
11025
11044
|
if (typeof originalCursorHandler === "function") {
|
|
11026
11045
|
return originalCursorHandler.call(this, eventData, control, fabricObject);
|
|
11027
11046
|
}
|
|
11028
11047
|
return this.cursorStyle || "default";
|
|
11029
11048
|
};
|
|
11030
11049
|
ControlProto.__pixldocsCanvaCursorFallback = true;
|
|
11050
|
+
ControlProto.__pixldocsCanvaCursorFallbackVersion = 2;
|
|
11031
11051
|
}
|
|
11032
11052
|
ensureCanvaControlRenders = (obj) => {
|
|
11033
11053
|
try {
|
|
@@ -11062,12 +11082,31 @@ try {
|
|
|
11062
11082
|
wrapClassCreateControls(fabric.ActiveSelection);
|
|
11063
11083
|
wrapClassCreateControls(fabric.Group);
|
|
11064
11084
|
const CanvasProto = (_c = fabric.Canvas) == null ? void 0 : _c.prototype;
|
|
11065
|
-
if (CanvasProto && typeof CanvasProto.
|
|
11066
|
-
const
|
|
11085
|
+
if (CanvasProto && CanvasProto.__pixldocsCanvaSetCursorVersion !== 1 && typeof CanvasProto.setCursor === "function") {
|
|
11086
|
+
const origSetCursor = CanvasProto.__pixldocsOriginalSetCursor ?? CanvasProto.setCursor;
|
|
11087
|
+
CanvasProto.__pixldocsOriginalSetCursor = origSetCursor;
|
|
11088
|
+
CanvasProto.setCursor = function(value) {
|
|
11089
|
+
const cursor = resolveCanvasControlCursor(this);
|
|
11090
|
+
return origSetCursor.call(this, cursor || value);
|
|
11091
|
+
};
|
|
11092
|
+
CanvasProto.__pixldocsCanvaSetCursorVersion = 1;
|
|
11093
|
+
}
|
|
11094
|
+
if (CanvasProto && typeof CanvasProto._setCursorFromEvent === "function" && CanvasProto.__pixldocsCanvaCursorEventVersion !== 2) {
|
|
11095
|
+
const origSet = CanvasProto.__pixldocsOriginalSetCursorFromEvent ?? CanvasProto._setCursorFromEvent;
|
|
11096
|
+
CanvasProto.__pixldocsOriginalSetCursorFromEvent = origSet;
|
|
11067
11097
|
CanvasProto._setCursorFromEvent = function(e, target) {
|
|
11068
11098
|
const prev = target && target.__corner;
|
|
11069
11099
|
const res = origSet.call(this, e, target);
|
|
11070
11100
|
const next = target && target.__corner;
|
|
11101
|
+
try {
|
|
11102
|
+
const control = next && (target == null ? void 0 : target.controls) ? target.controls[next] : null;
|
|
11103
|
+
const cursor = resolveCanvaControlCursor(target, typeof next === "string" ? next : null, control);
|
|
11104
|
+
if (cursor) {
|
|
11105
|
+
if (typeof this.setCursor === "function") this.setCursor(cursor);
|
|
11106
|
+
else if (this.upperCanvasEl) this.upperCanvasEl.style.cursor = cursor;
|
|
11107
|
+
}
|
|
11108
|
+
} catch {
|
|
11109
|
+
}
|
|
11071
11110
|
if (prev !== next) {
|
|
11072
11111
|
try {
|
|
11073
11112
|
this.requestRenderAll();
|
|
@@ -11076,6 +11115,7 @@ try {
|
|
|
11076
11115
|
}
|
|
11077
11116
|
return res;
|
|
11078
11117
|
};
|
|
11118
|
+
CanvasProto.__pixldocsCanvaCursorEventVersion = 2;
|
|
11079
11119
|
}
|
|
11080
11120
|
}
|
|
11081
11121
|
} catch (e) {
|
|
@@ -24750,9 +24790,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
24750
24790
|
}
|
|
24751
24791
|
return svgString;
|
|
24752
24792
|
}
|
|
24753
|
-
const resolvedPackageVersion = "0.5.
|
|
24793
|
+
const resolvedPackageVersion = "0.5.379";
|
|
24754
24794
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
24755
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
24795
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.379";
|
|
24756
24796
|
const roundParityValue = (value) => {
|
|
24757
24797
|
if (typeof value !== "number") return value;
|
|
24758
24798
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -25566,7 +25606,7 @@ class PixldocsRenderer {
|
|
|
25566
25606
|
await this.waitForCanvasScene(container, cloned, i);
|
|
25567
25607
|
}
|
|
25568
25608
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
25569
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
25609
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CzLwUclq.js");
|
|
25570
25610
|
const prepared = preparePagesForExport(
|
|
25571
25611
|
cloned.pages,
|
|
25572
25612
|
canvasWidth,
|
|
@@ -27886,7 +27926,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
27886
27926
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
27887
27927
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
27888
27928
|
try {
|
|
27889
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
27929
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CzLwUclq.js");
|
|
27890
27930
|
try {
|
|
27891
27931
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
27892
27932
|
} catch {
|
|
@@ -28286,4 +28326,4 @@ export {
|
|
|
28286
28326
|
buildTeaserBlurFlatKeys as y,
|
|
28287
28327
|
collectFontDescriptorsFromConfig as z
|
|
28288
28328
|
};
|
|
28289
|
-
//# sourceMappingURL=index-
|
|
28329
|
+
//# sourceMappingURL=index-DQaiAXYK.js.map
|