Skip to content

New nodes added in the wrong place #4205

@0HyperCube

Description

@0HyperCube

Reproduction

  • Create new document
  • Open node graph
  • Right click to add new node near the bottom of the node graph view
  • Select node
  • Observe it is added not in the location of the right click.

Video

add_in_wrong_place.mp4

Code

A shifted version of the mouse position is used to spawn the node instead of the proper position.

// TODO: Create function
let node_graph_shift = if matches!(context_menu_data, ContextMenuData::CreateNode { compatible_type: None }) {
let appear_right_of_mouse = if click.x > viewport.size().x() - 180. { -180. } else { 0. };
let appear_above_mouse = if click.y > viewport.size().y() - 200. { -200. } else { 0. };
DVec2::new(appear_right_of_mouse, appear_above_mouse) / network_metadata.persistent_metadata.navigation_metadata.node_graph_to_viewport.matrix2.x_axis.x
} else {
let appear_right_of_mouse = if click.x > viewport.size().x() - 173. { -173. } else { 0. };
let appear_above_mouse = if click.y > viewport.size().y() - 34. { -34. } else { 0. };
DVec2::new(appear_right_of_mouse, appear_above_mouse) / network_metadata.persistent_metadata.navigation_metadata.node_graph_to_viewport.matrix2.x_axis.x
};

editor.createNode(identifier, $nodeGraph.contextMenuInformation.contextMenuCoordinates[0], $nodeGraph.contextMenuInformation.contextMenuCoordinates[1]);

Metadata

Metadata

Assignees

Labels

Paper CutA small UX annoyance we should strive to improve

Type

No fields configured for Bug.

Projects

Status
Completed This Milestone

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions