Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanSoloweow committed Jun 1, 2020
2 parents aadb8ca + d4ce426 commit 4175c98
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ private void SetupSubscriptions()
{
this.WhenAnyValue(x => x.Node.Transitions.Count).Subscribe(x => UpdatePositionOnTransitionCountChange());
this.WhenAnyValue(x => x.Node.IsCollapse).Subscribe(value => UpdateSubscriptionForPosition(value));
}
}

}

this.WhenAnyValue(x => x.Node.Point1).Buffer(2, 1).Subscribe(value => PositionConnectPoint = PositionConnectPoint.Addition(value[1].Subtraction(value[0])));
Expand All @@ -61,7 +62,7 @@ private void UpdateSubscriptionForPosition(bool nodeIsCollapse)
{
if (!nodeIsCollapse)
{
subscriptionOnNodeWidthChange = this.WhenAnyValue(x => x.Node.Size.Width).Buffer(2, 1).Where(x => x[0] >= 80 && x[1] >= 80 && x[1]!=Node.WidthBeforeCollapse)
subscriptionOnNodeWidthChange = this.WhenAnyValue(x => x.Node.Size.Width).Buffer(2, 1).Where(x => (x[0]>= 80 && x[1] >= 80))
.Subscribe(x => UpdatePositionOnWidthChange(x[1] - x[0]));
}
else
Expand All @@ -74,12 +75,18 @@ private void UpdatePositionOnTransitionCountChange()
if (!string.IsNullOrEmpty(Name))
{
int index = Node.Transitions.IndexOf(this);
this.PositionConnectPoint = Node.Output.PositionConnectPoint.Addition(0, index*19);
this.PositionConnectPoint = Node.CurrentConnector.PositionConnectPoint.Addition(0, index*19);
}
}
private void UpdatePositionOnWidthChange(double value)
{
this.PositionConnectPoint = this.PositionConnectPoint.Addition(value, 0);
if(!Node.AfterCollapse)
this.PositionConnectPoint = this.PositionConnectPoint.Addition(value, 0);

if ((Node.AfterCollapse)&&(string.IsNullOrEmpty(this.Name)))
{
Node.AfterCollapse = false;
}
}
private void UpdateResources()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,15 @@ private void ConnectPointDrag()

private void ConnectPointDrop()
{
if (NodesCanvas.DraggedConnect.FromConnector.Node != this.Node)
{
var connect = NodesCanvas.DraggedConnect;
var connect = NodesCanvas.DraggedConnect;
if (connect.FromConnector.Node != this.Node)
{
connect.ToConnector = this;
}
else
{
connect.FromConnector.SetAsLoop();
}

}

Expand Down
6 changes: 4 additions & 2 deletions SimpleStateMachineNodeEditor/ViewModel/Node/ViewModelNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public partial class ViewModelNode : ReactiveValidationObject<ViewModelNode>
[Reactive] public Point Point1 { get; set; }
[Reactive] public Point Point2 { get; set; }
[Reactive] public Size Size { get; set; }
[Reactive] public double WidthBeforeCollapse { get; set; }
//[Reactive] public double WidthBeforeCollapse { get; set; }
[Reactive] public bool AfterCollapse { get; set; }
[Reactive] public string Name { get; set; }
[Reactive] public bool NameEnable { get; set; } = true;
[Reactive] public bool Selected { get; set; }
Expand Down Expand Up @@ -104,7 +105,8 @@ private void Collapse(bool value)
}
else
{
WidthBeforeCollapse = Size.Width;
AfterCollapse = true;
//WidthBeforeCollapse = Size.Width;
TransitionsVisible = null;
Output.Visible = true;
UnSelectedAllConnectors();
Expand Down

0 comments on commit 4175c98

Please sign in to comment.