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

[ui] Paste nodes at the center of the Graph Editor when it does not contain the mouse #1788

Merged
merged 1 commit into from
Oct 10, 2022

Conversation

cbentejac
Copy link
Contributor

@cbentejac cbentejac commented Sep 30, 2022

Description

When using the Edit > Paste action menu, or when pressing Ctrl+V while the Graph Editor has the focus but does not contain the mouse, there is no current mouse position within the GraphEditor. The position that is provided to the "pasteNodes" function is the last known mouse position within the Graph Editor, which oftentimes corresponds to its borders.

Instead of using the border of the Graph Editor as the top-left corner of the pasting zone (the zone in which all the nodes contained in the clipboard will be pasted, with their original distance to one another preserved), this PR simulates the mouse's position and sets it at the center of the Graph Editor. This position is then used as the center of the pasting zone instead of its top-left corner. Distances between the pasted nodes remain unchanged.

@fabiencastan
Copy link
Member

Can we not just check if the mouse position is in the GraphEditor? If it's not inside, the paste is done at the center.

@fabiencastan fabiencastan added this to the Meshroom 2022.1.0 milestone Sep 30, 2022
…mouse

When using the Edit > Paste menu, or when pressing Ctrl+V while the Graph
Editor has the focus but the mouse is not contained in it, there is no
current mouse position in the GraphEditor so the position that is provided
to the "pasteNodes" function is the last known mouse position, which is
oftentimes on the border of the GraphEditor.

This commit automatically sets the mouse's position to the center of
the GraphEditor, and "builds" the zone containing the pasted nodes around
it.
@cbentejac
Copy link
Contributor Author

Can we not just check if the mouse position is in the GraphEditor? If it's not inside, the paste is done at the center.

You're right: that way, we can also paste nodes at the center when the Graph Editor still has the focus but does not contain the mouse.

@cbentejac cbentejac changed the title [ui] Paste nodes at the center of the Graph Editor when using the Edit > Paste menu [ui] Paste nodes at the center of the Graph Editor when it does not contain the mouse Oct 3, 2022
@fabiencastan fabiencastan merged commit 7382511 into develop Oct 10, 2022
@fabiencastan fabiencastan deleted the dev/centerCopyPasteNodes branch October 10, 2022 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants