Catch OverflowError from Point.length()
This commit is contained in:
parent
cff168b9f0
commit
4486272737
@ -162,8 +162,14 @@ class PlotCurveItem(GraphicsObject):
|
||||
if pxPad > 0:
|
||||
# determine length of pixel in local x, y directions
|
||||
px, py = self.pixelVectors()
|
||||
try:
|
||||
px = 0 if px is None else px.length()
|
||||
except OverflowError:
|
||||
px = 0
|
||||
try:
|
||||
py = 0 if py is None else py.length()
|
||||
except OverflowError:
|
||||
py = 0
|
||||
|
||||
# return bounds expanded by pixel size
|
||||
px *= pxPad
|
||||
|
@ -664,8 +664,11 @@ class ROI(GraphicsObject):
|
||||
if not self.rotateAllowed:
|
||||
return
|
||||
## If the handle is directly over its center point, we can't compute an angle.
|
||||
try:
|
||||
if lp1.length() == 0 or lp0.length() == 0:
|
||||
return
|
||||
except OverflowError:
|
||||
return
|
||||
|
||||
## determine new rotation angle, constrained if necessary
|
||||
ang = newState['angle'] - lp0.angle(lp1)
|
||||
@ -704,8 +707,11 @@ class ROI(GraphicsObject):
|
||||
else:
|
||||
scaleAxis = 0
|
||||
|
||||
try:
|
||||
if lp1.length() == 0 or lp0.length() == 0:
|
||||
return
|
||||
except OverflowError:
|
||||
return
|
||||
|
||||
ang = newState['angle'] - lp0.angle(lp1)
|
||||
if ang is None:
|
||||
|
@ -652,8 +652,14 @@ class ScatterPlotItem(GraphicsObject):
|
||||
if pxPad > 0:
|
||||
# determine length of pixel in local x, y directions
|
||||
px, py = self.pixelVectors()
|
||||
try:
|
||||
px = 0 if px is None else px.length()
|
||||
except OverflowError:
|
||||
px = 0
|
||||
try:
|
||||
py = 0 if py is None else py.length()
|
||||
except OverflowError:
|
||||
py = 0
|
||||
|
||||
# return bounds expanded by pixel size
|
||||
px *= pxPad
|
||||
|
Loading…
Reference in New Issue
Block a user