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

Update metadata and add callback for node moving in network area diagram #73

Merged

Conversation

massimo-ferraro
Copy link

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

Does this PR already have an issue describing the problem?
no

What kind of change does this PR introduce?
feature

What is the current behavior?
When a node is moved in network area diagram the metadata of the node is not changed, and no callback is available for having information about the node moving

What is the new behavior (if this is a feature change)?
When a node is moved the metadata of the node is updated with the new position, and a callback has been added for having information about the node moving

Does this PR introduce a breaking change or deprecate an API?

  • Yes
  • No

If yes, please check if the following requirements are fulfilled

  • The Breaking Change or Deprecated label has been added
  • The migration steps are described in the following section

What changes might users need to make in their application due to this PR? (migration steps)

the constructor of the NetworkAreaDiagramViewer has a new additional parameter: the callback.
An example of callback is provided in the demo/src/diagram-viewers/add-diagrams.js file

Signed-off-by: massimo.ferraro <massimo.ferraro@soft.it>
Signed-off-by: massimo.ferraro <massimo.ferraro@soft.it>
Signed-off-by: massimo.ferraro <massimo.ferraro@soft.it>
this.onNodeCallback(
node.getAttribute('equipmentid') ?? '',
node.getAttribute('svgid') ?? '',
DiagramUtils.round(mousePosition.x, 2),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'd rather reuse the exact same value as in the metadata. Just introduce a variable const xNew = DiagramUtils.getFormattedValue(mousePosition.x), and similarly for y.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Signed-off-by: massimo.ferraro <massimo.ferraro@soft.it>
@flo-dup flo-dup merged commit 6e4df8e into integration/nad_interactive Jun 3, 2024
4 checks passed
@flo-dup flo-dup deleted the nad_add_callback_update_metadata branch June 3, 2024 08:25
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.

None yet

2 participants