mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-09 02:06:54 +00:00
fix: restore Ctrl+drag panning on macOS (#15312)
On macOS wxWidgets reports Ctrl+left as a synthetic right button, which is what made Ctrl+drag pan the canvas. #14999 added an unconditional correction of the event's button state from wxGetMouseState(), which reports the physical buttons and knows nothing about that synthesis, so the synthetic right button was overwritten with a plain left button on every event. Ctrl+drag then matched the left button mapping and rotated instead of panning. Apply the correction only when the event carries no button state at all. On macOS wx populates button state only for the mouse-down and mouse-dragged event types, which are also the only ones the Ctrl+left translation touches, so the ImGui capture fix keeps every event it was added for. Fixes #15214 Co-authored-by: Noisyfox <timemanager.rick@gmail.com>
This commit is contained in:
@@ -4168,7 +4168,8 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
||||
// https://github.com/OrcaSlicer/OrcaSlicer/pull/14999#issuecomment-5151344759
|
||||
// We solve this by correcting the state of the event from the actual mouse state querying with `wxGetMouseState()`
|
||||
// so it works like on other platforms.
|
||||
{
|
||||
// Only fill in state the event does not carry, to preserve wx's synthetic right button for Ctrl+left.
|
||||
if (!evt.ButtonIsDown(wxMOUSE_BTN_ANY)) {
|
||||
const auto state = wxGetMouseState();
|
||||
evt.SetLeftDown(state.LeftIsDown());
|
||||
evt.SetMiddleDown(state.MiddleIsDown());
|
||||
|
||||
Reference in New Issue
Block a user