diff --git a/index.html b/index.html index 52632a3..c8bc583 100644 --- a/index.html +++ b/index.html @@ -48,6 +48,9 @@ + + + @@ -76,6 +79,11 @@ width_left: getTitlebarAreaInset("width-left"), width_right: getTitlebarAreaInset("width-right"), height: getTitlebarAreaInset("height"), + }, + device_pixel_ratio = window.devicePixelRatio.toFixed(2), + refresh_device_pixel_ratio = () => { + var ratio = Editor.appearance().device_pixel_ratio, styling = getRootStyleProperty("--device-pixel-ratio"); + if (ratio != styling) document.documentElement.style.setProperty("--device-pixel-ratio",ratio); }; function getSafeAreaInset(section){ return parseInt(getRootStyleProperty(`--safe-area-inset-${section}`),10); @@ -88,7 +96,7 @@ function getRootStyleProperty(template){ return window.getComputedStyle(document.documentElement).getPropertyValue(template); } - return { parent_window, standalone, apple_home_screen, hidden_chrome, window_controls_overlay, refresh_window_controls_overlay, fullscreen, safe_area_insets, titlebar_area_insets }; + return { parent_window, standalone, apple_home_screen, hidden_chrome, window_controls_overlay, refresh_window_controls_overlay, fullscreen, safe_area_insets, titlebar_area_insets, device_pixel_ratio, refresh_device_pixel_ratio }; }, environment: () => ({ file_protocol: (window.location.protocol == "file:"), @@ -158,7 +166,12 @@ reset: () => { if (!Editor.support().local_storage) return; if (!confirm("Are you sure you would like to reset all settings?")) return; + var active = document.activeElement; Editor.settings.entries = {}; + default_orientation_setting.closest(".menu").querySelector("[data-option='horizontal']").click();/* Temporary! Look at note below */ + syntax_highlighting_setting.checked = false; + automatic_refresh_setting.checked = true; + active.focus({ preventScroll: true });/* Temporary! Changing select dropdown options currently requires them to be clicked programmatically, so it will remove focus from the current element. This will be addressed with MenuDrop once that is out. I can't wait for it to be ready! :) */ window.localStorage.removeItem("settings"); openCard(reset_settings_card); return true; @@ -180,6 +193,7 @@ if (Editor.environment().macOS_device) document.documentElement.classList.add("macOS-device"); if (Editor.support().web_sharing) document.documentElement.classList.add("web-sharing"); Editor.appearance().refresh_window_controls_overlay(); + Editor.appearance().refresh_device_pixel_ratio();