fix a bug: creating a box with one point

This commit is contained in:
Jaewoo Choi 2017-08-22 20:12:17 +09:00
parent fcffa12842
commit 95ff5062fe
2 changed files with 3 additions and 5 deletions

View File

@ -245,8 +245,8 @@ class Canvas(QWidget):
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.addPoint(initPos)
self.current.close()
self.line[0] = self.current[-1] self.line[0] = self.current[-1]
if self.current.isClosed():
self.finalise() self.finalise()
elif not self.outOfPixmap(pos): elif not self.outOfPixmap(pos):
self.current = Shape() self.current = Shape()

View File

@ -67,9 +67,7 @@ class Shape(object):
return False return False
def addPoint(self, point): def addPoint(self, point):
if self.points and point == self.points[0]: if not self.reachMaxPoints():
self.close()
else:
self.points.append(point) self.points.append(point)
def popPoint(self): def popPoint(self):