Merge pull request #1312 from campagnola/acq4-merge

TargetItem fix + performance improvements
This commit is contained in:
Luke Campagnola 2020-07-13 17:33:07 -07:00 committed by GitHub
commit d3ed45574e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,6 +39,7 @@ class TargetItem(GraphicsObject):
self._updateLabel()
def setLabelAngle(self, angle):
if self.labelAngle != angle:
self.labelAngle = angle
self._updateLabel()
@ -81,8 +82,14 @@ class TargetItem(GraphicsObject):
# Note: could do this with self.pixelLength, but this is faster.
o = self.mapToScene(QtCore.QPointF(0, 0))
px = abs(1.0 / (self.mapToScene(QtCore.QPointF(1, 0)) - o).x())
py = abs(1.0 / (self.mapToScene(QtCore.QPointF(0, 1)) - o).y())
dx = (self.mapToScene(QtCore.QPointF(1, 0)) - o).x()
dy = (self.mapToScene(QtCore.QPointF(0, 1)) - o).y()
if dx == 0 or dy == 0:
p.end()
self._bounds = QtCore.QRectF()
return
px = abs(1.0 / dx)
py = abs(1.0 / dy)
r, w, h = self._radii
w = w * px