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

Feature request: Better Shortcut for Panning Across the Canvas #3191

Open
yoSachinkr opened this issue Aug 22, 2023 · 12 comments · May be fixed by #3255
Open

Feature request: Better Shortcut for Panning Across the Canvas #3191

yoSachinkr opened this issue Aug 22, 2023 · 12 comments · May be fixed by #3255

Comments

@yoSachinkr
Copy link

The current setting for moving around the canvas is to use the middle mouse button. However, a more common and user-friendly option in many graphics applications is to press the spacebar and drag the mouse. I think this would be a better choice for Synfig.

@Afterdie
Copy link
Contributor

@rodolforg ive started working on this feature. Ive noticed that the events on workarea are being handled separately for mouse inputs and keyboard inputs. For the key input the event passed is gdkEvenKey and for mouse its gdkEvent. gdkEvent is a superset of the eventkey but still im unable to access the keyval through this event.

I wish to implement it in this function and not in the key_pressed because ill need mouse_pos and that isnt being passed in gdkEventKey

image

This prints keywaspressed but cant really which one.

Also could you please explain what this line does, I see this "smach" function alot.

https://github.com/synfig/synfig/blob/efb719b447ad8e507af8ded2a964320fd0fbe724/synfig-studio/src/gui/workarea.cpp#L1333C7-L1333C7

@rodolforg
Copy link
Contributor

Currently spacebar is used to play animation in workspace (as Blender does).
This request conflicts with this shortcut, so someone has to decide whether this demand will be met or not. @ice0 @morevnaproject

I wish to implement it in this function and not in the key_pressed because ill need mouse_pos and that isnt being passed in gdkEventKey

Also could you please explain what this line does, I see this "smach" function alot.

smach is an abbreviation used in synfig code for state machine.
Our tools are actually states of our Workspace. Note that not all states are tools: currently there is one, "stroke", that is used as a temporary state for some tools, like for Draw and Cut.

You could:

  • create a new state activated when user presses spacebar and then track the mouse move. State pops off when users releases the spacebar; or
  • check when spacebar is pressed, set a (state ;) ) variable to flag it, and check its value when detecting the mouse move events.

@yoSachinkr
Copy link
Author

Currently spacebar is used to play animation in workspace (as Blender does)

Comparing Synfig with blender wouldn't be fair. All 2d animation software uses spacebar to pan across the canvas, like opentoonz/pencil2d/tahoma2d/krita. Using spacebar for panning is more appropriate.

@rodolforg
Copy link
Contributor

I didn't say we should mimic Blender. I just said it is the same of Blender (and I'm used to it). I didn't even set spacebar as shortcut to play animation.

What should be the new shortcut for it?

@yoSachinkr
Copy link
Author

For "play", i think one of the function keys, e.g. F10 would be appropriate.

@Afterdie Afterdie linked a pull request Oct 28, 2023 that will close this issue
@ice0
Copy link
Collaborator

ice0 commented Nov 4, 2023

How about to simulate After Effects behavior?
A short press of the space bar enters playback mode, and pressing and holding allows you to move the canvas.

ae-spacebar-behavior.mp4

@yoSachinkr
Copy link
Author

@ice0 In Synfig most of the Function keys are unused. I've tried setting F10 for play/pause and to be honest I find it pretty handy.
But I'm not against the idea. 😊

@Afterdie
Copy link
Contributor

Afterdie commented Nov 5, 2023

How about to simulate After Effects behavior? A short press of the space bar enters playback mode, and pressing and holding allows you to move the canvas.

ae-spacebar-behavior.mp4

This is a good way to implement things. Also ill modify panning behavior right now pressing the space key is enough, instead it should pan the canvas when space is held down and left click is used to drag.

@yoSachinkr
Copy link
Author

instead it should pan the canvas when space is held down and left click is used to drag.
I don't think that extra step would make any sense. 👀

@Afterdie
Copy link
Contributor

Afterdie commented Nov 5, 2023

instead it should pan the canvas when space is held down and left click is used to drag.
I don't think that extra step would make any sense. 👀

When u arent focused on the workarea you need to click on it again to begin panning this ensures that you dont need to focus first, clicking instantly drags the window.

@yoSachinkr
Copy link
Author

@Afterdie But then if I'm zoomed in into an artwork, I'll have to click multiple times to move across the canvas.

@Afterdie
Copy link
Contributor

Afterdie commented Nov 5, 2023

@Afterdie But then if I'm zoomed in into an artwork, I'll have to click multiple times to move across the canvas.

good point lets stick to the first approach 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants