Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/modelview.cc')
-rwxr-xr-xsrc/ui/modelview.cc26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/ui/modelview.cc b/src/ui/modelview.cc
index 679c7b6..f1676b1 100755
--- a/src/ui/modelview.cc
+++ b/src/ui/modelview.cc
@@ -100,19 +100,29 @@ void ModelView::set_zoom(const float zoom)
math::clamp(modelview_zoom, 1.0f, 5.0f);
}
-bool ModelView::on_keypress(const int key, const unsigned int modifier)
+bool ModelView::on_mousewheel(const math::Vector2f & direction)
{
- if (key == 512 + SDL_BUTTON_WHEELUP) {
+ if (direction.y() > 0 )
+ {
modelview_zoom -= 0.25f;
if (modelview_zoom < 1.0f)
modelview_zoom = 1.0f;
return true;
- } else if (key == 512 + SDL_BUTTON_WHEELDOWN) {
+ } else if (direction.y() < 0 )
+ {
modelview_zoom += 0.25f;
if (modelview_zoom > 5.0f)
modelview_zoom = 5.0f;
return true;
- } else if (key == 512 + SDL_BUTTON_LEFT) {
+ }
+
+ return false;
+}
+
+bool ModelView::on_mousepress(const unsigned int button)
+{
+ if (button == SDL_BUTTON_LEFT)
+ {
modelview_dragging = true;
return true;
}
@@ -120,9 +130,10 @@ bool ModelView::on_keypress(const int key, const unsigned int modifier)
return false;
}
-bool ModelView::on_keyrelease(const int key, const unsigned int modifier)
+bool ModelView::on_mouserelease(const unsigned int button)
{
- if (key == 512 + SDL_BUTTON_LEFT) {
+ if (button == SDL_BUTTON_LEFT)
+ {
modelview_dragging = false;
return true;
}
@@ -132,7 +143,8 @@ bool ModelView::on_keyrelease(const int key, const unsigned int modifier)
void ModelView::on_mousemove(const math::Vector2f &cursor)
{
- if ((width() <= 0) || (height() <= 0)) {
+ if ((width() <= 0) || (height() <= 0))
+ {
return;
}