Skip to content

Commit

Permalink
Adding ability to add or remove points from existing polygon when lef…
Browse files Browse the repository at this point in the history
…t-clicking while holding down the SHIFT-key.
  • Loading branch information
hetfmt authored and wkentaro committed Sep 15, 2020
1 parent 4e46e00 commit 7189f2c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions labelme/widgets/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,19 @@ def mouseReleaseEvent(self, ev):
self.repaint()
elif ev.button() == QtCore.Qt.LeftButton and self.selectedShapes:
self.overrideCursor(CURSOR_GRAB)
if (
self.editing()
and int(ev.modifiers()) == QtCore.Qt.ShiftModifier
):
# Add point to line if: left-click + SHIFT on a line segment
self.addPointToEdge()
elif ev.button() == QtCore.Qt.LeftButton and self.selectedVertex():
if (
self.editing()
and int(ev.modifiers()) == QtCore.Qt.ShiftModifier
):
# Delete point if: left-click + SHIFT on a point
self.removeSelectedPoint()

if self.movingShape and self.hShape:
index = self.shapes.index(self.hShape)
Expand Down

0 comments on commit 7189f2c

Please sign in to comment.