@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
|
@@ -10836,6 +10836,28 @@ try {
|
|
|
10836
10836
|
if (atLeftRight && atTopBottom) return `${y < 0 ? "t" : "b"}${x < 0 ? "l" : "r"}`;
|
|
10837
10837
|
return null;
|
|
10838
10838
|
};
|
|
10839
|
+
const isRotateControl = (control, controlKey) => {
|
|
10840
|
+
const actionName = String((control == null ? void 0 : control.actionName) ?? "");
|
|
10841
|
+
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;
|
|
10842
|
+
};
|
|
10843
|
+
const resolveCanvaControlCursor = (fabricObject, controlKey, control) => {
|
|
10844
|
+
if (!fabricObject) return null;
|
|
10845
|
+
const key = typeof controlKey === "string" ? controlKey : null;
|
|
10846
|
+
const resolvedControl = control ?? (key && (fabricObject == null ? void 0 : fabricObject.controls) ? fabricObject.controls[key] : null);
|
|
10847
|
+
if (isRotateControl(resolvedControl, key)) return getRotateCursor(fabricObject);
|
|
10848
|
+
const resizeKey = key && baseAngleFor[key] !== void 0 ? key : inferControlKey(resolvedControl);
|
|
10849
|
+
return resizeKey && baseAngleFor[resizeKey] !== void 0 ? getRotatedCursor(resizeKey, fabricObject) : null;
|
|
10850
|
+
};
|
|
10851
|
+
const resolveCanvasControlCursor = (canvasLike, target) => {
|
|
10852
|
+
var _a2, _b2, _c2, _d, _e, _f;
|
|
10853
|
+
const transform = canvasLike == null ? void 0 : canvasLike._currentTransform;
|
|
10854
|
+
const fabricObject = target ?? (transform == null ? void 0 : transform.target) ?? ((_a2 = canvasLike == null ? void 0 : canvasLike.getActiveObject) == null ? void 0 : _a2.call(canvasLike));
|
|
10855
|
+
if (!fabricObject) return null;
|
|
10856
|
+
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;
|
|
10857
|
+
if (!key) return null;
|
|
10858
|
+
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);
|
|
10859
|
+
return resolveCanvaControlCursor(fabricObject, key, control);
|
|
10860
|
+
};
|
|
10839
10861
|
const installPillRenders = (controls) => {
|
|
10840
10862
|
var _a2;
|
|
10841
10863
|
const MOVE_PATHS_2D = [
|
|
@@ -11020,13 +11042,14 @@ try {
|
|
|
11020
11042
|
};
|
|
11021
11043
|
ControlProto.__pixldocsCanvaRenderFallback = true;
|
|
11022
11044
|
}
|
|
11023
|
-
if (ControlProto &&
|
|
11024
|
-
const originalCursorHandler = ControlProto.cursorStyleHandler;
|
|
11045
|
+
if (ControlProto && ControlProto.__pixldocsCanvaCursorFallbackVersion !== 2) {
|
|
11046
|
+
const originalCursorHandler = ControlProto.__pixldocsOriginalCursorStyleHandler ?? ControlProto.cursorStyleHandler;
|
|
11047
|
+
ControlProto.__pixldocsOriginalCursorStyleHandler = originalCursorHandler;
|
|
11025
11048
|
ControlProto.cursorStyleHandler = function(eventData, control, fabricObject) {
|
|
11026
|
-
const
|
|
11027
|
-
const
|
|
11028
|
-
|
|
11029
|
-
|
|
11049
|
+
const activeCorner = typeof (fabricObject == null ? void 0 : fabricObject.__corner) === "string" ? fabricObject.__corner : null;
|
|
11050
|
+
const key = activeCorner ?? inferControlKey(this) ?? inferControlKey(control);
|
|
11051
|
+
const cursor = resolveCanvaControlCursor(fabricObject, key, this ?? control);
|
|
11052
|
+
if (cursor) {
|
|
11030
11053
|
try {
|
|
11031
11054
|
const canvas = fabricObject == null ? void 0 : fabricObject.canvas;
|
|
11032
11055
|
if (canvas) canvas.__pixldocsGetRotateCursor = getRotateCursor;
|
|
@@ -11036,16 +11059,13 @@ try {
|
|
|
11036
11059
|
}
|
|
11037
11060
|
return cursor;
|
|
11038
11061
|
}
|
|
11039
|
-
const key = inferControlKey(this);
|
|
11040
|
-
if (key && baseAngleFor[key] !== void 0) {
|
|
11041
|
-
return getRotatedCursor(key, fabricObject);
|
|
11042
|
-
}
|
|
11043
11062
|
if (typeof originalCursorHandler === "function") {
|
|
11044
11063
|
return originalCursorHandler.call(this, eventData, control, fabricObject);
|
|
11045
11064
|
}
|
|
11046
11065
|
return this.cursorStyle || "default";
|
|
11047
11066
|
};
|
|
11048
11067
|
ControlProto.__pixldocsCanvaCursorFallback = true;
|
|
11068
|
+
ControlProto.__pixldocsCanvaCursorFallbackVersion = 2;
|
|
11049
11069
|
}
|
|
11050
11070
|
ensureCanvaControlRenders = (obj) => {
|
|
11051
11071
|
try {
|
|
@@ -11080,12 +11100,31 @@ try {
|
|
|
11080
11100
|
wrapClassCreateControls(fabric__namespace.ActiveSelection);
|
|
11081
11101
|
wrapClassCreateControls(fabric__namespace.Group);
|
|
11082
11102
|
const CanvasProto = (_c = fabric__namespace.Canvas) == null ? void 0 : _c.prototype;
|
|
11083
|
-
if (CanvasProto && typeof CanvasProto.
|
|
11084
|
-
const
|
|
11103
|
+
if (CanvasProto && CanvasProto.__pixldocsCanvaSetCursorVersion !== 1 && typeof CanvasProto.setCursor === "function") {
|
|
11104
|
+
const origSetCursor = CanvasProto.__pixldocsOriginalSetCursor ?? CanvasProto.setCursor;
|
|
11105
|
+
CanvasProto.__pixldocsOriginalSetCursor = origSetCursor;
|
|
11106
|
+
CanvasProto.setCursor = function(value) {
|
|
11107
|
+
const cursor = resolveCanvasControlCursor(this);
|
|
11108
|
+
return origSetCursor.call(this, cursor || value);
|
|
11109
|
+
};
|
|
11110
|
+
CanvasProto.__pixldocsCanvaSetCursorVersion = 1;
|
|
11111
|
+
}
|
|
11112
|
+
if (CanvasProto && typeof CanvasProto._setCursorFromEvent === "function" && CanvasProto.__pixldocsCanvaCursorEventVersion !== 2) {
|
|
11113
|
+
const origSet = CanvasProto.__pixldocsOriginalSetCursorFromEvent ?? CanvasProto._setCursorFromEvent;
|
|
11114
|
+
CanvasProto.__pixldocsOriginalSetCursorFromEvent = origSet;
|
|
11085
11115
|
CanvasProto._setCursorFromEvent = function(e, target) {
|
|
11086
11116
|
const prev = target && target.__corner;
|
|
11087
11117
|
const res = origSet.call(this, e, target);
|
|
11088
11118
|
const next = target && target.__corner;
|
|
11119
|
+
try {
|
|
11120
|
+
const control = next && (target == null ? void 0 : target.controls) ? target.controls[next] : null;
|
|
11121
|
+
const cursor = resolveCanvaControlCursor(target, typeof next === "string" ? next : null, control);
|
|
11122
|
+
if (cursor) {
|
|
11123
|
+
if (typeof this.setCursor === "function") this.setCursor(cursor);
|
|
11124
|
+
else if (this.upperCanvasEl) this.upperCanvasEl.style.cursor = cursor;
|
|
11125
|
+
}
|
|
11126
|
+
} catch {
|
|
11127
|
+
}
|
|
11089
11128
|
if (prev !== next) {
|
|
11090
11129
|
try {
|
|
11091
11130
|
this.requestRenderAll();
|
|
@@ -11094,6 +11133,7 @@ try {
|
|
|
11094
11133
|
}
|
|
11095
11134
|
return res;
|
|
11096
11135
|
};
|
|
11136
|
+
CanvasProto.__pixldocsCanvaCursorEventVersion = 2;
|
|
11097
11137
|
}
|
|
11098
11138
|
}
|
|
11099
11139
|
} catch (e) {
|
|
@@ -24768,9 +24808,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
24768
24808
|
}
|
|
24769
24809
|
return svgString;
|
|
24770
24810
|
}
|
|
24771
|
-
const resolvedPackageVersion = "0.5.
|
|
24811
|
+
const resolvedPackageVersion = "0.5.379";
|
|
24772
24812
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
24773
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
24813
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.379";
|
|
24774
24814
|
const roundParityValue = (value) => {
|
|
24775
24815
|
if (typeof value !== "number") return value;
|
|
24776
24816
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -25584,7 +25624,7 @@ class PixldocsRenderer {
|
|
|
25584
25624
|
await this.waitForCanvasScene(container, cloned, i);
|
|
25585
25625
|
}
|
|
25586
25626
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
25587
|
-
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
25627
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-C1UzGCn0.cjs"));
|
|
25588
25628
|
const prepared = preparePagesForExport(
|
|
25589
25629
|
cloned.pages,
|
|
25590
25630
|
canvasWidth,
|
|
@@ -27904,7 +27944,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
27904
27944
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
27905
27945
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
27906
27946
|
try {
|
|
27907
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
27947
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-C1UzGCn0.cjs"));
|
|
27908
27948
|
try {
|
|
27909
27949
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
27910
27950
|
} catch {
|
|
@@ -28301,4 +28341,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
28301
28341
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
28302
28342
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
28303
28343
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
28304
|
-
//# sourceMappingURL=index-
|
|
28344
|
+
//# sourceMappingURL=index-D_l8rDHU.cjs.map
|