Commit df858550 authored by sumpfralle's avatar sumpfralle

r647@erker: lars | 2010-02-11 20:13:12 +0100

 added first draft of mouse movement handling


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@112 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 93ae69d8
...@@ -18,6 +18,7 @@ import gtk ...@@ -18,6 +18,7 @@ import gtk
import os import os
import sys import sys
import time import time
import math
GTKBUILD_FILE = os.path.join(os.path.dirname(__file__), "gtk-interface", "pycam-project.ui") GTKBUILD_FILE = os.path.join(os.path.dirname(__file__), "gtk-interface", "pycam-project.ui")
...@@ -116,8 +117,21 @@ class GLView: ...@@ -116,8 +117,21 @@ class GLView:
else: else:
# a button was pressed before # a button was pressed before
if self.mouse["button"] == state: if self.mouse["button"] == state:
if state == BUTTON_ZOOM:
# the start button is still active: update the view # the start button is still active: update the view
pass current_scale = self.settings.get("scale")
diff = x - self.mouse["start_pos"][0]
if -10 <= diff <= 10:
return
elif diff > 0:
change = +math.log(diff/10)
else:
change = -math.log(-diff/10)
new_scale = current_scale + change
print "%f -> %f" % (current_scale, new_scale)
GL.glMatrixMode(GL.GL_MODELVIEW)
GL.glLoadIdentity()
GL.glScalef(new_scale, new_scale, new_scale)
else: else:
# button was released # button was released
self.mouse["button"] = None self.mouse["button"] = None
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment