Commit cc64aef5 authored by Guillaume Seguin's avatar Guillaume Seguin

Improve and cleanup gviz resizing

parent 72bd19d8
...@@ -202,13 +202,12 @@ class gviz(wx.Panel): ...@@ -202,13 +202,12 @@ class gviz(wx.Panel):
pass pass
def resize(self, event): def resize(self, event):
oldwidth, oldheight = max(1.0, self.size[0]), max(1.0, self.size[1]) oldside = max(1.0, min(self.size))
oldside = min(oldwidth, oldheight) self.size = self.GetClientSizeTuple()
newwidth, newheight = self.GetClientSizeTuple() newside = max(1.0, min(self.size))
newwidth, newheight = [max(1.0, newwidth), max(1.0, newheight)] self.basescale = 2*[min(float(self.size[0])/self.build_dimensions[0],
newside = min(newwidth, newheight) float(self.size[1])/self.build_dimensions[1])]
zoomratio = float(newside) / oldside zoomratio = float(newside) / oldside
self.size = self.GetClientSize()
wx.CallAfter(self.zoom, 0, 0, zoomratio) wx.CallAfter(self.zoom, 0, 0, zoomratio)
def zoom(self, x, y, factor): def zoom(self, x, y, factor):
......
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