支持画笔及痕迹擦除,为白板做准备

This commit is contained in:
艾竹
2023-05-07 23:01:38 +08:00
parent 4a1d25fdf0
commit c3342ced13
30 changed files with 2639 additions and 607 deletions

View File

@@ -121,36 +121,6 @@ namespace AIStudio.Wpf.DiagramDesigner
}
}
private bool EnableSnapping
{
get
{
if (_viewModel.DrawModeViewModel != null)
{
return _viewModel.DrawModeViewModel.EnableSnapping;
}
else
{
return _service.DrawModeViewModel.EnableSnapping;
}
}
}
private double SnappingRadius
{
get
{
if (_viewModel.DrawModeViewModel != null)
{
return _viewModel.DrawModeViewModel.SnappingRadius;
}
else
{
return _service.DrawModeViewModel.SnappingRadius;
}
}
}
#region GridCellSize
public static readonly DependencyProperty GridCellSizeProperty =
@@ -390,6 +360,19 @@ namespace AIStudio.Wpf.DiagramDesigner
SourceConnector = new Connector() { Content = new PartCreatedConnectorInfo(currentPoint.X, currentPoint.Y), Tag = "虚拟的连接点" };
}
}
else if (_service.DrawModeViewModel.DrawingDrawModeSelected)
{
// create rubberband adorner
AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this);
if (adornerLayer != null)
{
DrawingRubberbandAdorner adorner = new DrawingRubberbandAdorner(this, currentPoint);
if (adorner != null)
{
adornerLayer.Add(adorner);
}
}
}
e.Handled = true;
}
@@ -433,7 +416,7 @@ namespace AIStudio.Wpf.DiagramDesigner
SinkConnector.Info.DisableAttachTo = true;
}
if (EnableSnapping)
if (_viewModel.DiagramOption.SnappingOption.EnableSnapping)
{
var nearPort = _viewModel.FindNearPortToAttachTo(partialConnection);
if (nearPort != null)
@@ -510,10 +493,7 @@ namespace AIStudio.Wpf.DiagramDesigner
SinkConnector = null;
partialConnection = null;
if (_service.DrawModeViewModel.GetDrawMode() != DrawMode.DirectLine)
{
_service.DrawModeViewModel.ResetDrawMode();
}
_service.DrawModeViewModel.ResetDrawMode();
}
protected override void OnPreviewKeyDown(KeyEventArgs e)
@@ -657,6 +637,6 @@ namespace AIStudio.Wpf.DiagramDesigner
e.Handled = true;
this.Focus();
}
}
}
}