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

Node creation improvements #9781

Merged
merged 7 commits into from
Apr 25, 2024
Merged

Node creation improvements #9781

merged 7 commits into from
Apr 25, 2024

Conversation

kazcw
Copy link
Contributor

@kazcw kazcw commented Apr 24, 2024

Pull Request Description

  • The add-component menu button now uses the same placement logic as the enter key (fixes Standardise the logic for positioning a newly added connected component #9703).
  • After creating nodes, they are selected and the viewport is adjusted to show them.
  • When creating multiple nodes using a fixed-position strategy (such as at the mouse cursor), placements are computed so that newly-created nodes don't occupy the same positions.
  • Nodes positioned relative to the mouse are now offset consistently (the new node's icon is centered under the cursor).

Important Notes

  • Introduced nodeCreation composable/context-store, which is now the preferred API for creating nodes in contexts
    where the higher-level event-based API is unavailable (which provides a simplified interface by deriving some options
    for the composable from a source-node specification). graphStore's createNode should not generally be used
    directly, as it lacks logic for placement, and doesn't update the focus, selection, and viewport.
  • Removed panning computation from usePlacement; we weren't using it. Implemented panning to newly-created nodes using zoomToSelection functionality.

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • All code has been tested:
    • Unit tests have been written where possible.
    • If GUI codebase was changed, the GUI was tested when built using ./run ide build.

@kazcw kazcw self-assigned this Apr 24, 2024
@kazcw kazcw added the CI: No changelog needed Do not require a changelog entry for this PR. label Apr 24, 2024
app/gui2/src/composables/nodeCreation.ts Outdated Show resolved Hide resolved
app/gui2/src/composables/nodeCreation.ts Outdated Show resolved Hide resolved
app/gui2/src/stores/graph/index.ts Outdated Show resolved Hide resolved
@kazcw kazcw requested a review from farmaazon April 24, 2024 17:01
@kazcw kazcw merged commit 12cbd90 into develop Apr 25, 2024
36 checks passed
@kazcw kazcw deleted the wip/kw/node-creation branch April 25, 2024 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: No changelog needed Do not require a changelog entry for this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Standardise the logic for positioning a newly added connected component
2 participants