diff --git a/src/Blazor.Diagrams.Core/Behaviors/DragNewLinkBehavior.cs b/src/Blazor.Diagrams.Core/Behaviors/DragNewLinkBehavior.cs index 76e3cd73..5e77b629 100644 --- a/src/Blazor.Diagrams.Core/Behaviors/DragNewLinkBehavior.cs +++ b/src/Blazor.Diagrams.Core/Behaviors/DragNewLinkBehavior.cs @@ -56,7 +56,7 @@ private void OnPointerDown(Model? model, MouseEventArgs e) if (model is PortModel port) { - if (port.Locked || port.Enabled) + if (port.Locked || !port.Enabled) return; _targetPositionAnchor = new PositionAnchor(CalculateTargetPosition(e.ClientX, e.ClientY)); diff --git a/src/Blazor.Diagrams.Core/Models/Base/Model.cs b/src/Blazor.Diagrams.Core/Models/Base/Model.cs index ae750686..0c40525d 100644 --- a/src/Blazor.Diagrams.Core/Models/Base/Model.cs +++ b/src/Blazor.Diagrams.Core/Models/Base/Model.cs @@ -18,7 +18,7 @@ protected Model(string id) public string Id { get; } public bool Locked { get; set; } - public bool Enabled { get; set; } + public bool Enabled { get; set; } = true; public bool Visible { get => _visible; diff --git a/tests/Blazor.Diagrams.Core.Tests/Behaviors/DragNewLinkBehaviorTests.cs b/tests/Blazor.Diagrams.Core.Tests/Behaviors/DragNewLinkBehaviorTests.cs index 8a99cd86..25b58f88 100644 --- a/tests/Blazor.Diagrams.Core.Tests/Behaviors/DragNewLinkBehaviorTests.cs +++ b/tests/Blazor.Diagrams.Core.Tests/Behaviors/DragNewLinkBehaviorTests.cs @@ -22,7 +22,6 @@ public void Behavior_ShouldCreateLinkWithSinglePortAnchorSource_WhenMouseDownOnP Initialized = true, Position = new Point(110, 60), Size = new Size(10, 20), - Enabled = false, }); // Act @@ -455,7 +454,7 @@ public void Behavior_ShouldNotCreateLinkWithSinglePortAnchorSource_WhenMouseDown Initialized = true, Position = new Point(110, 60), Size = new Size(10, 20), - Enabled = true, + Enabled = false, }); // Act