fix: update cursorButton once freedraw is released (#4996)
Co-authored-by: dwelle <luzar.david@gmail.com>
This commit is contained in:
parent
9ba7ca3845
commit
880e4feede
@ -39,6 +39,7 @@ export const actionFinalize = register({
|
||||
: undefined,
|
||||
appState: {
|
||||
...appState,
|
||||
cursorButton: "up",
|
||||
editingLinearElement: null,
|
||||
},
|
||||
commitToHistory: true,
|
||||
@ -140,6 +141,7 @@ export const actionFinalize = register({
|
||||
elements: newElements,
|
||||
appState: {
|
||||
...appState,
|
||||
cursorButton: "up",
|
||||
activeTool:
|
||||
(appState.activeTool.locked ||
|
||||
appState.activeTool.type === "freedraw") &&
|
||||
|
@ -252,6 +252,7 @@ export const restoreAppState = (
|
||||
}
|
||||
return {
|
||||
...nextAppState,
|
||||
cursorButton: localAppState?.cursorButton || "up",
|
||||
// reset on fresh restore so as to hide the UI button if penMode not active
|
||||
penDetected:
|
||||
localAppState?.penDetected ??
|
||||
|
@ -6729,7 +6729,7 @@ Object {
|
||||
"currentItemStrokeStyle": "solid",
|
||||
"currentItemStrokeWidth": 1,
|
||||
"currentItemTextAlign": "left",
|
||||
"cursorButton": "down",
|
||||
"cursorButton": "up",
|
||||
"draggingElement": null,
|
||||
"editingElement": null,
|
||||
"editingGroupId": null,
|
||||
@ -11029,7 +11029,7 @@ Object {
|
||||
"currentItemStrokeStyle": "solid",
|
||||
"currentItemStrokeWidth": 1,
|
||||
"currentItemTextAlign": "left",
|
||||
"cursorButton": "down",
|
||||
"cursorButton": "up",
|
||||
"draggingElement": null,
|
||||
"editingElement": null,
|
||||
"editingGroupId": null,
|
||||
@ -12181,7 +12181,7 @@ Object {
|
||||
"currentItemStrokeStyle": "solid",
|
||||
"currentItemStrokeWidth": 1,
|
||||
"currentItemTextAlign": "left",
|
||||
"cursorButton": "down",
|
||||
"cursorButton": "up",
|
||||
"draggingElement": null,
|
||||
"editingElement": null,
|
||||
"editingGroupId": null,
|
||||
|
@ -313,9 +313,7 @@ describe("restoreAppState", () => {
|
||||
expect(restoredAppState.activeTool).toEqual(
|
||||
stubImportedAppState.activeTool,
|
||||
);
|
||||
expect(restoredAppState.cursorButton).toBe(
|
||||
stubImportedAppState.cursorButton,
|
||||
);
|
||||
expect(restoredAppState.cursorButton).toBe("up");
|
||||
expect(restoredAppState.name).toBe(stubImportedAppState.name);
|
||||
});
|
||||
|
||||
@ -347,9 +345,7 @@ describe("restoreAppState", () => {
|
||||
stubImportedAppState,
|
||||
null,
|
||||
);
|
||||
expect(restoredAppState.cursorButton).toBe(
|
||||
stubImportedAppState.cursorButton,
|
||||
);
|
||||
expect(restoredAppState.cursorButton).toBe("up");
|
||||
expect(restoredAppState.name).toBe(stubImportedAppState.name);
|
||||
});
|
||||
|
||||
@ -502,9 +498,7 @@ describe("restore", () => {
|
||||
importedDataState.appState = stubImportedAppState;
|
||||
|
||||
const restoredData = restore.restore(importedDataState, null, null);
|
||||
expect(restoredData.appState.cursorButton).toBe(
|
||||
stubImportedAppState.cursorButton,
|
||||
);
|
||||
expect(restoredData.appState.cursorButton).toBe("up");
|
||||
expect(restoredData.appState.name).toBe(stubImportedAppState.name);
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user