39 m_driver = std::make_unique<LIBSPNAV_DRIVER>();
81 wxLogTrace(
"spacenav",
"OnPan: x=%f, y=%f, z=%f", x, y, z );
86 if( std::fabs( x ) > std::numeric_limits<double>::epsilon() ||
87 std::fabs( y ) > std::numeric_limits<double>::epsilon() ||
88 std::fabs( z ) > std::numeric_limits<double>::epsilon() )
90 double tx = x * panFactor;
91 double tz = z * panFactor;
101 m_view->SetCenter( viewPos );
103 double zoom = y * panFactor;
108 double current_pixels =
m_canvas->GetClientSize().GetWidth();
109 double current_scale =
m_view->GetScale();
110 double desired_pixels = current_pixels +
zoom / 10.0;
112 if( desired_pixels < 1 )
115 double new_scale = current_scale * ( current_pixels / desired_pixels);
117 m_view->SetScale( new_scale, viewPos );
121 moveEvent.SetX( msp.
x );
122 moveEvent.SetY( msp.
y );
virtual KIGFX::VIEW * GetView() const
Return a pointer to the #VIEW instance used in the panel.
static const wxEventType EVT_REFRESH_MOUSE
Event that forces mouse move event in the dispatcher (eg.
virtual COMMON_SETTINGS * GetCommonSettings() const
void SetFocus(bool aFocus=true)
void onPollTimer(wxTimerEvent &evt)
void SetCanvas(EDA_DRAW_PANEL_GAL *aCanvas)
std::unique_ptr< SPACENAV_DRIVER > m_driver
void OnButton(int button, bool pressed) override
Handle button press/release events.
EDA_DRAW_PANEL_GAL * m_canvas
SPNAV_2D_PLUGIN(EDA_DRAW_PANEL_GAL *aCanvas)
void OnPan(double x, double y, double z) override
Handle translation (pan) events.
void OnRotate(double rx, double ry, double rz) override
Handle rotational events.
PGM_BASE & Pgm()
The global program "get" accessor.
VECTOR2< double > VECTOR2D
WX_VIEW_CONTROLS class definition.