mirror of
https://github.com/SECTL/SecScore.git
synced 2026-07-19 19:04:23 +08:00
优化竖屏为手机尺寸并放宽窗口最小尺寸限制
This commit is contained in:
@@ -22,8 +22,8 @@
|
|||||||
"decorations": false,
|
"decorations": false,
|
||||||
"transparent": false,
|
"transparent": false,
|
||||||
"center": true,
|
"center": true,
|
||||||
"minWidth": 800,
|
"minWidth": 360,
|
||||||
"minHeight": 600
|
"minHeight": 640
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"security": {
|
"security": {
|
||||||
|
|||||||
+12
-10
@@ -284,24 +284,26 @@ function MainContent(): React.JSX.Element {
|
|||||||
const availableWidth = window.screen?.availWidth || window.innerWidth || 1200
|
const availableWidth = window.screen?.availWidth || window.innerWidth || 1200
|
||||||
const availableHeight = window.screen?.availHeight || window.innerHeight || 800
|
const availableHeight = window.screen?.availHeight || window.innerHeight || 800
|
||||||
return {
|
return {
|
||||||
maxWidth: Math.max(800, Math.round(availableWidth - 64)),
|
maxWidth: Math.max(360, Math.round(availableWidth - 64)),
|
||||||
maxHeight: Math.max(600, Math.round(availableHeight - 64)),
|
maxHeight: Math.max(640, Math.round(availableHeight - 64)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const getFixedPortraitSize = () => {
|
const getFixedPortraitSize = () => {
|
||||||
const { maxWidth, maxHeight } = getMaxWindowSize()
|
const { maxWidth, maxHeight } = getMaxWindowSize()
|
||||||
const width = Math.min(940, maxWidth)
|
const phonePortraitBase = { width: 430, height: 932 }
|
||||||
const height = Math.max(600, Math.min(1600, maxHeight))
|
let width = Math.max(360, Math.min(phonePortraitBase.width, maxWidth))
|
||||||
|
let height = Math.max(640, Math.min(phonePortraitBase.height, maxHeight))
|
||||||
|
|
||||||
if (height > width) {
|
// 保证竖屏高于宽,维持手机风格比例。
|
||||||
return { width, height }
|
if (height <= width) {
|
||||||
|
height = Math.min(maxHeight, Math.max(640, Math.round(width * 2.0)))
|
||||||
|
}
|
||||||
|
if (height <= width) {
|
||||||
|
width = Math.max(360, Math.min(maxWidth, Math.round(height * 0.5)))
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return { width, height }
|
||||||
width: Math.min(maxWidth, Math.max(800, width - 120)),
|
|
||||||
height: Math.min(maxHeight, Math.max(600, height + 120)),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const getLandscapeRestoreSize = () => {
|
const getLandscapeRestoreSize = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user