Skip to content

Commit

Permalink
trnsformation tools: update the expansion rgba immediately #357
Browse files Browse the repository at this point in the history
  • Loading branch information
maoschanz committed Feb 1, 2023
1 parent bff80e0 commit f594d7a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/tools/transform_tools/abstract_transform_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ def get_deformed_surface(self, source_surface, new_surface, coefs):
############################################################################
# Options ##################################################################

def on_options_changed(self):
super().on_options_changed()
self._update_expansion_rgba(self._last_btn)

def _update_expansion_rgba(self, event_btn=1):
"""When the canvas grows, the color of the new pixels is parametrable"""
color_type = self.get_option_value('crop-expand')
Expand Down
4 changes: 3 additions & 1 deletion src/tools/transform_tools/tool_crop.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,10 @@ def on_unclicked_motion_on_area(self, event, surface):
def on_press_on_area(self, event, surface, event_x, event_y):
self.x_press = self.x_motion = event_x
self.y_press = self.y_motion = event_y
if event.button != self._last_btn:
self._update_expansion_rgba(event.button)
self._last_btn = event.button
self._unclicked = False
self._update_expansion_rgba(event.button)

self.update_modifier_state(event.state)
if 'SHIFT' in self._modifier_keys and 'ALT' in self._modifier_keys:
Expand Down
4 changes: 3 additions & 1 deletion src/tools/transform_tools/tool_skew.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ def on_press_on_area(self, event, surface, event_x, event_y):
self._xy = self.get_xy() # horizontal deformation
# TODO répliquer ce que fait le scale avec son x2/y2 qui évite un effet
# flamby dégueulasse lié aux arrondis ?
self._update_expansion_rgba(event.button)
if event.button != self._last_btn:
self._update_expansion_rgba(event.button)
self._last_btn = event.button

self.update_modifier_state(event.state)
if 'SHIFT' in self._modifier_keys and 'ALT' in self._modifier_keys:
Expand Down

0 comments on commit f594d7a

Please sign in to comment.