Skip to content

Commit

Permalink
Remove slight shifting when duplicate
Browse files Browse the repository at this point in the history
  • Loading branch information
wkentaro committed Sep 20, 2024
1 parent f8ad3bc commit 242563a
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions labelme/widgets/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,20 +669,9 @@ def deleteShape(self, shape):
def duplicateSelectedShapes(self):
if self.selectedShapes:
self.selectedShapesCopy = [s.copy() for s in self.selectedShapes]
self.boundedShiftShapes(self.selectedShapesCopy)
self.endMove(copy=True)
return self.selectedShapes

def boundedShiftShapes(self, shapes):
# Try to move in one direction, and if it fails in another.
# Give up if both fail.
point = shapes[0][0]
offset = QtCore.QPointF(2.0, 2.0)
self.offsets = QtCore.QPoint(), QtCore.QPoint()
self.prevPoint = point
if not self.boundedMoveShapes(shapes, point - offset):
self.boundedMoveShapes(shapes, point + offset)

def paintEvent(self, event):
if not self.pixmap:
return super(Canvas, self).paintEvent(event)
Expand Down

0 comments on commit 242563a

Please sign in to comment.