Fix error due to action regions exceeding canvas bounds

This commit is contained in:
Isaiah Odhner 2023-04-11 14:41:58 -04:00
parent 0aaa9db839
commit 6d5430ad2e

View File

@ -420,6 +420,7 @@ class PaintApp(App):
self.undos.append(action) self.undos.append(action)
region = self.stamp_brush(event.mouse_down_event.x, event.mouse_down_event.y, region) region = self.stamp_brush(event.mouse_down_event.x, event.mouse_down_event.y, region)
action.region = region action.region = region
action.region = action.region.intersection(Region(0, 0, self.image.width, self.image.height))
action.update(self.image_at_start) action.update(self.image_at_start)
self.canvas.refresh(region) self.canvas.refresh(region)
event.stop() event.stop()
@ -434,6 +435,7 @@ class PaintApp(App):
# Update action region and image data # Update action region and image data
action.region = action.region.union(affected_region) 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) action.update(self.image_at_start)
self.canvas.refresh(affected_region) self.canvas.refresh(affected_region)