This commit is contained in:
艾竹
2023-03-18 21:44:58 +08:00
parent d97938cc2b
commit 9b3c2633a7
32 changed files with 3229 additions and 77 deletions

View File

@@ -64,6 +64,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
MoveForwardCommand = (Root as IMindDiagramViewModel)?.MoveForwardCommand;
MoveBackCommand = (Root as IMindDiagramViewModel)?.MoveBackCommand;
BuildMenuOptions();
Tags = new ObservableCollection<string>();
}
public void InitLayout(bool initAppearance)
@@ -300,7 +301,36 @@ namespace AIStudio.Wpf.Mind.ViewModels
}
set
{
if (_tags != null)
{
_tags.CollectionChanged -= _tags_CollectionChanged;
}
SetProperty(ref _tags, value);
if (_tags != null)
{
_tags.CollectionChanged += _tags_CollectionChanged;
}
}
}
private void _tags_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
if (e.NewItems != null)
{
foreach (var item in e.NewItems.OfType<string>())
{
var width = GetTextDisplayWidthHelper.GetTextDisplayWidth(item, new FontFamily(FontViewModel.FontFamily), FontViewModel.FontStyle, FontViewModel.FontWeight, FontViewModel.FontStretch, 12) + 6;
ItemWidth += width;
}
}
if (e.OldItems != null)
{
foreach (var item in e.OldItems.OfType<string>())
{
var width = GetTextDisplayWidthHelper.GetTextDisplayWidth(item, new FontFamily(FontViewModel.FontFamily), FontViewModel.FontStyle, FontViewModel.FontWeight, FontViewModel.FontStretch, 12) + 6;
ItemWidth -= width;
}
}
}
#endregion
@@ -473,6 +503,24 @@ namespace AIStudio.Wpf.Mind.ViewModels
ItemWidth = Math.Max(ItemWidth, GetTextDisplayWidthHelper.GetTextDisplayWidth(Text, new FontFamily(FontViewModel.FontFamily), FontViewModel.FontStyle, FontViewModel.FontWeight, FontViewModel.FontStretch, FontViewModel.FontSize) + 30);
break;
}
case nameof(Rate):
case nameof(Priority):
case nameof(LinkInfo):
case nameof(Remark):
{
if (e is ValuePropertyChangedEventArgs valuePropertyChangedEventArgs)
{
if (valuePropertyChangedEventArgs.OldValue == null && valuePropertyChangedEventArgs.NewValue != null)
{
ItemWidth += 24;
}
else if (valuePropertyChangedEventArgs.OldValue != null && valuePropertyChangedEventArgs.NewValue == null)
{
ItemWidth -= 24;
}
}
break;
}
}
}