Conversation
Co-authored-by: FeJS8888 <110683147+FeJS8888@users.noreply.github.com>
Co-authored-by: FeJS8888 <110683147+FeJS8888@users.noreply.github.com>
Co-authored-by: FeJS8888 <110683147+FeJS8888@users.noreply.github.com>
|
@copilot 现在有如下问题,Panel等在处理鼠标滚动的时候,如果内部输入框有焦点,无法滚动。 |
… focusingWidget==this Co-authored-by: FeJS8888 <110683147+FeJS8888@users.noreply.github.com>
Fixed in 8e4c368. Root cause: the scrollbar wheel-event guard was |
|
@copilot 现在我们在鼠标停留在Panel的某个超出范围的不可见的InputBox上方,鼠标指针会被不正确的设置。请仔细阅读逻辑,进行修复 |
…mouse-leave Co-authored-by: FeJS8888 <110683147+FeJS8888@users.noreply.github.com>
Fixed in 57c6db9. Root cause: the mouse-leave dispatch was forwarding the real mouse coordinates to all children. When a child InputBox is scrolled out of the Panel viewport, its absolute position is placed outside the Panel bounds (that's how scroll works). If the real mouse happened to be at that same out-of-panel location, Fix: replace the real coordinates with a synthetic |
There was a problem hiding this comment.
Pull request overview
This PR aligns Box mouse-wheel scrolling behavior with the existing Panel/ScrollBar smooth-scroll implementation, and fixes several Panel ↔ InputBox interaction bugs (cursor shape and scroll dispatch when a child has focus).
Changes:
- Implement smooth mouse-wheel scrolling for
Box(without a visible scrollbar), mirroringPanel/ScrollBarbehavior. - Fix cursor getting stuck as
IDC_IBEAMby dispatching a synthetic mouse-leave to children when leaving aPanel. - Add a
Widget::reset()hook and propagate reset/redraw across containers; update.gitignoreand bumpxegesubmodule.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| src/Widget.cpp | Implements reset hooks; adjusts Panel scrollbar + leave dispatch; adds Box smooth wheel scrolling; tweaks InputBox content sync; resets on order assignment. |
| include/Widget.h | Introduces Widget::reset() and shared needRedraw; adds overrides for Panel/Button/InputBox/Box; extends InputBox setContent API. |
| 3rdparty/xege | Updates submodule commit. |
| .gitignore | Ignores common CMake/build output directories/files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (msg.is_move() && (mouseOwningFlag == nullptr || mouseOwningFlag == this)) { | ||
| mouse_msg leaveMsg = msg; | ||
| leaveMsg.x = -99999; | ||
| leaveMsg.y = -99999; | ||
| for (Widget* w : children) { | ||
| w->handleEvent(leaveMsg); | ||
| } | ||
| } |
|
|
||
| void assignOrder(std::vector<Widget*> widgetWithOrder){ | ||
| swap(widgetWithOrder,widgets); | ||
| for(Widget* w : widgetWithOrder){ |
| ripples.shrink_to_fit(); | ||
| } | ||
|
|
| ripples.shrink_to_fit(); | ||
| } | ||
|
|
| if (layout) { | ||
| LayoutResult extentResult = layout->apply(*this, 0); | ||
| double contentH = extentResult.contentMaxY - extentResult.contentMinY; | ||
| double viewH = height / (scale > 0 ? scale : 1.0); | ||
| double maxScroll = contentH - viewH; |
| // 应用布局(带滚动偏移) | ||
| if (layout) layout->apply(*this, layoutScrollOffset); |
setCursor(IDC_IBEAM)leaveMsgwith coordinates(-99999, -99999)— guaranteed outside all children — so only thelastInsidereset path triggers, never theisInside = truecursor-set path💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.