mirror of
https://github.com/1j01/textual-paint.git
synced 2024-12-22 06:11:37 +03:00
Fix error due to action regions exceeding canvas bounds
This commit is contained in:
parent
0aaa9db839
commit
6d5430ad2e
2
paint.py
2
paint.py
@ -420,6 +420,7 @@ class PaintApp(App):
|
||||
self.undos.append(action)
|
||||
region = self.stamp_brush(event.mouse_down_event.x, event.mouse_down_event.y, region)
|
||||
action.region = region
|
||||
action.region = action.region.intersection(Region(0, 0, self.image.width, self.image.height))
|
||||
action.update(self.image_at_start)
|
||||
self.canvas.refresh(region)
|
||||
event.stop()
|
||||
@ -434,6 +435,7 @@ class PaintApp(App):
|
||||
|
||||
# Update action region and image data
|
||||
action.region = action.region.union(affected_region)
|
||||
action.region = action.region.intersection(Region(0, 0, self.image.width, self.image.height))
|
||||
action.update(self.image_at_start)
|
||||
|
||||
self.canvas.refresh(affected_region)
|
||||
|
Loading…
Reference in New Issue
Block a user