diff --git a/gui/response_design_view_widget.py b/gui/response_design_view_widget.py index cfe7910..c76a2ca 100644 --- a/gui/response_design_view_widget.py +++ b/gui/response_design_view_widget.py @@ -148,7 +148,7 @@ def render_layer(self, layer): def set_extents_and_scalefactor(self, extent): with block_signals_to(self.canvas): self.canvas.setExtent(extent) - self.canvas.zoomByFactor(self.parent_view.scaleFactor.value()) + self.canvas.zoomByFactor(round(self.parent_view.scaleFactor.value(), 1)) if self.marker.marker: self.marker.marker.updatePosition() @@ -250,7 +250,11 @@ def canvas_changed(self): if self.is_active: from AcATaMa.gui.response_design_window import ResponseDesignWindow view_extent = self.render_widget.canvas.extent() - view_extent.scale(1/self.current_scale_factor) + try: + view_extent.scale(1/self.current_scale_factor) + except ZeroDivisionError: + self.current_scale_factor = self.scaleFactor.minimum() + view_extent.scale(1 / self.current_scale_factor) # set extent and scale factor for all view activated except this view for view_widget in ResponseDesignWindow.view_widgets: @@ -262,7 +266,11 @@ def scalefactor_changed(self): # adjust view with the original extent (scale factor=1) # and with the new scale factor view_extent = self.render_widget.canvas.extent() - view_extent.scale(1 / self.current_scale_factor) + try: + view_extent.scale(1 / self.current_scale_factor) + except ZeroDivisionError: + self.current_scale_factor = self.scaleFactor.minimum() + view_extent.scale(1 / self.current_scale_factor) self.render_widget.set_extents_and_scalefactor(view_extent) # save the new scale factor - self.current_scale_factor = self.scaleFactor.value() \ No newline at end of file + self.current_scale_factor = round(self.scaleFactor.value(), 1) \ No newline at end of file diff --git a/ui/response_design_view_widget.ui b/ui/response_design_view_widget.ui index 6d18004..21809de 100644 --- a/ui/response_design_view_widget.ui +++ b/ui/response_design_view_widget.ui @@ -87,7 +87,7 @@ 1 - 0.000000000000000 + 0.100000000000000 1000.000000000000000 @@ -95,6 +95,9 @@ 0.100000000000000 + + QAbstractSpinBox::AdaptiveDecimalStepType + 1.000000000000000