Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2010-10-26 15:32:42 +0000
committerStijn Buys <ingar@osirion.org>2010-10-26 15:32:42 +0000
commit23c7d2c11170ee8736673e82a88e87a3d2e538f7 (patch)
treecd88e317a4f42391bc3567ed1881c160227cd3c6 /src/ui/modelview.cc
parent5189168482f32d8aac630cde27fc0999e70ed57b (diff)
enables ui::Slider mouse dragging, corrected a bug in ui::Widget coordinate mapping
Diffstat (limited to 'src/ui/modelview.cc')
-rwxr-xr-xsrc/ui/modelview.cc17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/ui/modelview.cc b/src/ui/modelview.cc
index 9542b5f..e756be0 100755
--- a/src/ui/modelview.cc
+++ b/src/ui/modelview.cc
@@ -25,7 +25,7 @@ ModelView::ModelView(Widget *parent, const char *modelname) : Widget(parent)
set_modelname(modelname);
modelview_zoom = 1.0f;
- modelview_manip = false;
+ modelview_dragging = false;
modelview_axis.clear();
modelview_axis.change_direction(180);
@@ -79,8 +79,7 @@ bool ModelView::on_keypress(const int key, const unsigned int modifier)
modelview_zoom = 10.0f;
return true;
} else if (key == 512 + SDL_BUTTON_LEFT) {
- //modelview_manipaxis.clear();
- modelview_manip = true;
+ modelview_dragging = true;
return true;
}
@@ -90,8 +89,7 @@ bool ModelView::on_keypress(const int key, const unsigned int modifier)
bool ModelView::on_keyrelease(const int key, const unsigned int modifier)
{
if (key == 512 + SDL_BUTTON_LEFT) {
- //modelview_manipaxis.clear();
- modelview_manip = false;
+ modelview_dragging = false;
return true;
}
@@ -104,18 +102,16 @@ void ModelView::on_mousemove(const math::Vector2f &cursor)
return;
}
- if (modelview_manip) {
+ if (modelview_dragging) {
const math::Vector2f pos(cursor - modelview_cursor);
const math::Vector3f up(0.0f, 0.0f, 1.0f);
const float zrot = 2.0f * M_PI * pos.x() / width();
modelview_axis.rotate(up, -zrot);
- //modelview_manipaxis.rotate(up, -zrot);
const math::Vector3f left(0.0f, 1.0f, 0.0f);
const float yrot = 2.0f * M_PI * pos.y() / height();
modelview_axis.rotate(left, yrot);
- //modelview_manipaxis.rotate(left, yrot);
modelview_cursor.assign(cursor);
}
@@ -125,8 +121,7 @@ void ModelView::on_mousemove(const math::Vector2f &cursor)
void ModelView::on_mouseover(const math::Vector2f &cursor)
{
modelview_cursor.assign(cursor);
- //modelview_manipaxis.clear();
- modelview_manip = false;
+ modelview_dragging = false;
}
void ModelView::draw_background()
@@ -190,7 +185,7 @@ void ModelView::draw()
/*
// draw manipulation marker
- if (has_mouse_focus() && modelview_manip) {
+ if (has_mouse_focus() && modelview_dragging) {
gl::push();
gl::multmatrix(modelview_manipaxis);