diff --git a/src/Blazor.Diagrams.Core/Diagram.cs b/src/Blazor.Diagrams.Core/Diagram.cs index a2fffeac..713fbc75 100644 --- a/src/Blazor.Diagrams.Core/Diagram.cs +++ b/src/Blazor.Diagrams.Core/Diagram.cs @@ -4,9 +4,6 @@ using Blazor.Diagrams.Core.Layers; using Blazor.Diagrams.Core.Models.Base; using Blazor.Diagrams.Core.Events; -using System; -using System.Collections.Generic; -using System.Linq; using System.Runtime.CompilerServices; using Blazor.Diagrams.Core.Options; using Blazor.Diagrams.Core.Controls; @@ -38,7 +35,7 @@ public abstract class Diagram public event Action? ContainerChanged; public event Action? Changed; - protected Diagram() + protected Diagram(bool registerDefaultBehaviors = true) { _behaviors = new Dictionary(); _orderedSelectables = new List(); @@ -56,6 +53,9 @@ protected Diagram() Links.Removed += OnSelectableRemoved; Groups.Removed += OnSelectableRemoved; + if (!registerDefaultBehaviors) + return; + RegisterBehavior(new SelectionBehavior(this)); RegisterBehavior(new DragMovablesBehavior(this)); RegisterBehavior(new DragNewLinkBehavior(this)); diff --git a/src/Blazor.Diagrams/BlazorDiagram.cs b/src/Blazor.Diagrams/BlazorDiagram.cs index ab61d98a..ad404169 100644 --- a/src/Blazor.Diagrams/BlazorDiagram.cs +++ b/src/Blazor.Diagrams/BlazorDiagram.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; -using Blazor.Diagrams.Components.Controls; +using Blazor.Diagrams.Components.Controls; using Blazor.Diagrams.Core; using Blazor.Diagrams.Core.Controls.Default; using Blazor.Diagrams.Core.Models.Base; @@ -12,7 +10,7 @@ public class BlazorDiagram : Diagram { private readonly Dictionary _componentsMapping; - public BlazorDiagram(BlazorDiagramOptions? options = null) + public BlazorDiagram(BlazorDiagramOptions? options = null, bool registerDefaultBehaviors = true) : base(registerDefaultBehaviors) { _componentsMapping = new Dictionary {