fix: 橫豎屏切換 resize 時的大小不當
* 橫屏時, 測試 Via 瀏覽器時 可能是因為全屏不當, 大小不正確, 也因此需要手動縮小, 繼續切豎屏正常
This commit is contained in:
@@ -26,13 +26,13 @@ import AppMobile from './ui/AppMobile.tsx'
|
|||||||
import isMobileUI from "./ui/isMobileUI.ts"
|
import isMobileUI from "./ui/isMobileUI.ts"
|
||||||
ReactDOM.createRoot(document.getElementById('app') as HTMLElement).render(React.createElement(isMobileUI() ? AppMobile : App, null))
|
ReactDOM.createRoot(document.getElementById('app') as HTMLElement).render(React.createElement(isMobileUI() ? AppMobile : App, null))
|
||||||
|
|
||||||
const onResize = () => {
|
const onResize = () => setTimeout(() => {
|
||||||
document.body.style.setProperty('--whitesilk-widget-message-maxwidth', breakpoint().down('md') ? "80%" : "70%")
|
document.body.style.setProperty('--whitesilk-widget-message-maxwidth', breakpoint().down('md') ? "80%" : "70%")
|
||||||
// deno-lint-ignore no-window
|
// deno-lint-ignore no-window
|
||||||
document.body.style.setProperty('--whitesilk-window-width', window.innerWidth + 'px')
|
document.body.style.setProperty('--whitesilk-window-width', window.screen.availWidth + 'px')
|
||||||
// deno-lint-ignore no-window
|
// deno-lint-ignore no-window
|
||||||
document.body.style.setProperty('--whitesilk-window-height', window.innerHeight + 'px')
|
document.body.style.setProperty('--whitesilk-window-height', window.screen.availHeight + 'px')
|
||||||
}
|
}, 100)
|
||||||
// deno-lint-ignore no-window no-window-prefix
|
// deno-lint-ignore no-window no-window-prefix
|
||||||
window.addEventListener('resize', onResize)
|
window.addEventListener('resize', onResize)
|
||||||
onResize()
|
onResize()
|
||||||
|
|||||||
Reference in New Issue
Block a user