Commit ccc5e627 authored by Luke Campagnola's avatar Luke Campagnola
Browse files

Fixes:

 - GraphItem reports pixel margins to improve auto-range
 - ViewBox.setRange is more careful about disabling auto range for axes that are set
parent 58ed8ee7
......@@ -110,6 +110,11 @@ class GraphItem(GraphicsObject):
def boundingRect(self):
return self.scatter.boundingRect()
def dataBounds(self, *args, **kwds):
return self.scatter.dataBounds(*args, **kwds)
def pixelPadding(self):
return self.scatter.pixelPadding()
......
......@@ -394,6 +394,8 @@ class ViewBox(GraphicsWidget):
"""
#print self.name, "ViewBox.setRange", rect, xRange, yRange, padding
#import traceback
#traceback.print_stack()
changes = {} # axes
setRequested = [False, False]
......@@ -454,15 +456,11 @@ class ViewBox(GraphicsWidget):
lockY = False
self.updateViewRange(lockX, lockY)
# Disable auto-range if needed
# Disable auto-range for each axis that was requested to be set
if disableAutoRange:
if all(changed):
ax = ViewBox.XYAxes
elif changed[0]:
ax = ViewBox.XAxis
elif changed[1]:
ax = ViewBox.YAxis
self.enableAutoRange(ax, False)
xOff = False if setRequested[0] else None
yOff = False if setRequested[1] else None
self.enableAutoRange(x=xOff, y=yOff)
changed.append(True)
# If nothing has changed, we are done.
......@@ -1376,7 +1374,7 @@ class ViewBox(GraphicsWidget):
def updateMatrix(self, changed=None):
## Make the childGroup's transform match the requested viewRange.
#print self.name, "updateMAtrix", self.state['targetRange']
#if changed is None:
#changed = [False, False]
#changed = list(changed)
......
Supports Markdown
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