31 const int* aAttribList,
const wxPoint& aPos,
32 const wxSize& aSize,
long aStyle,
const wxString& aName,
33 const wxPalette& aPalette ) :
34 HIDPI_GL_CANVAS( aParent, wxID_ANY, aAttribList, aPos, aSize, aStyle, aName, aPalette ),
35 m_mouse_is_moving( false ),
36 m_mouse_was_moved( false ),
37 m_camera_is_moving( false ),
53 if( event.Dragging() )
55 if( event.LeftIsDown() )
57 else if( event.MiddleIsDown() )
69 bool mouseActivity =
false;
77 delta_move *= 0.01f *
event.GetWheelRotation();
78 else if( event.GetWheelRotation() < 0 )
79 delta_move = -delta_move;
90 if( aPan && !event.ControlDown() )
92 if( event.GetWheelAxis() == wxMOUSE_WHEEL_HORIZONTAL || event.ShiftDown() )
99 else if( event.ShiftDown() && !aPan )
102 mouseActivity =
true;
104 else if( event.ControlDown() && !aPan )
107 mouseActivity =
true;
111 mouseActivity =
m_camera.
Zoom( event.GetWheelRotation() > 0 ? 1.1f : 1 / 1.1f );
A class used to derive camera objects from.
virtual void Pan(const wxPoint &aNewMousePosition)=0
virtual void Drag(const wxPoint &aNewMousePosition)=0
Calculate a new mouse drag position.
bool SetCurWindowSize(const wxSize &aSize)
Update the windows size of the camera.
void SetCurMousePosition(const wxPoint &aPosition)
Update the current mouse position without make any new calculations on camera.
static const float m_delta_move_step_factor
HIDPI_GL_3D_CANVAS(CAMERA &aCamera, wxWindow *parent, wxWindowID id=wxID_ANY, const int *attribList=nullptr, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxGLCanvasName, const wxPalette &palette=wxNullPalette)
void OnMouseWheelCamera(wxMouseEvent &event, bool aPan)
void OnMouseMoveCamera(wxMouseEvent &event)
wxGLCanvas wrapper for HiDPI/Retina support.
virtual wxSize GetNativePixelSize() const
wxPoint GetNativePosition(const wxPoint &aPoint) const
Convert the given point from client coordinates to native pixel coordinates.