fix: screen fit

topwar
guofei 2025-01-06 11:53:37 +08:00
parent 741a498ca4
commit f7bc735c44
6 changed files with 28 additions and 8 deletions

View File

@ -2,6 +2,7 @@
text-align: center; text-align: center;
display: flex; display: flex;
align-items: stretch; align-items: stretch;
overflow: hidden;
} }
.App-logo { .App-logo {

View File

@ -217,7 +217,7 @@ class App extends React.Component {
const { t } = this.props; const { t } = this.props;
return ( return (
<div className="App"> <div className="App" style={{ height: isMobile ? window.innerHeight + 'px' : '100vh' }}>
<Dialog open={loginOpen}> <Dialog open={loginOpen}>
<DialogTitle>{t("login")}</DialogTitle> <DialogTitle>{t("login")}</DialogTitle>
<DialogContent> <DialogContent>

View File

@ -12,10 +12,12 @@
.refreshButton { .refreshButton {
position: absolute; position: absolute;
right: 24px; right: 12px;
bottom: 24px; bottom: 24px;
cursor: pointer; cursor: pointer;
z-index: 1000; z-index: 1000;
width: 58px;
height: 61px;
} }
.qrCode { .qrCode {

View File

@ -85,9 +85,21 @@ function DeviceFrame(props) {
var [cacheKey, setCacheKey] = useState(new Date().getTime()); var [cacheKey, setCacheKey] = useState(new Date().getTime());
var [openPopup, setOpenPopup] = useState(false); var [openPopup, setOpenPopup] = useState(false);
var [absoluteUrl, setAbsoluteUrl] = useState(""); var [absoluteUrl, setAbsoluteUrl] = useState("");
var [isMobile, setIsMobile] = useState(props.isMobile); var [isMobile] = useState(props.isMobile);
var [safeAreaBottom, setSafeAreaBottom] = useState(0);
const { t } = useTranslation(); const { t } = useTranslation();
useEffect(() => {
let safeAreaBottom = 0;
if (window.visualViewport) {
safeAreaBottom = window.innerHeight - window.visualViewport.height;
} else {
safeAreaBottom = window.screen.height - window.innerHeight;
}
setSafeAreaBottom(safeAreaBottom);
}, [isMobile]);
useEffect(() => { useEffect(() => {
// 将宽度和高度的值转换为数字并增加10% // 将宽度和高度的值转换为数字并增加10%
const current = JSON.parse(JSON.stringify(configMap[props.device])) const current = JSON.parse(JSON.stringify(configMap[props.device]))
@ -135,8 +147,7 @@ function DeviceFrame(props) {
return ( return (
<div className="deviceFrameContainer"> <div className="deviceFrameContainer">
<img src={refreshButtonPng} alt="refresh" onClick={() => refresh()} className="refreshButton" style={{ bottom: isMobile ? safeAreaBottom + 40 + 'px' : '24px' }} />
<img src={refreshButtonPng} alt="refresh" onClick={() => refresh()} className="refreshButton" />
{props.qrDataUrl && !isMobile && ( {props.qrDataUrl && !isMobile && (
<div className="qrCode"> <div className="qrCode">
<img src={props.qrDataUrl} alt="qr code" /> <img src={props.qrDataUrl} alt="qr code" />

View File

@ -1,12 +1,12 @@
.Pane { .Pane {
width: 370px; width: 370px;
background-color: #535353; background-color: #535353;
min-height: 100vh;
padding: 24px; padding: 24px;
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
position: relative; position: relative;
overflow: hidden;
} }
.selectPager { .selectPager {
@ -20,13 +20,19 @@
top: 0; top: 0;
bottom: 0; bottom: 0;
width: 60vw; width: 60vw;
height: 100vh;
background-color: #535353; background-color: #535353;
z-index: 1000; z-index: 1000;
overflow: hidden; overflow: hidden;
transition: width 0.2s linear; transition: width 0.2s linear;
} }
/* @TODO 横屏模式 */
@media only screen and (orientation: landscape) {
.Pane.mobile {
width: 30vw;
}
}
.flod-menu-btn-warpper { .flod-menu-btn-warpper {
position: fixed; position: fixed;
right: 12px; right: 12px;

View File

@ -77,7 +77,7 @@ function Pane(props) {
return ( return (
<div className={`Pane ${isMobile ? 'mobile' : ''} ${foldPanel ? 'fold' : ''}`} style={{ height: window.innerHeight }}> <div className={`Pane ${isMobile ? 'mobile' : ''} ${foldPanel ? 'fold' : ''}`} style={{ height: window.innerHeight + 'px' }}>
{ {
isMobile && isMobile &&
<div className="flod-menu-btn-warpper"> <div className="flod-menu-btn-warpper">