Spaces:
Paused
Paused
fix: optimize mobile responsive layout for chatlog panel
Browse files- Remove (pointer: coarse) from media query so iPads in landscape
get desktop layout (chatlog on right)
- Mobile (<= 900px): chatlog below game, full width, 35vh max-height,
game preserves 16:9 aspect ratio
- Narrow desktop (901-1200px): chatlog 240px instead of 300px
- Landscape phone (height <= 500px): compressed chatlog 25vh
- Small phone (<= 400px): tighter padding and smaller font
- JS syncChatlogHeight skips mobile, lets CSS handle layout
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
frontend/electron-standalone.html
CHANGED
|
@@ -1480,7 +1480,15 @@
|
|
| 1480 |
}
|
| 1481 |
|
| 1482 |
/* 手机端专属适配(不影响桌面) */
|
| 1483 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1484 |
html, body {
|
| 1485 |
height: 100%;
|
| 1486 |
}
|
|
@@ -1488,7 +1496,7 @@
|
|
| 1488 |
body {
|
| 1489 |
padding: 0;
|
| 1490 |
gap: 0;
|
| 1491 |
-
overflow-x:
|
| 1492 |
overflow-y: auto;
|
| 1493 |
-webkit-overflow-scrolling: touch;
|
| 1494 |
align-items: stretch;
|
|
@@ -1496,12 +1504,12 @@
|
|
| 1496 |
|
| 1497 |
#game-container {
|
| 1498 |
width: 100vw;
|
| 1499 |
-
height: 66.666vh; /* 办公室占 2/3 屏幕高度 */
|
| 1500 |
max-width: 100vw;
|
| 1501 |
-
max-height: 66.666vh;
|
| 1502 |
border-width: 0;
|
| 1503 |
border-radius: 0;
|
| 1504 |
-
aspect-ratio:
|
|
|
|
|
|
|
| 1505 |
flex: 0 0 auto;
|
| 1506 |
touch-action: auto;
|
| 1507 |
overflow: hidden;
|
|
@@ -1510,6 +1518,8 @@
|
|
| 1510 |
#stage-row {
|
| 1511 |
flex-direction: column;
|
| 1512 |
gap: 0;
|
|
|
|
|
|
|
| 1513 |
}
|
| 1514 |
|
| 1515 |
#main-stage {
|
|
@@ -1521,16 +1531,22 @@
|
|
| 1521 |
#chatlog-panel {
|
| 1522 |
width: 100vw;
|
| 1523 |
height: auto;
|
| 1524 |
-
max-height:
|
| 1525 |
border-left: 0;
|
| 1526 |
border-right: 0;
|
| 1527 |
border-radius: 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1528 |
}
|
| 1529 |
|
| 1530 |
#bottom-panels {
|
| 1531 |
width: 100vw;
|
| 1532 |
max-width: 100vw;
|
| 1533 |
-
min-height: 33.334vh; /* 余下约 1/3 可见区 */
|
| 1534 |
padding: 10px 10px 16px;
|
| 1535 |
display: flex;
|
| 1536 |
flex-direction: column;
|
|
@@ -1652,6 +1668,33 @@
|
|
| 1652 |
min-height: 38px;
|
| 1653 |
}
|
| 1654 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1655 |
</style>
|
| 1656 |
</head>
|
| 1657 |
<body>
|
|
@@ -4897,11 +4940,19 @@ function toggleBrokerPanel() {
|
|
| 4897 |
// 启动 Phaser 游戏
|
| 4898 |
new Phaser.Game(config);
|
| 4899 |
|
| 4900 |
-
// 同步 chatlog-panel 高度与 game-container
|
| 4901 |
function syncChatlogHeight() {
|
| 4902 |
-
const gc = document.getElementById('game-container');
|
| 4903 |
const cl = document.getElementById('chatlog-panel');
|
| 4904 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4905 |
const h = gc.offsetHeight;
|
| 4906 |
if (h > 100) {
|
| 4907 |
cl.style.height = h + 'px';
|
|
|
|
| 1480 |
}
|
| 1481 |
|
| 1482 |
/* 手机端专属适配(不影响桌面) */
|
| 1483 |
+
/* 窄桌面/平板横屏:chatlog 稍窄 */
|
| 1484 |
+
@media (min-width: 901px) and (max-width: 1200px) {
|
| 1485 |
+
#chatlog-panel {
|
| 1486 |
+
width: 240px;
|
| 1487 |
+
}
|
| 1488 |
+
}
|
| 1489 |
+
|
| 1490 |
+
/* 移动端 */
|
| 1491 |
+
@media (max-width: 900px) {
|
| 1492 |
html, body {
|
| 1493 |
height: 100%;
|
| 1494 |
}
|
|
|
|
| 1496 |
body {
|
| 1497 |
padding: 0;
|
| 1498 |
gap: 0;
|
| 1499 |
+
overflow-x: hidden;
|
| 1500 |
overflow-y: auto;
|
| 1501 |
-webkit-overflow-scrolling: touch;
|
| 1502 |
align-items: stretch;
|
|
|
|
| 1504 |
|
| 1505 |
#game-container {
|
| 1506 |
width: 100vw;
|
|
|
|
| 1507 |
max-width: 100vw;
|
|
|
|
| 1508 |
border-width: 0;
|
| 1509 |
border-radius: 0;
|
| 1510 |
+
aspect-ratio: 16 / 9;
|
| 1511 |
+
height: auto;
|
| 1512 |
+
max-height: 56.25vw; /* 16:9 */
|
| 1513 |
flex: 0 0 auto;
|
| 1514 |
touch-action: auto;
|
| 1515 |
overflow: hidden;
|
|
|
|
| 1518 |
#stage-row {
|
| 1519 |
flex-direction: column;
|
| 1520 |
gap: 0;
|
| 1521 |
+
width: 100vw;
|
| 1522 |
+
max-width: 100vw;
|
| 1523 |
}
|
| 1524 |
|
| 1525 |
#main-stage {
|
|
|
|
| 1531 |
#chatlog-panel {
|
| 1532 |
width: 100vw;
|
| 1533 |
height: auto;
|
| 1534 |
+
max-height: 35vh;
|
| 1535 |
border-left: 0;
|
| 1536 |
border-right: 0;
|
| 1537 |
border-radius: 0;
|
| 1538 |
+
border-top: 2px solid #0e1119;
|
| 1539 |
+
}
|
| 1540 |
+
|
| 1541 |
+
#chatlog-content {
|
| 1542 |
+
max-height: calc(35vh - 40px); /* 标题约 40px */
|
| 1543 |
+
overflow-y: auto;
|
| 1544 |
+
-webkit-overflow-scrolling: touch;
|
| 1545 |
}
|
| 1546 |
|
| 1547 |
#bottom-panels {
|
| 1548 |
width: 100vw;
|
| 1549 |
max-width: 100vw;
|
|
|
|
| 1550 |
padding: 10px 10px 16px;
|
| 1551 |
display: flex;
|
| 1552 |
flex-direction: column;
|
|
|
|
| 1668 |
min-height: 38px;
|
| 1669 |
}
|
| 1670 |
}
|
| 1671 |
+
|
| 1672 |
+
/* 手机横屏:高度极低,压缩 chatlog */
|
| 1673 |
+
@media (max-width: 900px) and (max-height: 500px) {
|
| 1674 |
+
#game-container {
|
| 1675 |
+
max-height: 70vh;
|
| 1676 |
+
}
|
| 1677 |
+
#chatlog-panel {
|
| 1678 |
+
max-height: 25vh;
|
| 1679 |
+
}
|
| 1680 |
+
#chatlog-content {
|
| 1681 |
+
max-height: calc(25vh - 36px);
|
| 1682 |
+
}
|
| 1683 |
+
}
|
| 1684 |
+
|
| 1685 |
+
/* 小屏手机(<= 400px 宽):更紧凑 */
|
| 1686 |
+
@media (max-width: 400px) {
|
| 1687 |
+
#chatlog-panel {
|
| 1688 |
+
padding: 8px 10px;
|
| 1689 |
+
}
|
| 1690 |
+
#chatlog-title {
|
| 1691 |
+
font-size: 12px;
|
| 1692 |
+
}
|
| 1693 |
+
#chatlog-content {
|
| 1694 |
+
font-size: 12px;
|
| 1695 |
+
line-height: 1.5;
|
| 1696 |
+
}
|
| 1697 |
+
}
|
| 1698 |
</style>
|
| 1699 |
</head>
|
| 1700 |
<body>
|
|
|
|
| 4940 |
// 启动 Phaser 游戏
|
| 4941 |
new Phaser.Game(config);
|
| 4942 |
|
| 4943 |
+
// 同步 chatlog-panel 高度与 game-container(仅桌面端)
|
| 4944 |
function syncChatlogHeight() {
|
|
|
|
| 4945 |
const cl = document.getElementById('chatlog-panel');
|
| 4946 |
+
if (!cl) return;
|
| 4947 |
+
// 移动端:清除 JS 设置的高度,让 CSS 接管
|
| 4948 |
+
if (window.innerWidth <= 900) {
|
| 4949 |
+
cl.style.height = '';
|
| 4950 |
+
cl.style.maxHeight = '';
|
| 4951 |
+
return;
|
| 4952 |
+
}
|
| 4953 |
+
// 桌面端:同步高度到 game-container
|
| 4954 |
+
const gc = document.getElementById('game-container');
|
| 4955 |
+
if (gc) {
|
| 4956 |
const h = gc.offsetHeight;
|
| 4957 |
if (h > 100) {
|
| 4958 |
cl.style.height = h + 'px';
|