|
@@ -3143,11 +3143,7 @@ class App extends React.Component<AppProps, AppState> {
|
|
| { type: "custom"; customType: string },
|
|
| { type: "custom"; customType: string },
|
|
) => {
|
|
) => {
|
|
const nextActiveTool = updateActiveTool(this.state, tool);
|
|
const nextActiveTool = updateActiveTool(this.state, tool);
|
|
- if (nextActiveTool.type === "hand") {
|
|
|
|
- setCursor(this.interactiveCanvas, CURSOR_TYPE.GRAB);
|
|
|
|
- } else if (!isHoldingSpace) {
|
|
|
|
- setCursorForShape(this.interactiveCanvas, this.state);
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
if (isToolIcon(document.activeElement)) {
|
|
if (isToolIcon(document.activeElement)) {
|
|
this.focusContainer();
|
|
this.focusContainer();
|
|
}
|
|
}
|
|
@@ -3164,8 +3160,10 @@ class App extends React.Component<AppProps, AppState> {
|
|
originSnapOffset: null,
|
|
originSnapOffset: null,
|
|
activeEmbeddable: null,
|
|
activeEmbeddable: null,
|
|
} as const;
|
|
} as const;
|
|
|
|
+ let nextState: AppState;
|
|
|
|
+
|
|
if (nextActiveTool.type !== "selection") {
|
|
if (nextActiveTool.type !== "selection") {
|
|
- return {
|
|
|
|
|
|
+ nextState = {
|
|
...prevState,
|
|
...prevState,
|
|
activeTool: nextActiveTool,
|
|
activeTool: nextActiveTool,
|
|
selectedElementIds: makeNextSelectedElementIds({}, prevState),
|
|
selectedElementIds: makeNextSelectedElementIds({}, prevState),
|
|
@@ -3174,12 +3172,21 @@ class App extends React.Component<AppProps, AppState> {
|
|
multiElement: null,
|
|
multiElement: null,
|
|
...commonResets,
|
|
...commonResets,
|
|
};
|
|
};
|
|
|
|
+ } else {
|
|
|
|
+ nextState = {
|
|
|
|
+ ...prevState,
|
|
|
|
+ activeTool: nextActiveTool,
|
|
|
|
+ ...commonResets,
|
|
|
|
+ };
|
|
}
|
|
}
|
|
- return {
|
|
|
|
- ...prevState,
|
|
|
|
- activeTool: nextActiveTool,
|
|
|
|
- ...commonResets,
|
|
|
|
- };
|
|
|
|
|
|
+
|
|
|
|
+ if (nextActiveTool.type === "hand") {
|
|
|
|
+ setCursor(this.interactiveCanvas, CURSOR_TYPE.GRAB);
|
|
|
|
+ } else if (!isHoldingSpace) {
|
|
|
|
+ setCursorForShape(this.interactiveCanvas, nextState);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return nextState;
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
|