Browse Source

Don't allow creating points outside of pixmap

This was not checked against in the mouse press handler.
Michael Pitidis 13 năm trước cách đây
mục cha
commit
541b237fbb
1 tập tin đã thay đổi với 2 bổ sung0 xóa
  1. 2 0
      canvas.py

+ 2 - 0
canvas.py

@@ -86,6 +86,8 @@ class Canvas(QWidget):
                     self.repaint()
                 else:
                     pos = self.transformPos(ev.posF())
+                    if self.outOfPixmap(pos):
+                        return
                     self.current = Shape()
                     self.line.points = [pos, pos]
                     self.current.addPoint(pos)