Prevent from creating a zero sized box
This commit is contained in:
+6
-3
@@ -244,9 +244,6 @@ class Canvas(QWidget):
|
|||||||
self.current.addPoint(QPointF(maxX, minY))
|
self.current.addPoint(QPointF(maxX, minY))
|
||||||
self.current.addPoint(targetPos)
|
self.current.addPoint(targetPos)
|
||||||
self.current.addPoint(QPointF(minX, maxY))
|
self.current.addPoint(QPointF(minX, maxY))
|
||||||
self.current.addPoint(initPos)
|
|
||||||
self.current.close()
|
|
||||||
self.line[0] = self.current[-1]
|
|
||||||
self.finalise()
|
self.finalise()
|
||||||
elif not self.outOfPixmap(pos):
|
elif not self.outOfPixmap(pos):
|
||||||
self.current = Shape()
|
self.current = Shape()
|
||||||
@@ -449,6 +446,12 @@ class Canvas(QWidget):
|
|||||||
|
|
||||||
def finalise(self):
|
def finalise(self):
|
||||||
assert self.current
|
assert self.current
|
||||||
|
if self.current.points[0] == self.current.points[-1]:
|
||||||
|
self.current = None
|
||||||
|
self.drawingPolygon.emit(False)
|
||||||
|
self.update()
|
||||||
|
return
|
||||||
|
|
||||||
self.current.close()
|
self.current.close()
|
||||||
self.shapes.append(self.current)
|
self.shapes.append(self.current)
|
||||||
self.current = None
|
self.current = None
|
||||||
|
|||||||
Reference in New Issue
Block a user