mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-07 09:46:37 +08:00
支持画笔及痕迹擦除,为白板做准备
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user