Skip to content

Commit

Permalink
Fix crashing when scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
vietanhdev committed May 1, 2023
1 parent c2bd7e8 commit 782be49
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions anylabeling/views/labeling/label_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -1746,7 +1746,7 @@ def scroll_request(self, delta, orientation):
self.set_scroll(orientation, value)

def set_scroll(self, orientation, value):
self.scroll_bars[orientation].setValue(value)
self.scroll_bars[orientation].setValue(round(value))
self.scroll_values[orientation][self.filename] = value

def set_zoom(self, value):
Expand Down Expand Up @@ -1775,8 +1775,8 @@ def zoom_request(self, delta, pos):
if canvas_width_old != canvas_width_new:
canvas_scale_factor = canvas_width_new / canvas_width_old

x_shift = round(pos.x() * canvas_scale_factor) - pos.x()
y_shift = round(pos.y() * canvas_scale_factor) - pos.y()
x_shift = round(pos.x() * canvas_scale_factor - pos.x())
y_shift = round(pos.y() * canvas_scale_factor - pos.y())

self.set_scroll(
Qt.Horizontal,
Expand Down

0 comments on commit 782be49

Please sign in to comment.