Compare commits

..

No commits in common. "master" and "release" have entirely different histories.

3 changed files with 17 additions and 20 deletions

View File

@ -36,7 +36,7 @@ describe("Test MobileMenu", () => {
}, },
"isTouchScreen": false, "isTouchScreen": false,
"viewport": { "viewport": {
"isLandscape": true, "isLandscape": false,
"isMobile": true, "isMobile": true,
}, },
} }

View File

@ -347,12 +347,15 @@ export const DEFAULT_UI_OPTIONS: AppProps["UIOptions"] = {
// breakpoints // breakpoints
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// md screen
export const MQ_MAX_WIDTH_LANDSCAPE = 1000;
export const MQ_MAX_HEIGHT_LANDSCAPE = 500;
// mobile: up to 699px // mobile: up to 699px
export const MQ_MAX_MOBILE = 599; export const MQ_MAX_WIDTH_MOBILE = 699;
// tablets // tablets
export const MQ_MIN_TABLET = MQ_MAX_MOBILE + 1; // lower bound (excludes phones) export const MQ_MIN_TABLET = 600; // lower bound (excludes phones)
export const MQ_MAX_TABLET = 1400; // upper bound (excludes laptops/desktops) export const MQ_MAX_TABLET = 1400; // upper bound (excludes laptops/desktops)
// desktop/laptop // desktop/laptop

View File

@ -100,7 +100,9 @@ import {
MINIMUM_ARROW_SIZE, MINIMUM_ARROW_SIZE,
DOUBLE_TAP_POSITION_THRESHOLD, DOUBLE_TAP_POSITION_THRESHOLD,
isMobileOrTablet, isMobileOrTablet,
MQ_MAX_MOBILE, MQ_MAX_WIDTH_MOBILE,
MQ_MAX_HEIGHT_LANDSCAPE,
MQ_MAX_WIDTH_LANDSCAPE,
MQ_MIN_TABLET, MQ_MIN_TABLET,
MQ_MAX_TABLET, MQ_MAX_TABLET,
} from "@excalidraw/common"; } from "@excalidraw/common";
@ -2421,8 +2423,10 @@ class App extends React.Component<AppProps, AppState> {
}; };
private isMobileBreakpoint = (width: number, height: number) => { private isMobileBreakpoint = (width: number, height: number) => {
const minSide = Math.min(width, height); return (
return minSide <= MQ_MAX_MOBILE; width <= MQ_MAX_WIDTH_MOBILE ||
(height < MQ_MAX_HEIGHT_LANDSCAPE && width < MQ_MAX_WIDTH_LANDSCAPE)
);
}; };
private isTabletBreakpoint = (editorWidth: number, editorHeight: number) => { private isTabletBreakpoint = (editorWidth: number, editorHeight: number) => {
@ -2438,14 +2442,14 @@ class App extends React.Component<AppProps, AppState> {
return; return;
} }
const { width: editorWidth, height: editorHeight } = const { clientWidth: viewportWidth, clientHeight: viewportHeight } =
container.getBoundingClientRect(); document.body;
const prevViewportState = this.device.viewport; const prevViewportState = this.device.viewport;
const nextViewportState = updateObject(prevViewportState, { const nextViewportState = updateObject(prevViewportState, {
isLandscape: editorWidth > editorHeight, isLandscape: viewportWidth > viewportHeight,
isMobile: this.isMobileBreakpoint(editorWidth, editorHeight), isMobile: this.isMobileBreakpoint(viewportWidth, viewportHeight),
}); });
if (prevViewportState !== nextViewportState) { if (prevViewportState !== nextViewportState) {
@ -7248,16 +7252,6 @@ class App extends React.Component<AppProps, AppState> {
selectedElements.length === 1 && selectedElements.length === 1 &&
!this.state.selectedLinearElement?.isEditing && !this.state.selectedLinearElement?.isEditing &&
!isElbowArrow(selectedElements[0]) && !isElbowArrow(selectedElements[0]) &&
!(
isLineElement(selectedElements[0]) &&
LinearElementEditor.getPointIndexUnderCursor(
selectedElements[0],
elementsMap,
this.state.zoom,
pointerDownState.origin.x,
pointerDownState.origin.y,
) !== -1
) &&
!( !(
this.state.selectedLinearElement && this.state.selectedLinearElement &&
this.state.selectedLinearElement.hoverPointIndex !== -1 this.state.selectedLinearElement.hoverPointIndex !== -1