Commit 505dc9d4 authored by sumpfralle's avatar sumpfralle

update the view after applying a unit change

position the camera according to the model dimension instead of the bounding box


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@333 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 585f7a34
......@@ -157,9 +157,10 @@ class Camera:
v = self.view
# position the light according to the current bounding box
light_pos = range(3)
light_pos[0] = 2 * self.settings.get("maxx") - self.settings.get("minx")
light_pos[1] = 2 * self.settings.get("maxy") - self.settings.get("miny")
light_pos[2] = 2 * self.settings.get("maxz") - self.settings.get("minz")
model = self.settings.get("model")
light_pos[0] = 2 * model.maxx - model.minx
light_pos[1] = 2 * model.maxy - model.miny
light_pos[2] = 2 * model.maxz - model.minz
GL.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, (light_pos[0], light_pos[1], light_pos[2], 1.0))
# position the camera
camera_position = (v["center"][0] + v["distance"][0],
......
......@@ -918,6 +918,8 @@ class ProjectGui:
self._last_unit = new_unit
# update all labels containing the unit size
self.update_unit_labels()
# redraw the model
self.update_view()
def update_unit_labels(self, widget=None, data=None):
# we can't just use the "unit" setting, since we need the plural of "inch"
......
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