From 782be49e8f27e52e3517a185a0e5d98f859cd56a Mon Sep 17 00:00:00 2001 From: Viet Anh Nguyen Date: Mon, 1 May 2023 23:04:30 +0700 Subject: [PATCH] Fix crashing when scrolling --- anylabeling/views/labeling/label_widget.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/anylabeling/views/labeling/label_widget.py b/anylabeling/views/labeling/label_widget.py index 6429134..cd1db1f 100644 --- a/anylabeling/views/labeling/label_widget.py +++ b/anylabeling/views/labeling/label_widget.py @@ -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): @@ -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,