Browse Source

fix: reintroduce height-based mobile query detection (#10020)

pull/9209/head
David Luzar 3 months ago committed by GitHub
parent
commit
f738b74791
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      packages/common/src/constants.ts
  2. 8
      packages/excalidraw/components/App.tsx

3
packages/common/src/constants.ts

@ -354,6 +354,9 @@ export const DEFAULT_UI_OPTIONS: AppProps["UIOptions"] = { @@ -354,6 +354,9 @@ export const DEFAULT_UI_OPTIONS: AppProps["UIOptions"] = {
// mobile: up to 699px
export const MQ_MAX_MOBILE = 599;
export const MQ_MAX_WIDTH_LANDSCAPE = 1000;
export const MQ_MAX_HEIGHT_LANDSCAPE = 500;
// tablets
export const MQ_MIN_TABLET = MQ_MAX_MOBILE + 1; // lower bound (excludes phones)
export const MQ_MAX_TABLET = 1400; // upper bound (excludes laptops/desktops)

8
packages/excalidraw/components/App.tsx

@ -103,6 +103,8 @@ import { @@ -103,6 +103,8 @@ import {
MQ_MAX_MOBILE,
MQ_MIN_TABLET,
MQ_MAX_TABLET,
MQ_MAX_HEIGHT_LANDSCAPE,
MQ_MAX_WIDTH_LANDSCAPE,
} from "@excalidraw/common";
import {
@ -2423,8 +2425,10 @@ class App extends React.Component<AppProps, AppState> { @@ -2423,8 +2425,10 @@ class App extends React.Component<AppProps, AppState> {
};
private isMobileBreakpoint = (width: number, height: number) => {
const minSide = Math.min(width, height);
return minSide <= MQ_MAX_MOBILE;
return (
width <= MQ_MAX_MOBILE ||
(height < MQ_MAX_HEIGHT_LANDSCAPE && width < MQ_MAX_WIDTH_LANDSCAPE)
);
};
private isTabletBreakpoint = (editorWidth: number, editorHeight: number) => {

Loading…
Cancel
Save