1- using Blazor . Diagrams . Core . Extensions ;
2- using Blazor . Diagrams . Core . Models ;
3- using Blazor . Diagrams . Core . Models . Base ;
1+ using Blazor . Diagrams . Core . Models . Base ;
42using Blazor . Diagrams . Core . Models . Core ;
53using Microsoft . AspNetCore . Components . Web ;
64using System ;
75using System . Linq ;
86
97namespace Blazor . Diagrams . Core . Default
108{
11- public class DragNodeSubManager : DiagramSubManager
9+ public class DragMovablesSubManager : DiagramSubManager
1210 {
1311 private Point [ ] ? _initialPositions ;
1412 private double ? _lastClientX ;
1513 private double ? _lastClientY ;
1614
17- public DragNodeSubManager ( DiagramManager diagramManager ) : base ( diagramManager )
15+ public DragMovablesSubManager ( DiagramManager diagramManager ) : base ( diagramManager )
1816 {
1917 DiagramManager . MouseDown += DiagramManager_MouseDown ;
2018 DiagramManager . MouseMove += DiagramManager_MouseMove ;
@@ -23,13 +21,13 @@ public DragNodeSubManager(DiagramManager diagramManager) : base(diagramManager)
2321
2422 private void DiagramManager_MouseDown ( Model model , MouseEventArgs e )
2523 {
26- if ( ! ( model is NodeModel ) )
24+ if ( ! ( model is MovableModel ) )
2725 return ;
2826
2927 // Don't link this linq
3028 _initialPositions = DiagramManager . SelectedModels
31- . Where ( m => m is NodeModel )
32- . Select ( m => ( m as NodeModel ) . Position )
29+ . Where ( m => m is MovableModel )
30+ . Select ( m => ( m as MovableModel ) ! . Position )
3331 . ToArray ( ) ;
3432
3533 _lastClientX = e . ClientX ;
@@ -47,14 +45,13 @@ private void DiagramManager_MouseMove(Model model, MouseEventArgs e)
4745
4846 foreach ( var sm in DiagramManager . SelectedModels )
4947 {
50- if ( ! ( sm is NodeModel node ) || node . Locked )
48+ if ( ! ( sm is MovableModel node ) || node . Locked )
5149 continue ;
5250
5351 var initialPosition = _initialPositions [ i ] ;
5452 var ndx = ApplyGridSize ( deltaX + initialPosition . X ) ;
5553 var ndy = ApplyGridSize ( deltaY + initialPosition . Y ) ;
5654 node . SetPosition ( ndx , ndy ) ;
57- node . RefreshAll ( ) ;
5855 i ++ ;
5956 }
6057 }
0 commit comments