Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make point-manip reasonable: ALT+Click (add), ALT+SHIFT+Click (delete) #1496

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions labelme/widgets/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,12 @@ def mouseMoveEvent(self, ev):
self.hEdge = None
shape.highlightVertex(index, shape.MOVE_VERTEX)
self.overrideCursor(CURSOR_POINT)
self.setToolTip(self.tr("Click & drag to move point"))
self.setToolTip(
self.tr(
"Click & Drag to move point\n"
"ALT + SHIFT + Click to delete point"
)
)
self.setStatusTip(self.toolTip())
self.update()
break
Expand All @@ -354,7 +359,7 @@ def mouseMoveEvent(self, ev):
self.prevhShape = self.hShape = shape
self.prevhEdge = self.hEdge = index_edge
self.overrideCursor(CURSOR_POINT)
self.setToolTip(self.tr("Click to create point"))
self.setToolTip(self.tr("ALT + Click to create point"))
self.setStatusTip(self.toolTip())
self.update()
break
Expand Down Expand Up @@ -466,13 +471,11 @@ def mousePressEvent(self, ev):
self.drawingPolygon.emit(True)
self.update()
elif self.editing():
if self.selectedEdge():
if self.selectedEdge() and ev.modifiers() == QtCore.Qt.AltModifier:
self.addPointToEdge()
elif (
self.selectedVertex()
and int(ev.modifiers()) == QtCore.Qt.ShiftModifier
elif self.selectedVertex() and ev.modifiers() == (
QtCore.Qt.AltModifier | QtCore.Qt.ShiftModifier
):
# Delete point if: left-click + SHIFT on a point
self.removeSelectedPoint()

group_mode = int(ev.modifiers()) == QtCore.Qt.ControlModifier
Expand Down
Loading