Skip to content

Add x and Y to NodeViewModel - #7945

Merged
ramramps merged 4 commits into
DynamoDS:masterfrom
ramramps:NodeViewModel-x-and-y
Jun 12, 2017
Merged

ramramps merged 4 commits into
DynamoDS:masterfrom
ramramps:NodeViewModel-x-and-y

Conversation

@ramramps

@ramramps ramramps commented Jun 9, 2017

Copy link
Copy Markdown
Collaborator

Purpose

This PR adds X and Y to NodeViewModel.

https://jira.autodesk.com/browse/QNTM-842

Declarations

Check these if you believe they are true

  • The code base is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning, and are documented in the API Changes document.

Reviewers

@mjkkirschner

/// Returns or set the X position of the Node.
/// </summary>
public double X
{

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think adding here will serialize the values correctly.

@QilongTang

Copy link
Copy Markdown
Contributor

@ramramps Isn't there other code we need to change for accessing X and Y from nodeViewModel instead of nodeModel?

@ramramps

ramramps commented Jun 9, 2017

Copy link
Copy Markdown
Collaborator Author

@QilongTang Sorry, I did not get it. ModelBase has X and Y, and NodeModel derives X and Y from it. Those are not seriailzed today. NodeViewModel has reference to NodeModel, so accessing X and Y must be straight forward. What other code change you are referring to?

@mjkkirschner

mjkkirschner commented Jun 9, 2017 •

Copy link
Copy Markdown
Member

@ramramps @QilongTang - There will be more code to deserialize (which I think is what @QilongTang is asking about) but that would be part of the open task.

@mjkkirschner

Copy link
Copy Markdown
Member

oh - @ramramps on second thought I think what @QilongTang means is that you should mark these two properties obsolete on node model, and start using the nodeViewModel properties throughout the code base.... It's not required but a step in the right direction towards obsoleting them.

@QilongTang

QilongTang commented Jun 9, 2017 •

Copy link
Copy Markdown
Contributor

@ramramps Sorry for I was just looking at other changes needed like

  1. Obsoleting the property on nodeModel and promoting the use of nodeViewModel.X. There might be test code or other view layer code we need to touch to just use nodeViewModel.X. Up to you

@mjkkirschner

Copy link
Copy Markdown
Member

I think at the minimum mark these obsolete with the message we used before - and if possible use nodeViewModel instead of NodeModel to access x and y where possible (view code)

@ramramps

ramramps commented Jun 9, 2017

Copy link
Copy Markdown
Collaborator Author

Yes. I am adding the obsolete property on NodeModel. I am not changing the tests to use Nodeviewmodel x and y. Because x and y are still on NodeModel. Once we remove those obsolete properties, we can update the tests. Just want to keep the changes minimal.

@mjkkirschner

Copy link
Copy Markdown
Member

@ramramps fair enough.

Comment thread src/DynamoCore/Graph/ModelBase.cs Outdated
/// <summary>
/// The Y coordinate of the node in canvas space.
/// </summary>
[Obsolete("This property will be removed from the model, please use the X property on the ViewModel in DynamoCoreWpf assembly.")]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should be Y

@mjkkirschner

Copy link
Copy Markdown
Member

can you create a task for the refactor ? And then we can merge this.

@ramramps

Copy link
Copy Markdown
Collaborator Author

Task for refactoring : https://jira.autodesk.com/browse/QNTM-854

RaisePropertyChanged("FontSize");
RaisePropertyChanged("AnnotationText");
RaisePropertyChanged("SelectedModels");
RaisePropertyChanged("Nodes");

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixing AnnotationModel SelectedModels bug here. Just one line change.

@ramramps
ramramps merged commit 2a6e158 into DynamoDS:master Jun 12, 2017
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.

3 participants