From 6d5430ad2eae8be87728ff582d39610aaf9ed040 Mon Sep 17 00:00:00 2001 From: Isaiah Odhner Date: Tue, 11 Apr 2023 14:41:58 -0400 Subject: [PATCH] Fix error due to action regions exceeding canvas bounds --- paint.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/paint.py b/paint.py index 084da80..d2b1149 100644 --- a/paint.py +++ b/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)