All: fix horizontal touchpad panning
Commit e10c01aaf
didn't work when touchpad panning was enabled.
This commit changes it to only discard horizontal wheel events
when in "scroll mode" rather than "pan mode".
Based on a patch by Adrian Scripcă <benishor@gmail.com>.
Follow-up to fix: lp:1828080
https://bugs.launchpad.net/kicad/+bug/1828080
This commit is contained in:
parent
3e5005698c
commit
e6fe220f84
|
@ -147,8 +147,6 @@ void WX_VIEW_CONTROLS::onMotion( wxMouseEvent& aEvent )
|
||||||
|
|
||||||
void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& aEvent )
|
void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& aEvent )
|
||||||
{
|
{
|
||||||
const double wheelPanSpeed = 0.001;
|
|
||||||
|
|
||||||
#ifdef __WXGTK3__
|
#ifdef __WXGTK3__
|
||||||
if( aEvent.GetTimestamp() == m_lastTimestamp )
|
if( aEvent.GetTimestamp() == m_lastTimestamp )
|
||||||
{
|
{
|
||||||
|
@ -159,11 +157,8 @@ void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& aEvent )
|
||||||
m_lastTimestamp = aEvent.GetTimestamp();
|
m_lastTimestamp = aEvent.GetTimestamp();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Fix issue caused by modern mice that feature horizontal scrolling by only handling
|
const double wheelPanSpeed = 0.001;
|
||||||
// vertical axis, otherwise horizontal scrolling events end up interpreted as vertical
|
const int axis = aEvent.GetWheelAxis();
|
||||||
// scroll events and confuse the user.
|
|
||||||
if( aEvent.GetWheelAxis() > 0 )
|
|
||||||
return;
|
|
||||||
|
|
||||||
// mousewheelpan disabled:
|
// mousewheelpan disabled:
|
||||||
// wheel + ctrl -> horizontal scrolling;
|
// wheel + ctrl -> horizontal scrolling;
|
||||||
|
@ -180,7 +175,6 @@ void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& aEvent )
|
||||||
// Scrolling
|
// Scrolling
|
||||||
VECTOR2D scrollVec = m_view->ToWorld( m_view->GetScreenPixelSize(), false ) *
|
VECTOR2D scrollVec = m_view->ToWorld( m_view->GetScreenPixelSize(), false ) *
|
||||||
( (double) aEvent.GetWheelRotation() * wheelPanSpeed );
|
( (double) aEvent.GetWheelRotation() * wheelPanSpeed );
|
||||||
int axis = aEvent.GetWheelAxis();
|
|
||||||
double scrollX = 0.0;
|
double scrollX = 0.0;
|
||||||
double scrollY = 0.0;
|
double scrollY = 0.0;
|
||||||
|
|
||||||
|
@ -206,18 +200,24 @@ void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& aEvent )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int rotation = aEvent.GetWheelRotation();
|
// Restrict zoom handling to the vertical axis, otherwise horizontal
|
||||||
double zoomScale = m_zoomController->GetScaleForRotation( rotation );
|
// scrolling events (e.g. touchpads and some mice) end up interpreted
|
||||||
|
// as vertical scroll events and confuse the user.
|
||||||
|
if( axis == wxMOUSE_WHEEL_VERTICAL )
|
||||||
|
{
|
||||||
|
const int rotation = aEvent.GetWheelRotation();
|
||||||
|
const double zoomScale = m_zoomController->GetScaleForRotation( rotation );
|
||||||
|
|
||||||
if( IsCursorWarpingEnabled() )
|
if( IsCursorWarpingEnabled() )
|
||||||
{
|
{
|
||||||
CenterOnCursor();
|
CenterOnCursor();
|
||||||
m_view->SetScale( m_view->GetScale() * zoomScale );
|
m_view->SetScale( m_view->GetScale() * zoomScale );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VECTOR2D anchor = m_view->ToWorld( VECTOR2D( aEvent.GetX(), aEvent.GetY() ) );
|
const VECTOR2D anchor = m_view->ToWorld( VECTOR2D( aEvent.GetX(), aEvent.GetY() ) );
|
||||||
m_view->SetScale( m_view->GetScale() * zoomScale, anchor );
|
m_view->SetScale( m_view->GetScale() * zoomScale, anchor );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue