mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-18 14:32:36 +00:00
CAD: the wheel scrolls the card panel, it does not edit the field under it
wxSpinCtrlDouble takes the mouse wheel whenever the pointer is over it. A card taller than the panel therefore could not be scrolled past without silently incrementing whatever field the cursor happened to be over — measured on the rig: eight notches over the Coord Sys card turned an X hint from 1,00 into 6,00 while the panel did not move at all. The same gesture over an Extrude distance, a Hole diameter or a mate Offset is a silent model change made by someone who believed they were navigating, and nothing on screen reports it. Every spin in this panel comes from one factory, so the guard goes there: an unfocused spin hands the wheel to its parent, and the scrolled cards panel gets it. A spin the user has deliberately focused still takes the wheel, which is the one case where editing is what was meant. Verified on the rig with an Extrude card: eight notches over an unfocused Distance leave it at 10,00; clicking into it first and scrolling takes it to 13,00.
This commit is contained in:
@@ -189,6 +189,18 @@ static wxSpinCtrlDouble* make_spin(wxWindow* parent, double val,
|
||||
s->SetRange(mn, mx);
|
||||
s->SetDigits(2);
|
||||
s->SetValue(val);
|
||||
// THE WHEEL SCROLLS THE PANEL, IT DOES NOT EDIT THE VALUE. wxSpinCtrlDouble takes the wheel
|
||||
// whenever the pointer is over it, so a card taller than the panel could not be scrolled past
|
||||
// without silently incrementing whatever field happened to be under the cursor — measured:
|
||||
// eight notches turned an X hint from 1,00 into 6,00, and the same gesture over an Extrude
|
||||
// distance or a mate Offset is a silent model change made by someone who thought they were
|
||||
// navigating. Skipping the event lets it reach the scrolled cards panel. A spin the user has
|
||||
// deliberately focused still takes the wheel, which is the one case where editing is meant.
|
||||
s->Bind(wxEVT_MOUSEWHEEL, [s](wxMouseEvent& e) {
|
||||
if (wxWindow::FindFocus() == s) e.Skip(); // focused: wheel edits, as expected
|
||||
else if (wxWindow* p = s->GetParent()) // otherwise hand it to the panel
|
||||
wxPostEvent(p, e);
|
||||
});
|
||||
auto* sz = new wxBoxSizer(wxHORIZONTAL);
|
||||
sz->Add(s, 1, wxEXPAND | wxALL, parent->FromDIP(2));
|
||||
box->SetSizer(sz);
|
||||
|
||||
Reference in New Issue
Block a user