fix(clickgui): 展开优化选项不再溢出面板 - #185
Conversation
Nested pushClip replaced the list scissor, so expanding Performance drew settings past the ClickGUI chrome. Intersect and restore clips. Co-authored-by: Gao Yu <gaoyu06@users.noreply.github.com>
There was a problem hiding this comment.
第一遍审查(不批准)。对照的是 a978719...24fae09,三个文件:EdgeCanvas clip 栈、Scissor.intersect、求交单测。
判断: 改法对上 Prism 的嵌套 clip。Scroll.begin 先 clip 模块列表视口,展开模块再 pushClip 设置区;两者都是同一套布局坐标(Scroll 用 offset 改 y,不 translate)。旧实现是覆盖 scissor,Performance 设置区约 950px、面板最高 310px,会画出 chrome。求交并在 popClip 恢复外层是对的。单层 clip(歌词全屏等)行为不变。空集时 glScissor(0,0,0,0) 可以。
CI build / build-native 已绿。ScissorIntersectTest 覆盖了主路径求交、相离、负宽度;没有 EdgeCanvas 栈恢复的测(依赖 GL/MC)。
需要人工确认(这仓已 merge,当残余验收):
- 1.8.9:ClickGUI → 优化 → 展开 Performance,设置被 clip 在面板内且列表可滚。
- 点击测试不走 clip 栈(见下方 inline)。展开后点面板下方/蒙层,确认不会误触已 clip 掉的设置。若会,修正应在 Prism
UiFrame.clicked/hovered,不是这次 Edge 的 clip 栈。
没有在这个已 merge 的分支上推代码。
Sent by Cursor Automation: Edge 前置维护
| float[] parent = clips.peek(); | ||
| float[] next = parent == null | ||
| ? new float[] {x, y, w, h} | ||
| : Scissor.intersect(parent[0], parent[1], parent[2], parent[3], x, y, w, h); |
There was a problem hiding this comment.
这里只求交 GL scissor。Prism UiFrame.clicked / hovered 仍用原始矩形(Hit.inside / consumePressInBounds),不看这个栈。
Scroll.begin clip 的是列表视口;Performance 设置行的 layout box 仍可以伸出面板。画面被 clip 后,点面板下方或蒙层仍可能点到看不见的开关。
请在 1.8.9 上确认这种误点。若复现,改 Prism 的 hit-test,不要在 Edge 再改一套 clip 语义。


关联
Fixes #184
判断
这是一个可复现、范围清楚的 ClickGUI 溢出 bug,不是缺复现或高风险改动。
「优化」里的 Performance 有 50+ 项设置。展开后模块卡片高约 950px,而 ClickGUI 面板最高 310px。Prism 的
SharedClickGui会先 clip 模块列表视口,再 clip 展开设置区。Edge 的EdgeCanvas.pushClip原来是直接覆盖 scissor,不与外层相交,popClip也不恢复外层矩形。设置区的 clip 比面板高,内容就会画出 chrome 外。改动
EdgeCanvas维护 clip 栈:嵌套pushClip与当前视口求交,popClip恢复上一层Scissor.intersect提供纯矩形求交,方便测试验证
./gradlew test --tests "top.fpsmaster.utils.render.gui.ScissorIntersectTest"通过./gradlew test通过测试清单