@mhamz.01/easyflow-whiteboard 2.61.0 → 2.63.0
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDrawing.d.ts","sourceRoot":"","sources":["../../src/hooks/useDrawing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,SAAS,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,iBAAiB,EAAsB,MAAM,QAAQ,CAAC;AAMrF,UAAU,eAAe;IACvB,YAAY,EAAQ,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC7C,UAAU,EAAU,MAAM,CAAC;IAC3B,WAAW,EAAS,GAAG,CAAC;IACxB,YAAY,EAAQ,SAAS,CAAC,OAAO,CAAC,CAAC;IACvC,aAAa,EAAO,SAAS,CAAC;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;IAC/D,eAAe,EAAK,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IACnD,kBAAkB,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IACvC,WAAW,EAAS,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,eAAe,EAAK,CAAC,GAAG,EAAE,YAAY,KAAK,IAAI,CAAC;CACjD;AAED,eAAO,MAAM,UAAU,GAAI,4IAUxB,eAAe;2BAmBS,iBAAiB;
|
|
1
|
+
{"version":3,"file":"useDrawing.d.ts","sourceRoot":"","sources":["../../src/hooks/useDrawing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,SAAS,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,iBAAiB,EAAsB,MAAM,QAAQ,CAAC;AAMrF,UAAU,eAAe;IACvB,YAAY,EAAQ,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC7C,UAAU,EAAU,MAAM,CAAC;IAC3B,WAAW,EAAS,GAAG,CAAC;IACxB,YAAY,EAAQ,SAAS,CAAC,OAAO,CAAC,CAAC;IACvC,aAAa,EAAO,SAAS,CAAC;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;IAC/D,eAAe,EAAK,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IACnD,kBAAkB,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IACvC,WAAW,EAAS,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,eAAe,EAAK,CAAC,GAAG,EAAE,YAAY,KAAK,IAAI,CAAC;CACjD;AAED,eAAO,MAAM,UAAU,GAAI,4IAUxB,eAAe;2BAmBS,iBAAiB;2BAsHjB,iBAAiB;;CA0C3C,CAAC"}
|
package/dist/hooks/useDrawing.js
CHANGED
|
@@ -30,8 +30,9 @@ export const useDrawing = ({ fabricCanvas, activeTool, toolOptions, isDrawingRef
|
|
|
30
30
|
if (opt.target || canvas.getActiveObject())
|
|
31
31
|
return;
|
|
32
32
|
// Text tool
|
|
33
|
+
// In handleMouseDown, replace the text tool block:
|
|
33
34
|
if (tool === "text") {
|
|
34
|
-
addText(canvas, {
|
|
35
|
+
const textObj = addText(canvas, {
|
|
35
36
|
x: pointer.x,
|
|
36
37
|
y: pointer.y,
|
|
37
38
|
fontSize: options.text.fontSize,
|
|
@@ -41,7 +42,23 @@ export const useDrawing = ({ fabricCanvas, activeTool, toolOptions, isDrawingRef
|
|
|
41
42
|
textAlign: options.text.textAlign,
|
|
42
43
|
});
|
|
43
44
|
pushHistoryRef.current(JSON.stringify(canvas.toJSON()));
|
|
45
|
+
// Switch tool immediately — don't wait for editing:exited
|
|
44
46
|
useWhiteboardStore.getState().setActiveTool("select");
|
|
47
|
+
// Force cursor reset on the actual canvas DOM element
|
|
48
|
+
// because browser overrides Fabric's cursor during IText editing
|
|
49
|
+
const canvasEl = canvas.getElement();
|
|
50
|
+
if (canvasEl)
|
|
51
|
+
canvasEl.style.cursor = "default";
|
|
52
|
+
// Also reset when editing ends in case browser re-applies text cursor
|
|
53
|
+
if (textObj) {
|
|
54
|
+
textObj.once("editing:exited", () => {
|
|
55
|
+
canvas.defaultCursor = "default";
|
|
56
|
+
canvas.hoverCursor = "move";
|
|
57
|
+
const el = canvas.getElement();
|
|
58
|
+
if (el)
|
|
59
|
+
el.style.cursor = "default";
|
|
60
|
+
});
|
|
61
|
+
}
|
|
45
62
|
return;
|
|
46
63
|
}
|
|
47
64
|
if (!["rectangle", "circle", "frame", "line", "arrow"].includes(tool))
|