Skip to content

Commit

Permalink
Use <Alt> to invert the value of the "outline" option (#46)
Browse files Browse the repository at this point in the history
Tools: pencil, line, curve
  • Loading branch information
maoschanz committed Nov 3, 2021
1 parent a285687 commit abf12f6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/tools/abstract_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ def get_settings(self):

def update_modifier_state(self, event_state):
modifier_keys = []
if (event_state & Gdk.ModifierType.CONTROL_MASK) == Gdk.ModifierType.CONTROL_MASK:
modifier_keys.append("CTRL")
# CONTROL_MASK can't be used, because it already has an effect app-wide.
if (event_state & Gdk.ModifierType.SHIFT_MASK) == Gdk.ModifierType.SHIFT_MASK:
modifier_keys.append("SHIFT")
if (event_state & Gdk.ModifierType.MOD1_MASK) == Gdk.ModifierType.MOD1_MASK:
Expand Down
4 changes: 4 additions & 0 deletions src/tools/classic_tools/tool_arc.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ def get_edition_status(self):
def on_press_on_area(self, event, surface, event_x, event_y):
self.set_common_values(event.button, event_x, event_y)

self.update_modifier_state(event.state)
if "ALT" in self._modifier_keys:
self._use_outline = not self._use_outline

def on_motion_on_area(self, event, surface, event_x, event_y, render=True):
cairo_context = self.get_context()
if self._1st_segment is None:
Expand Down
5 changes: 4 additions & 1 deletion src/tools/classic_tools/tool_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ def on_press_on_area(self, event, surface, event_x, event_y):
self.set_common_values(event.button, event_x, event_y)

self.update_modifier_state(event.state)
self._ortholock = self._ortholock or "SHIFT" in self._modifier_keys
if "SHIFT" in self._modifier_keys:
self._ortholock = not self._ortholock
if "ALT" in self._modifier_keys:
self._use_outline = not self._use_outline

def on_motion_on_area(self, event, surface, event_x, event_y, render=True):
if render:
Expand Down
4 changes: 4 additions & 0 deletions src/tools/classic_tools/tool_pencil.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ def on_press_on_area(self, event, surface, event_x, event_y):
self.set_common_values(event.button, event_x, event_y)
self._path = None

self.update_modifier_state(event.state)
if "ALT" in self._modifier_keys:
self._use_outline = not self._use_outline

def _add_point(self, event_x, event_y):
cairo_context = self.get_context()
if self._path is None:
Expand Down

0 comments on commit abf12f6

Please sign in to comment.