浏览代码

Don't allow creating points outside of pixmap

This was not checked against in the mouse press handler.
Michael Pitidis 13 年之前
父节点
当前提交
541b237fbb
共有 1 个文件被更改,包括 2 次插入0 次删除
  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)