Stop bubbling of canvas tool events

This commit is contained in:
Isaiah Odhner 2023-04-11 10:48:42 -04:00
parent c7e27bc3cb
commit ab76aacff3

View File

@ -313,12 +313,14 @@ class PaintApp(App):
"""Called when the user starts drawing on the canvas."""
self.draw_dot(event.mouse_down_event.x, event.mouse_down_event.y)
self.canvas.refresh()
event.stop()
def on_canvas_tool_update(self, event: Canvas.ToolUpdate) -> None:
"""Called when the user is drawing on the canvas."""
mm = event.mouse_move_event
bresenham_walk(mm.x - mm.delta_x, mm.y - mm.delta_y, mm.x, mm.y, lambda x, y: self.draw_dot(x, y))
self.canvas.refresh()
event.stop()
def on_key(self, event: events.Key) -> None:
"""Called when the user presses a key."""