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

[Question] Map panning to left mouse button #103

Closed
hailstorm75 opened this issue May 8, 2024 · 5 comments · Fixed by #104
Closed

[Question] Map panning to left mouse button #103

hailstorm75 opened this issue May 8, 2024 · 5 comments · Fixed by #104
Assignees
Labels
question Further information is requested

Comments

@hailstorm75
Copy link

I want to allow users to pan within the node editor using the left mouse button.

image

Similarly to, e.g., Blender's tool selection that modifies what the left mouse button does, I wish to introduce three tools for operating the node editor:

  • Select - the default
  • Move - left click + drag pans the editor
  • Delete - clicking or select+release deletes items

image

I've found that the EditorGestures class is public; thus, it is possible to modify the default gestures to something custom.

However, I couldn't figure out how to detach the selection from the left click.

I've tried the following:

EditorGestures.Selection.DefaultMouseAction = MouseAction.None;
EditorGestures.Selection.Replace = new MouseGesture(MouseAction.None);
EditorGestures.Selection.Remove = new MouseGesture(MouseAction.None);
EditorGestures.Selection.Append = new MouseGesture(MouseAction.None);
EditorGestures.Selection.Invert = new MouseGesture(MouseAction.None);

EditorGestures.Pan = new MultiGesture(MultiGesture.Match.Any, new MouseGesture(MouseAction.LeftClick), new MouseGesture(MouseAction.MiddleClick));

Could you please point me in the right direction?

Given how these gestures are implemented, I'd assume it should be fine to modify them during the runtime.
Is that correct?

@hailstorm75 hailstorm75 added the question Further information is requested label May 8, 2024
@miroiu
Copy link
Owner

miroiu commented May 8, 2024

Hi! You should be able to modify the gestures at runtime, however it seems that the select gesture property is missing the setter. I'll create a PR to address that. Do you build from the source code or from the nuget package?

@hailstorm75
Copy link
Author

I use the NuGet package

@miroiu miroiu linked a pull request May 9, 2024 that will close this issue
@miroiu
Copy link
Owner

miroiu commented May 9, 2024

I created the PR and, it looks like not all the gestures were customizable at runtime, especially the ones used for the EditorCommands. Therefore it resulted in more work than expected. Could you please let me know if this suits your needs? I'm open to suggestions and ideas. #104

@hailstorm75
Copy link
Author

Based on the description of the PR, this looks perfect. I shall do some testing today and let you know.

@miroiu
Copy link
Owner

miroiu commented May 11, 2024

I merged the PR and will push a new release to NuGet soon. Please feel free to reopen the issue if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants