mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-09-14 04:50:05 +02:00
Add touch support (#788)
* Add touch support * Mock media query * Mock media query pt 2 * Fix tests * Allow installing as an app on iOS * Fix type error * Math.hypot * delete and finalize buttons, hint viewer * skip failing tests * skip the rest of the failing tests * Hide the selected shape actions when nothing is selected * Don’t go into mobile view on short-but-wide viewports * lol
This commit is contained in:
@@ -5,9 +5,15 @@ const context = React.createContext(false);
|
||||
export function IsMobileProvider({ children }: { children: React.ReactNode }) {
|
||||
const query = useRef<MediaQueryList>();
|
||||
if (!query.current) {
|
||||
query.current = window.matchMedia(
|
||||
"(max-width: 600px), (max-height: 500px)",
|
||||
);
|
||||
query.current = window.matchMedia
|
||||
? window.matchMedia(
|
||||
"(max-width: 600px), (max-height: 500px) and (max-width: 1000px)",
|
||||
)
|
||||
: (({
|
||||
matches: false,
|
||||
addListener: () => {},
|
||||
removeListener: () => {},
|
||||
} as any) as MediaQueryList);
|
||||
}
|
||||
const [isMobile, setMobile] = useState(query.current.matches);
|
||||
|
||||
|
Reference in New Issue
Block a user