Compare commits

..

1 Commits

Author SHA1 Message Date
Mark Tolmacs
bfa4941ad1 fix: More robust mobile and tablet detection
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
2025-12-08 09:45:26 +00:00
4 changed files with 15 additions and 6 deletions

View File

@@ -1,3 +1,5 @@
import mobile from "is-mobile";
export type StylesPanelMode = "compact" | "full" | "mobile";
export type EditorInterface = Readonly<{
@@ -139,12 +141,13 @@ export const getFormFactor = (
editorWidth: number,
editorHeight: number,
): EditorInterface["formFactor"] => {
if (isMobileBreakpoint(editorWidth, editorHeight)) {
if (mobile()) {
return "phone";
}
if (isTabletBreakpoint(editorWidth, editorHeight)) {
} else if (mobile({ tablet: true })) {
return "tablet";
} else if (isMobileBreakpoint(editorWidth, editorHeight)) {
// NOTE: Very small editor sizes should be treated as phone
return "phone";
}
return "desktop";

View File

@@ -317,7 +317,7 @@ export class LinearElementEditor {
let deltaY = 0;
if (
shouldRotateWithDiscreteAngle(event) &&
(!isBindingElement(element) || !hoveredElement) &&
!hoveredElement &&
!element.startBinding &&
!element.endBinding
) {
@@ -504,7 +504,7 @@ export class LinearElementEditor {
if (
shouldRotateWithDiscreteAngle(event) &&
singlePointDragged &&
(!isBindingElement(element) || !hoveredElement) &&
!hoveredElement &&
!element.startBinding &&
!element.endBinding
) {

View File

@@ -95,6 +95,7 @@
"fractional-indexing": "3.2.0",
"fuzzy": "0.1.3",
"image-blob-reduce": "3.0.1",
"is-mobile": "5.0.0",
"jotai": "2.11.0",
"jotai-scope": "0.7.2",
"lodash.debounce": "4.0.8",

View File

@@ -6398,6 +6398,11 @@ is-map@^2.0.3:
resolved "https://registry.yarnpkg.com/is-map/-/is-map-2.0.3.tgz#ede96b7fe1e270b3c4465e3a465658764926d62e"
integrity sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==
is-mobile@5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/is-mobile/-/is-mobile-5.0.0.tgz#1e08a0ef2c38a67bff84a52af68d67bcef445333"
integrity sha512-Tz/yndySvLAEXh+Uk8liFCxOwVH6YutuR74utvOcu7I9Di+DwM0mtdPVZNaVvvBUM2OXxne/NhOs1zAO7riusQ==
is-module@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591"