kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #21049
Re: [PATCH] Support of horizontal scrolling events in pcbnew and 3d-viewer
> On Nov 2, 2015, at 10:25 AM, Wayne Stambaugh <stambaughw@xxxxxxxxx> wrote:
>
> On 11/1/2015 9:42 AM, Bernhard Stegmaier wrote:
>> If this capability should be added now, it should be done consistent for all platforms.
>> We had this discussion for OS X already way back, but back then nobody seemed to be interested in adding also for Windows/Linux…
>>
>> Garth made some changes where you even could switch between mouse wheel X/Y panning and normal behaviour via preferences menu.
>
> If I remember correctly, Garth's changes broke the existing behavior
> which made it a non-starter. If this fix didn't break the existing
> behavior then I wouldn't have a problem accepting it but not until after
> the stable release. It's getting too late for changes that could
> potentially introduce new bugs. Our mouse event handling code is a mess
> and very fragile so adding more changes to it is just inviting problems.
>
To be clear, it did not break the behavior. It was a conscious decision to change the currently broken behavior. I knew it would not be received well, but whatever.
Garth
>>
>>
>> Regards,
>> Bernhard
>>
>>> On 01 Nov 2015, at 15:37, Nick Østergaard <oe.nick@xxxxxxxxx> wrote:
>>>
>>> By the way, could you please attach patches instead of inlining in the mail?
>>>
>>> 2015-11-01 11:54 GMT+01:00 Yauhen Kharuzhy <jekhor@xxxxxxxxx>:
>>>> Add handling of horizontal mouse wheel scrolling to new GL pcbnew canvas
>>>> and to 3d-viewer like eeschema has (left-right panning with Shift key down).
>>>>
>>>> Horizontal scrolling events are usual case for touchpads and TrackPoint
>>>> devices.
>>>>
>>>> Signed-off-by: Yauhen Kharuzhy <jekhor@xxxxxxxxx>
>>>> ---
>>>> 3d-viewer/3d_canvas.cpp | 6 ++++--
>>>> common/view/wx_view_controls.cpp | 26 ++++++++++++++++++++++++--
>>>> 2 files changed, 28 insertions(+), 4 deletions(-)
>>>>
>>>> diff --git a/3d-viewer/3d_canvas.cpp b/3d-viewer/3d_canvas.cpp
>>>> index 24d022a..c8d7e84 100644
>>>> --- a/3d-viewer/3d_canvas.cpp
>>>> +++ b/3d-viewer/3d_canvas.cpp
>>>> @@ -285,12 +285,14 @@ void EDA_3D_CANVAS::SetView3D( int keycode )
>>>>
>>>> void EDA_3D_CANVAS::OnMouseWheel( wxMouseEvent& event )
>>>> {
>>>> + int axis = event.GetWheelAxis();
>>>> +
>>>> if( event.ShiftDown() )
>>>> {
>>>> if( event.GetWheelRotation() < 0 )
>>>> - SetView3D( WXK_UP ); // move up
>>>> + SetView3D( (axis == wxMOUSE_WHEEL_VERTICAL) ? WXK_UP : WXK_RIGHT );
>>>> else
>>>> - SetView3D( WXK_DOWN ); // move down
>>>> + SetView3D( (axis == wxMOUSE_WHEEL_VERTICAL) ? WXK_DOWN : WXK_LEFT );
>>>> }
>>>> else if( event.ControlDown() )
>>>> {
>>>> diff --git a/common/view/wx_view_controls.cpp b/common/view/wx_view_controls.cpp
>>>> index 3484a15..b745d1b 100644
>>>> --- a/common/view/wx_view_controls.cpp
>>>> +++ b/common/view/wx_view_controls.cpp
>>>> @@ -102,14 +102,36 @@ void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& aEvent )
>>>> VECTOR2D scrollVec = m_view->ToWorld( m_view->GetScreenPixelSize(), false ) *
>>>> ( (double) aEvent.GetWheelRotation() * wheelPanSpeed );
>>>> double scrollSpeed;
>>>> + double deltaX = 0.0, deltaY = 0.0;
>>>>
>>>> if( std::abs( scrollVec.x ) > std::abs( scrollVec.y ) )
>>>> scrollSpeed = scrollVec.x;
>>>> else
>>>> scrollSpeed = scrollVec.y;
>>>>
>>>> - VECTOR2D delta( aEvent.ControlDown() ? -scrollSpeed : 0.0,
>>>> - aEvent.ShiftDown() ? -scrollSpeed : 0.0 );
>>>> + int axis = aEvent.GetWheelAxis();
>>>> +
>>>> + switch( axis )
>>>> + {
>>>> + case wxMOUSE_WHEEL_VERTICAL:
>>>> + if( aEvent.ControlDown() )
>>>> + {
>>>> + deltaX = -scrollSpeed;
>>>> + deltaY = 0.0;
>>>> + }
>>>> + else
>>>> + {
>>>> + deltaY = -scrollSpeed;
>>>> + deltaX = 0;
>>>> + }
>>>> + break;
>>>> + case wxMOUSE_WHEEL_HORIZONTAL:
>>>> + deltaX = scrollSpeed;
>>>> + deltaY = 0.0;
>>>> + break;
>>>> + }
>>>> +
>>>> + VECTOR2D delta( deltaX, deltaY );
>>>>
>>>> m_view->SetCenter( m_view->GetCenter() + delta );
>>>> }
>>>> --
>>>> 2.5.3
>>>>
>>>>
>>>> _______________________________________________
>>>> Mailing list: https://launchpad.net/~kicad-developers
>>>> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>>> More help : https://help.launchpad.net/ListHelp
>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~kicad-developers
>>> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>> More help : https://help.launchpad.net/ListHelp
>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help : https://help.launchpad.net/ListHelp
>>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help : https://help.launchpad.net/ListHelp
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
Follow ups
References