Repository navigation
fix(song): 手机端播放器塌成一条(判定盘高度为 0) - #94
Merged
Merged
Conversation
竖屏手机打开 /song 时播放器只有 58px 高、判定盘 0×0,只剩一条进度条。
原因是之前给 .majview-stage 加了 container-type: size(为了让判定盘按容器短边
取正方形),它会带上 size containment —— 元素高度不再由内容撑开。桌面端 stage
的高度由 flex 给定,没事;手机端 .song-stage 的 aspect-ratio 被关掉、
.majview 又是 height: auto,整条链就只能塌到 0。
改法(只在 ≤48rem 的媒体查询里):
- .majview-stage { container-type: normal }:不再依赖容器高度;
- .majview-scene { width: 100%; height: auto; aspect-ratio: 1 }:让宽度决定高度。
验证:390×844 判定盘 390×390、控制条 58px 接在下面;
360×640 判定盘 360×360、控制条不横向溢出;
768×1024 判定盘 768×768;844×390 横屏仍走桌面布局(判定盘 218×218 居中)。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
现象
手机竖屏打开
/song时播放器只有 58px 高,判定盘 0×0,只剩一条进度条:原因
之前给
.majview-stage加了container-type: size(让判定盘按容器短边取正方形),它会带上 size containment —— 元素高度不再由内容撑开。桌面端 stage 的高度由 flex 给定所以没问题;手机端.song-stage的aspect-ratio被关掉、.majview又是height: auto,整条链就塌成 0。改法
只在
@media (max-width: 48rem)里:宽度撑满、高度按正方形算,不再依赖容器高度。
验证
页面无横向溢出,谱面
0/746正常加载;tsc/eslint/vitest(461 passed)/build全 0。