From 60c0df2249e993f7a6c5bc427b7d00356ce2726e Mon Sep 17 00:00:00 2001 From: Ivo Petrov <48355182+ivaylo-matov@users.noreply.github.com> Date: Wed, 17 Apr 2024 16:48:49 +0100 Subject: [PATCH] check --- .../Graph/Annotations/AnnotationModel.cs | 4 +--- .../ViewModels/Core/AnnotationViewModel.cs | 14 +++++++------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/DynamoCore/Graph/Annotations/AnnotationModel.cs b/src/DynamoCore/Graph/Annotations/AnnotationModel.cs index 8439382b0fe..b251aef5aea 100644 --- a/src/DynamoCore/Graph/Annotations/AnnotationModel.cs +++ b/src/DynamoCore/Graph/Annotations/AnnotationModel.cs @@ -686,7 +686,7 @@ void SerializeCore(XmlElement element, SaveContext context) helper.SetAttribute("TextblockHeight", this.TextBlockHeight); helper.SetAttribute("backgrouund", (this.Background == null ? "" : this.Background.ToString())); helper.SetAttribute(nameof(IsSelected), IsSelected); - helper.SetAttribute(nameof(IsExpanded), IsExpanded); + helper.SetAttribute(nameof(IsExpanded), this.IsExpanded); //Serialize Selected models XmlDocument xmlDoc = element.OwnerDocument; @@ -766,8 +766,6 @@ protected override void DeserializeCore(XmlElement element, SaveContext context) RaisePropertyChanged(nameof(GroupStyleId)); RaisePropertyChanged(nameof(AnnotationText)); RaisePropertyChanged(nameof(Nodes)); - // ip comment: - // this is called on Undo. Is VM listening? RaisePropertyChanged(nameof(IsExpanded)); this.ReportPosition(); } diff --git a/src/DynamoCoreWpf/ViewModels/Core/AnnotationViewModel.cs b/src/DynamoCoreWpf/ViewModels/Core/AnnotationViewModel.cs index 1b48f94ad2d..71ffbf906d6 100644 --- a/src/DynamoCoreWpf/ViewModels/Core/AnnotationViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/Core/AnnotationViewModel.cs @@ -1050,12 +1050,16 @@ private void UpdateConnectorsAndPortsOnShowContents(IEnumerable nodes /// - /// Handles the expansion or collapse of the annotation group in the view model. + /// Manages the expansion or collapse of the annotation group in the view model. /// private void ManageAnnotationMVExpansionAndCollapse() { - InPorts.Clear(); - OutPorts.Clear(); + if (InPorts.Any() || OutPorts.Any()) + { + InPorts.Clear(); + OutPorts.Clear(); + } + if (annotationModel.IsExpanded) { this.ShowGroupContents(); @@ -1226,12 +1230,8 @@ private void model_PropertyChanged(object sender, System.ComponentModel.Property RaisePropertyChanged(nameof(AnnotationModel.Position)); UpdateProxyPortsPosition(); break; - - // ip code: case nameof(IsExpanded): - //UpdateAnnotationAfterUndo(); ManageAnnotationMVExpansionAndCollapse(); - //RaisePropertyChanged("IsExpanded"); break; }