Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
linuxgurugamer committed Jun 22, 2016
2 parents c2c0d39 + 3ffd3f7 commit d5e42f9
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions EditorExtensionsRedux/EditorExtensionsRedux.cs
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ void Update ()

// H - Horizontally align part under cursor with the part it is attached to
if (Input.GetKeyDown (cfg.KeyMap.HorizontalSnap)) {
HorizontalAlign ();
HorizontalAlign (fineKeyDown);
return;
}

Expand Down Expand Up @@ -897,11 +897,16 @@ void CenterOnParent (Part p)
throw new NotImplementedException ();
}

void CenterHorizontallyOnParent (Part p)
void CenterHorizontallyOnParent (Part p, bool otherHorizontal = false)
{
p.transform.localPosition = new Vector3 (p.transform.localPosition.x, p.transform.localPosition.y, 0f);
p.attPos0.z = 0f;
}
if (otherHorizontal) {
p.transform.localPosition = new Vector3(0f, p.transform.localPosition.y, p.transform.localPosition.z);
p.attPos0.x = 0f;
} else {
p.transform.localPosition = new Vector3(p.transform.localPosition.x, p.transform.localPosition.y, 0f);
p.attPos0.z = 0f;
}
}

void VerticalAlign ()
{
Expand All @@ -927,7 +932,7 @@ void VerticalAlign ()
return;
}

void HorizontalAlign ()
void HorizontalAlign (bool otherHorizontal = false)
{
try {
Part sp = Utility.GetPartUnderCursor ();
Expand All @@ -940,11 +945,11 @@ void HorizontalAlign ()
Log.Debug ("symmetryCounterparts to move: " + symParts.Count.ToString ());

//move selected part
CenterHorizontallyOnParent (sp);
CenterHorizontallyOnParent (sp, otherHorizontal);

//move any symmetry siblings/counterparts
foreach (Part symPart in symParts) {
CenterHorizontallyOnParent (symPart);
CenterHorizontallyOnParent (symPart, otherHorizontal);
}

//Add edit to undo history
Expand Down

0 comments on commit d5e42f9

Please sign in to comment.