Skip to content

Commit

Permalink
Added more controls to preview window
Browse files Browse the repository at this point in the history
- Shift + RMB to pan
- MMB to pan
- LMB to pan
- Shift + MMB to zoom
  • Loading branch information
ousnius committed Jan 21, 2016
1 parent 6df757d commit d96ac9a
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions PreviewWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,17 +294,26 @@ void PreviewCanvas::OnMotion(wxMouseEvent& event) {
if (previewWindow->IsActive())
SetFocus();

auto delta = event.GetPosition() - lastMousePosition;

if (event.LeftIsDown()) {
auto delta = event.GetPosition() - lastMousePosition;
previewWindow->LeftDrag(delta.x, delta.y);
}
if (event.RightIsDown()) {
auto delta = event.GetPosition() - lastMousePosition;
previewWindow->RightDrag(delta.x, delta.y);
else if (event.MiddleIsDown()) {
if (wxGetKeyState(WXK_SHIFT))
previewWindow->MouseWheel(delta.y);
else
previewWindow->LeftDrag(delta.x, delta.y);
}
if (!event.LeftIsDown() && !event.RightIsDown()) {
previewWindow->TrackMouse(event.GetX(), event.GetY());
else if (event.RightIsDown()) {
if (wxGetKeyState(WXK_SHIFT))
previewWindow->LeftDrag(delta.x, delta.y);
else
previewWindow->RightDrag(delta.x, delta.y);
}
else
previewWindow->TrackMouse(event.GetX(), event.GetY());

lastMousePosition = event.GetPosition();
}

Expand Down

0 comments on commit d96ac9a

Please sign in to comment.