mirror of
https://github.com/1j01/textual-paint.git
synced 2024-09-11 15:56:03 +03:00
Implement View > Zoom > Large Size / Normal Size
This commit is contained in:
parent
da9813ea9b
commit
68d069fa8d
@ -106,6 +106,8 @@ The rest match MS Paint's keyboard shortcuts:
|
|||||||
- <kbd>Ctrl</kbd>+<kbd>Z</kbd>: Undo
|
- <kbd>Ctrl</kbd>+<kbd>Z</kbd>: Undo
|
||||||
- <kbd>Ctrl</kbd>+<kbd>Y</kbd>: Redo
|
- <kbd>Ctrl</kbd>+<kbd>Y</kbd>: Redo
|
||||||
- <kbd>F4</kbd>: Redo
|
- <kbd>F4</kbd>: Redo
|
||||||
|
- <kbd>Ctrl</kbd>+<kbd>PageUp</kbd>: Large Size
|
||||||
|
- <kbd>Ctrl</kbd>+<kbd>PageDown</kbd>: Normal Size
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
|
13
paint.py
13
paint.py
@ -864,6 +864,8 @@ class PaintApp(App):
|
|||||||
("shift+ctrl+z", "redo", _("Repeat")),
|
("shift+ctrl+z", "redo", _("Repeat")),
|
||||||
("ctrl+y", "redo", _("Repeat")),
|
("ctrl+y", "redo", _("Repeat")),
|
||||||
("f4", "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
|
# action_toggle_dark is built in to App
|
||||||
("ctrl+d", "toggle_dark", _("Toggle Dark Mode")),
|
("ctrl+d", "toggle_dark", _("Toggle Dark Mode")),
|
||||||
# dev helper
|
# dev helper
|
||||||
@ -939,6 +941,13 @@ class PaintApp(App):
|
|||||||
"""Called when selected_char changes."""
|
"""Called when selected_char changes."""
|
||||||
self.query_one("#selected_color").value = selected_char
|
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:
|
def stamp_brush(self, x: int, y: int, affected_region_base: Region = None) -> Region:
|
||||||
brush_diameter = 1
|
brush_diameter = 1
|
||||||
if self.selected_tool == Tool.brush or self.selected_tool == Tool.airbrush or self.selected_tool == Tool.eraser:
|
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:
|
def action_text_toolbar(self) -> None:
|
||||||
self.warning_message_box(_("Paint"), "Not implemented.", "ok")
|
self.warning_message_box(_("Paint"), "Not implemented.", "ok")
|
||||||
def action_normal_size(self) -> None:
|
def action_normal_size(self) -> None:
|
||||||
self.warning_message_box(_("Paint"), "Not implemented.", "ok")
|
self.magnification = 1
|
||||||
def action_large_size(self) -> None:
|
def action_large_size(self) -> None:
|
||||||
self.warning_message_box(_("Paint"), "Not implemented.", "ok")
|
self.magnification = 4
|
||||||
def action_custom_zoom(self) -> None:
|
def action_custom_zoom(self) -> None:
|
||||||
self.warning_message_box(_("Paint"), "Not implemented.", "ok")
|
self.warning_message_box(_("Paint"), "Not implemented.", "ok")
|
||||||
def action_show_grid(self) -> None:
|
def action_show_grid(self) -> None:
|
||||||
|
Loading…
Reference in New Issue
Block a user