mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-03 07:36:35 +08:00
mind
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user