Rename scene variable for consistency

This commit is contained in:
John Lewin 2017-09-26 12:54:40 -07:00
parent 3cba62e3c2
commit 63b6b1571f
3 changed files with 12 additions and 17 deletions

View file

@ -27,13 +27,8 @@ of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using System.Threading.Tasks;
using MatterHackers.Agg.UI;
using MatterHackers.DataConverters3D;
using MatterHackers.PolygonMesh;
using System.Linq;
using System.Collections.Generic;
using System.Threading;
using MatterHackers.MeshVisualizer;
namespace MatterHackers.MatterControl.PartPreviewWindow
@ -41,26 +36,26 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
public class GroupCommand : IUndoRedoCommand
{
private IObject3D item;
private InteractiveScene interactiveScene;
private InteractiveScene scene;
public GroupCommand(InteractiveScene interactiveScene, IObject3D selectedItem)
{
this.interactiveScene = interactiveScene;
this.scene = interactiveScene;
this.item = selectedItem;
}
public async void Do()
{
if (interactiveScene.SelectedItem == item)
if (scene.SelectedItem == item)
{
// This is the original do() case. The selection needs to be changed into a group and selected
// change it to a standard group
interactiveScene.SelectedItem.ItemType = Object3DTypes.Group;
scene.SelectedItem.ItemType = Object3DTypes.Group;
}
else
{
// This the undo -> redo() case. The original Selection group has been collapsed and we need to rebuild it
interactiveScene.Children.Modify(children =>
scene.Children.Modify(children =>
{
// Remove all children from the scene
foreach (var child in item.Children)
@ -72,18 +67,18 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
children.Add(item);
});
interactiveScene.SelectedItem = item;
scene.SelectedItem = item;
}
}
public void Undo()
{
if (!interactiveScene.Children.Contains(item))
if (!scene.Children.Contains(item))
{
return;
}
interactiveScene.Children.Modify(list =>
scene.Children.Modify(list =>
{
// Remove the group
list.Remove(item);
@ -92,7 +87,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
list.AddRange(item.Children);
});
interactiveScene.SelectLastChild();
scene.SelectLastChild();
}
}
}

View file

@ -952,8 +952,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
}
else
{
Scene.Children.Modify(list => list.Remove(this.DragDropObject));
Scene.ClearSelection();
this.Scene.Children.Modify(list => list.Remove(this.DragDropObject));
this.Scene.ClearSelection();
}
this.DragDropObject = null;