Skip to content

Commit 6917417

Browse files
committed
Add registerDefaultBehaviors parameter to diagram ctors
1 parent c93c07c commit 6917417

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/Blazor.Diagrams.Core/Diagram.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
using Blazor.Diagrams.Core.Layers;
55
using Blazor.Diagrams.Core.Models.Base;
66
using Blazor.Diagrams.Core.Events;
7-
using System;
8-
using System.Collections.Generic;
9-
using System.Linq;
107
using System.Runtime.CompilerServices;
118
using Blazor.Diagrams.Core.Options;
129
using Blazor.Diagrams.Core.Controls;
@@ -38,7 +35,7 @@ public abstract class Diagram
3835
public event Action? ContainerChanged;
3936
public event Action? Changed;
4037

41-
protected Diagram()
38+
protected Diagram(bool registerDefaultBehaviors = true)
4239
{
4340
_behaviors = new Dictionary<Type, Behavior>();
4441
_orderedSelectables = new List<SelectableModel>();
@@ -56,6 +53,9 @@ protected Diagram()
5653
Links.Removed += OnSelectableRemoved;
5754
Groups.Removed += OnSelectableRemoved;
5855

56+
if (!registerDefaultBehaviors)
57+
return;
58+
5959
RegisterBehavior(new SelectionBehavior(this));
6060
RegisterBehavior(new DragMovablesBehavior(this));
6161
RegisterBehavior(new DragNewLinkBehavior(this));

src/Blazor.Diagrams/BlazorDiagram.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using Blazor.Diagrams.Components.Controls;
1+
using Blazor.Diagrams.Components.Controls;
42
using Blazor.Diagrams.Core;
53
using Blazor.Diagrams.Core.Controls.Default;
64
using Blazor.Diagrams.Core.Models.Base;
@@ -12,7 +10,7 @@ public class BlazorDiagram : Diagram
1210
{
1311
private readonly Dictionary<Type, Type> _componentsMapping;
1412

15-
public BlazorDiagram(BlazorDiagramOptions? options = null)
13+
public BlazorDiagram(BlazorDiagramOptions? options = null, bool registerDefaultBehaviors = true) : base(registerDefaultBehaviors)
1614
{
1715
_componentsMapping = new Dictionary<Type, Type>
1816
{

0 commit comments

Comments
 (0)