Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Line tool] Bind SHIFT and ALT shortcuts at on_motion_on_area() as well #646

Open
pedropaulosuzuki opened this issue Jun 4, 2024 · 1 comment
Labels
enhancement ideas to improve existing features tools bugs or suggestions related to tools
Milestone

Comments

@pedropaulosuzuki
Copy link

Use case

It makes drawing straight lines quicker and is aligned with the shortcut Inkscape uses, for example. It makes such that one does not need to click the line tool, then go to the line settings and change the toggle every time the user needs to draw a 45deg or 90deg line.

Suggested solution

Bind "CTRL Down" to the behavior "Line options > Line shape > Locked direction > True" and "CTRL Up" to the behavior of "Line options > Line shape > Locked direction > False" when the option is unmarked.
(If the option is marked, then maybe invert the previous behavior? Or just do nothing).

Possible drawbacks

One more keybinding in the shortcuts page. Maybe section specific to the line tool? Should more keyboard shortcuts be added at some point in the future?

Possible alternatives

Continue using the settings option every time, which reduces productivity.
Binding to other keys: MS Paint also has this feature, but they use SHIFT instead. I'd prefer if the Inkscape shortcut was followed, but I could understand if the community prefers another path.

Thanks everyone and have a good day!

@pedropaulosuzuki pedropaulosuzuki added the enhancement ideas to improve existing features label Jun 4, 2024
@pedropaulosuzuki
Copy link
Author

Found it:

It wasn't clear for me that SHIFT already does this, but only if you press it before drawing. I think a better behavior would be to be able to change it when holding/moving the tool, as it is more flexible.

On tool_line.py:

	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 '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 not render:
			return
		operation = self.build_operation(event_x, event_y)
		self.do_tool_operation(operation)

	def on_release_on_area(self, event, surface, event_x, event_y):
		operation = self.build_operation(event_x, event_y)
		self.apply_operation(operation)

Then, maybe we could:

  1. Add this shortcut to the "Shortcuts" page.
  2. Allow the modifier state to happen at on_motion_on_area() as well.

@pedropaulosuzuki pedropaulosuzuki changed the title [Line tool] Bind CTRL shortcut to "Locked direction" line option [Line tool] Bind SHIFT and ALT shortcuts at on_motion_on_area() as well Jun 4, 2024
@maoschanz maoschanz added the tools bugs or suggestions related to tools label Jun 25, 2024
@maoschanz maoschanz added this to the 1.4 milestone Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ideas to improve existing features tools bugs or suggestions related to tools
Projects
None yet
Development

No branches or pull requests

2 participants