From 67b4ec8ac4a3617bcb7e9e5cb1f8a0990fa14c12 Mon Sep 17 00:00:00 2001 From: Isaiah Odhner Date: Tue, 11 Jul 2023 02:41:44 -0400 Subject: [PATCH] Return to custom zoom level when zooming out and back in --- README.md | 1 - src/textual_paint/paint.py | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 69e104d..93e8193 100644 --- a/README.md +++ b/README.md @@ -201,7 +201,6 @@ To preview ANSI art files in file managers like Nautilus, Thunar, Nemo, or Caja, - Can click Cancel button of Edit Colors dialog while opening it, if the mouse lines up with it. - Hitting Enter in View Bitmap mode exits the mode but may also trigger a menu item. Menu items ought to be disabled when hidden, and View Bitmap should prevent the key event from taking other actions if possible. - Airbrush is continuous in space instead of time. It should keep spraying while the mouse stays still. -- After setting a custom zoom level, the magnifier tool will not return to the custom zoom level when un-magnifying and re-magnifying. The program has only been tested on Linux. Issues on other platforms are as-yet _unknown_ :) diff --git a/src/textual_paint/paint.py b/src/textual_paint/paint.py index 267dc92..cdb46f2 100755 --- a/src/textual_paint/paint.py +++ b/src/textual_paint/paint.py @@ -2441,6 +2441,9 @@ class PaintApp(App[None]): def watch_magnification(self, old_magnification: int, magnification: int) -> None: """Called when magnification changes.""" self.canvas.magnification = magnification + if old_magnification != 1: + self.return_to_magnification = old_magnification + # TODO: keep the top left corner of the viewport in the same place # https://github.com/1j01/jspaint/blob/12a90c6bb9d36f495dc6a07114f9667c82ee5228/src/functions.js#L326-L351 # This will matter more when large documents don't freeze up the program...