mirror of
https://github.com/1j01/textual-paint.git
synced 2024-09-17 18:57:09 +03:00
Capture the mouse when drawing on the canvas
This commit is contained in:
parent
f4eb6eb1f0
commit
f6e9d6676e
2
paint.py
2
paint.py
@ -118,6 +118,7 @@ class Canvas(Static):
|
||||
self.image_ch[event.y][event.x] = "X"
|
||||
self.image_bg[event.y][event.x] = "#ff0000"
|
||||
self.pointer_active = True
|
||||
self.capture_mouse(True)
|
||||
self.display_canvas()
|
||||
|
||||
def on_mouse_move(self, event) -> None:
|
||||
@ -129,6 +130,7 @@ class Canvas(Static):
|
||||
|
||||
def on_mouse_up(self, event) -> None:
|
||||
self.pointer_active = False
|
||||
self.capture_mouse(False)
|
||||
|
||||
def display_canvas(self) -> None:
|
||||
"""Update the content area."""
|
||||
|
Loading…
Reference in New Issue
Block a user