@@ -30,7 +30,6 @@ public partial class ViewModelConnector : ReactiveObject
30
30
[ Reactive ] public ViewModelNodesCanvas NodesCanvas { get ; set ; }
31
31
[ Reactive ] public bool Selected { get ; set ; }
32
32
33
- private IDisposable subscriptionOnNodeWidthChange ;
34
33
public ViewModelConnector ( ViewModelNodesCanvas nodesCanvas , ViewModelNode viewModelNode , string name , Point myPoint )
35
34
{
36
35
Node = viewModelNode ;
@@ -48,29 +47,17 @@ private void SetupSubscriptions()
48
47
49
48
if ( this . Name != "Input" )
50
49
{
51
- this . WhenAnyValue ( x => x . Node . IsCollapse ) . Subscribe ( value => UpdateSubscriptionForPosition ( value ) ) ;
50
+ this . WhenAnyValue ( x => x . Node . HeaderWidth ) . Buffer ( 2 , 1 ) . Subscribe ( x => UpdatePositionOnWidthChange ( x [ 1 ] - x [ 0 ] ) ) ;
52
51
if ( this . Name != "Output" )
53
52
{
54
- this . WhenAnyValue ( x => x . Node . Transitions . Count ) . Subscribe ( x => UpdatePositionOnTransitionCountChange ( ) ) ;
55
-
53
+ this . WhenAnyValue ( x => x . Node . Transitions . Count ) . Subscribe ( x => UpdatePositionOnTransitionCountChange ( ) ) ;
56
54
}
57
55
58
56
}
59
57
60
58
this . WhenAnyValue ( x => x . Node . Point1 ) . Buffer ( 2 , 1 ) . Subscribe ( value => PositionConnectPoint = PositionConnectPoint . Addition ( value [ 1 ] . Subtraction ( value [ 0 ] ) ) ) ;
61
59
}
62
- private void UpdateSubscriptionForPosition ( bool nodeIsCollapse )
63
- {
64
- if ( ! nodeIsCollapse )
65
- {
66
- subscriptionOnNodeWidthChange = this . WhenAnyValue ( x => x . Node . Size . Width ) . Buffer ( 2 , 1 ) . Where ( x => ( x [ 0 ] >= 80 && x [ 1 ] >= 80 ) )
67
- . Subscribe ( x => UpdatePositionOnWidthChange ( x [ 1 ] - x [ 0 ] ) ) ;
68
- }
69
- else
70
- {
71
- subscriptionOnNodeWidthChange ? . Dispose ( ) ;
72
- }
73
- }
60
+
74
61
private void UpdatePositionOnTransitionCountChange ( )
75
62
{
76
63
if ( ! string . IsNullOrEmpty ( Name ) )
@@ -81,13 +68,7 @@ private void UpdatePositionOnTransitionCountChange()
81
68
}
82
69
private void UpdatePositionOnWidthChange ( double value )
83
70
{
84
- if ( ! Node . AfterCollapse )
85
- this . PositionConnectPoint = this . PositionConnectPoint . Addition ( value , 0 ) ;
86
-
87
- if ( ( Node . AfterCollapse ) & & ( string . IsNullOrEmpty ( this . Name ) ) )
88
- {
89
- Node . AfterCollapse = false ;
90
- }
71
+ this . PositionConnectPoint = this . PositionConnectPoint . Addition ( value , 0 ) ;
91
72
}
92
73
private void UpdateResources ( )
93
74
{
0 commit comments