forked from gamemcu/www-genshin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tsx
35 lines (31 loc) · 1007 Bytes
/
main.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import './index.css'
import React from 'react'
import ReactDOM from 'react-dom/client'
import { App } from './App'
function resizeWindow(){
var width = document.documentElement.clientWidth;
var height = document.documentElement.clientHeight;
const root = document.getElementById('root');
if (width > height) {
root.style.transform = "rotate(0deg)";
root.style.width = `${width}px`
root.style.height = `${height}px`
root.style.top = `0px`
root.style.left = `0px`
}
else {
root.style.transform = "rotate(90deg)";
root.style.width = `${height}px`
root.style.height = `${width}px`
root.style.top = `${(height - width) / 2}px`
root.style.left = `${0 - (height - width) / 2}px`
}
}
resizeWindow()
var evt = "resize";//"onorientationchange" in window ? "orientationchange" : "resize";
window.addEventListener(evt, resizeWindow, false);
ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<App />
</React.StrictMode>,
)