From ef5067c645b092c68b1bf8767d9c118ce70c65c0 Mon Sep 17 00:00:00 2001 From: Dannii Willis Date: Sat, 5 Oct 2024 12:51:34 +1000 Subject: [PATCH] Try a visualViewport resize handler to fix the dialog height on mobile Safari --- src/common/misc.ts | 10 ++++++- src/dialog/browser/ui/BaseDialog.svelte | 35 +++++++++++++++++++++++++ src/dialog/browser/ui/FileDialog.svelte | 9 ++----- src/glkote/web/input.ts | 4 +-- src/glkote/web/metrics.ts | 3 ++- src/glkote/web/shared.ts | 10 +------ src/glkote/web/windows.ts | 5 ++-- 7 files changed, 54 insertions(+), 22 deletions(-) diff --git a/src/common/misc.ts b/src/common/misc.ts index 53fdf02..af885c7 100644 --- a/src/common/misc.ts +++ b/src/common/misc.ts @@ -3,7 +3,7 @@ Miscellaneous common things =========================== -Copyright (c) 2023 Dannii Willis +Copyright (c) 2024 Dannii Willis MIT licenced https://github.com/curiousdannii/asyncglk @@ -66,6 +66,14 @@ export function BEBuffer_to_Array(buf: Uint8Array) { return arr } +/** If we can determine that the browser is currently pinch zoomed */ +export function is_pinch_zoomed() { + if (visualViewport) { + return (visualViewport.scale - 1) > 0.001 + } + return false +} + export function is_unicode_array(arr: GlkTypedArray) { return arr.BYTES_PER_ELEMENT === 4 } diff --git a/src/dialog/browser/ui/BaseDialog.svelte b/src/dialog/browser/ui/BaseDialog.svelte index 1d0d7e1..fbcf2a3 100644 --- a/src/dialog/browser/ui/BaseDialog.svelte +++ b/src/dialog/browser/ui/BaseDialog.svelte @@ -1,6 +1,10 @@ diff --git a/src/dialog/browser/ui/FileDialog.svelte b/src/dialog/browser/ui/FileDialog.svelte index ee5314c..78dc4b4 100644 --- a/src/dialog/browser/ui/FileDialog.svelte +++ b/src/dialog/browser/ui/FileDialog.svelte @@ -164,18 +164,12 @@