diff --git a/README.md b/README.md index bb1ccb9..68194b4 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,8 @@ The rest match MS Paint's keyboard shortcuts: - Ctrl+Z: Undo - Ctrl+Y: Redo - F4: Redo +- Ctrl+PageUp: Large Size +- Ctrl+PageDown: Normal Size ## Development diff --git a/paint.py b/paint.py index c2c94d4..396b3ff 100644 --- a/paint.py +++ b/paint.py @@ -864,6 +864,8 @@ class PaintApp(App): ("shift+ctrl+z", "redo", _("Repeat")), ("ctrl+y", "redo", _("Repeat")), ("f4", "redo", _("Repeat")), + ("ctrl+pageup", "normal_size", _("Normal Size")), + ("ctrl+pagedown", "large_size", _("Large Size")), # action_toggle_dark is built in to App ("ctrl+d", "toggle_dark", _("Toggle Dark Mode")), # dev helper @@ -939,6 +941,13 @@ class PaintApp(App): """Called when selected_char changes.""" self.query_one("#selected_color").value = selected_char + def watch_magnification(self, old_magnification: int, magnification: int) -> None: + """Called when magnification changes.""" + self.canvas.magnification = 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... + def stamp_brush(self, x: int, y: int, affected_region_base: Region = None) -> Region: brush_diameter = 1 if self.selected_tool == Tool.brush or self.selected_tool == Tool.airbrush or self.selected_tool == Tool.eraser: @@ -1286,9 +1295,9 @@ class PaintApp(App): def action_text_toolbar(self) -> None: self.warning_message_box(_("Paint"), "Not implemented.", "ok") def action_normal_size(self) -> None: - self.warning_message_box(_("Paint"), "Not implemented.", "ok") + self.magnification = 1 def action_large_size(self) -> None: - self.warning_message_box(_("Paint"), "Not implemented.", "ok") + self.magnification = 4 def action_custom_zoom(self) -> None: self.warning_message_box(_("Paint"), "Not implemented.", "ok") def action_show_grid(self) -> None: