mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-10-24 16:34:24 +02:00
fix: revert preferred selection to box once you switch to full UI (#10160)
This commit is contained in:
@@ -2487,9 +2487,7 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
canFitSidebar: editorWidth > sidebarBreakpoint,
|
canFitSidebar: editorWidth > sidebarBreakpoint,
|
||||||
});
|
});
|
||||||
|
|
||||||
// also check if we need to update the app state
|
const stylesPanelMode =
|
||||||
this.setState({
|
|
||||||
stylesPanelMode:
|
|
||||||
// NOTE: we could also remove the isMobileOrTablet check here and
|
// NOTE: we could also remove the isMobileOrTablet check here and
|
||||||
// always switch to compact mode when the editor is narrow (e.g. < MQ_MIN_WIDTH_DESKTOP)
|
// always switch to compact mode when the editor is narrow (e.g. < MQ_MIN_WIDTH_DESKTOP)
|
||||||
// but not too narrow (> MQ_MAX_WIDTH_MOBILE)
|
// but not too narrow (> MQ_MAX_WIDTH_MOBILE)
|
||||||
@@ -2497,8 +2495,21 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
? "compact"
|
? "compact"
|
||||||
: this.isMobileBreakpoint(editorWidth, editorHeight)
|
: this.isMobileBreakpoint(editorWidth, editorHeight)
|
||||||
? "mobile"
|
? "mobile"
|
||||||
: "full",
|
: "full";
|
||||||
});
|
|
||||||
|
// also check if we need to update the app state
|
||||||
|
this.setState((prevState) => ({
|
||||||
|
stylesPanelMode,
|
||||||
|
// reset to box selection mode if the UI changes to full
|
||||||
|
// where you'd not be able to change the mode yourself currently
|
||||||
|
preferredSelectionTool:
|
||||||
|
stylesPanelMode === "full"
|
||||||
|
? {
|
||||||
|
type: "selection",
|
||||||
|
initialized: true,
|
||||||
|
}
|
||||||
|
: prevState.preferredSelectionTool,
|
||||||
|
}));
|
||||||
|
|
||||||
if (prevEditorState !== nextEditorState) {
|
if (prevEditorState !== nextEditorState) {
|
||||||
this.device = { ...this.device, editor: nextEditorState };
|
this.device = { ...this.device, editor: nextEditorState };
|
||||||
|
|||||||
Reference in New Issue
Block a user