@@ -50,6 +50,7 @@ public class ViewModelNode : ReactiveValidationObject<ViewModelNode>
5050
5151 public int Zindex { get ; private set ; }
5252
53+ [ Reactive ] public int IndexStartSelectConnectors { get ; set ; } = 0 ;
5354 public IObservableCollection < ViewModelConnector > Transitions { get ; set ; } = new ObservableCollectionExtended < ViewModelConnector > ( ) ;
5455
5556
@@ -98,6 +99,7 @@ private void SetupConnectors()
9899 public SimpleCommandWithParameter < string > CommandValidateName { get ; set ; }
99100
100101 public SimpleCommandWithParameter < ViewModelConnector > CommandSelectWithShiftForConnectors { get ; set ; }
102+ public SimpleCommandWithParameter < ViewModelConnector > CommandSetConnectorAsStartSelect { get ; set ; }
101103 public SimpleCommand CommandUnSelectedAllConnectors { get ; set ; }
102104 public SimpleCommand CommandAddEmptyConnector { get ; set ; }
103105
@@ -119,6 +121,7 @@ private void SetupCommands()
119121 CommandAddEmptyConnector = new SimpleCommand ( AddEmptyConnector ) ;
120122 CommandCollapse = new SimpleCommandWithParameter < bool > ( Collapse , NotSaved ) ;
121123 CommandSelectWithShiftForConnectors = new SimpleCommandWithParameter < ViewModelConnector > ( SelectWithShiftForConnectors ) ;
124+ CommandSetConnectorAsStartSelect = new SimpleCommandWithParameter < ViewModelConnector > ( SetConnectorAsStartSelect ) ;
122125 CommandUnSelectedAllConnectors = new SimpleCommand ( UnSelectedAllConnectors ) ;
123126 //CommandTransitionsDragLeave = new SimpleCommand(TransitionsDragLeave);
124127 //CommandTransitionsDragEnter = new SimpleCommand(TransitionsDragEnter);
@@ -132,6 +135,7 @@ private void SetupCommands()
132135
133136
134137 }
138+
135139 private void NotSaved ( )
136140 {
137141 NodesCanvas . ItSaved = false ;
@@ -206,34 +210,27 @@ private void UnSelectedAllConnectors()
206210 {
207211 transition . Selected = false ;
208212 }
213+
214+ IndexStartSelectConnectors = 0 ;
215+ }
216+ private void SetConnectorAsStartSelect ( ViewModelConnector viewModelConnector )
217+ {
218+ IndexStartSelectConnectors = Transitions . IndexOf ( viewModelConnector ) - 1 ;
209219 }
210220 private void SelectWithShiftForConnectors ( ViewModelConnector viewModelConnector )
211221 {
212222 if ( viewModelConnector == null )
213223 return ;
214224
215225 var transitions = this . Transitions . Skip ( 1 ) ;
216-
217- int index = transitions . IndexOf ( viewModelConnector ) ;
218-
219- if ( ( ! transitions . First ( ) . Selected ) && ( transitions . Last ( ) . Selected ) )
226+ int indexCurrent = transitions . IndexOf ( viewModelConnector ) ;
227+ int indexStart = IndexStartSelectConnectors ;
228+ UnSelectedAllConnectors ( ) ;
229+ IndexStartSelectConnectors = indexStart ;
230+ transitions = transitions . Skip ( Math . Min ( indexCurrent , indexStart ) ) . SkipLast ( Transitions . Count ( ) - Math . Max ( indexCurrent , indexStart ) - 2 ) ;
231+ foreach ( var transition in transitions )
220232 {
221- UnSelectedAllConnectors ( ) ;
222- foreach ( var transition in transitions . TakeLast ( transitions . Count ( ) - index ) )
223- {
224- transition . Selected = true ;
225- }
226- return ;
227- }
228- else
229- {
230- UnSelectedAllConnectors ( ) ;
231- //var t = transitions.Take(index);
232- foreach ( var transition in transitions . Take ( index + 1 ) )
233- {
234- transition . Selected = true ;
235- }
236- return ;
233+ transition . Selected = true ;
237234 }
238235 }
239236 public XElement ToXElement ( )
0 commit comments