Move 2D layer view to same context as siblings views
This commit is contained in:
parent
c5363aa077
commit
b2c898be6c
3 changed files with 68 additions and 56 deletions
|
|
@ -45,7 +45,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
public class ViewGcodeBasic : GuiWidget
|
||||
{
|
||||
private TextWidget gcodeProcessingStateInfoText;
|
||||
internal GCode2DWidget gcode2DWidget;
|
||||
private PrintItemWrapper printItem => ApplicationController.Instance.ActivePrintItem;
|
||||
|
||||
private GuiWidget gcodeDisplayWidget;
|
||||
|
|
@ -132,7 +131,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
CloseAllChildren();
|
||||
|
||||
gcode2DWidget = null;
|
||||
gcodeProcessingStateInfoText = null;
|
||||
|
||||
var mainContainerTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom)
|
||||
|
|
@ -154,15 +152,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
bool isGCode = Path.GetExtension(printItem.FileLocation).ToUpper() == ".GCODE";
|
||||
|
||||
string gcodeFilePath = isGCode ? printItem.FileLocation : printItem.GetGCodePathAndFileName();
|
||||
if (File.Exists(gcodeFilePath))
|
||||
{
|
||||
gcode2DWidget = new GCode2DWidget(new Vector2(viewerVolume.x, viewerVolume.y), bedCenter)
|
||||
{
|
||||
Visible = (activeViewMode == PartViewMode.Layers2D)
|
||||
};
|
||||
gcodeDisplayWidget.AddChild(gcode2DWidget);
|
||||
}
|
||||
else
|
||||
if (!File.Exists(gcodeFilePath))
|
||||
{
|
||||
SetProcessingMessage(string.Format("{0}\n'{1}'", fileNotFoundMessage, printItem.Name));
|
||||
}
|
||||
|
|
@ -172,37 +162,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
this.AddChild(mainContainerTopToBottom);
|
||||
|
||||
viewControls3D.ResetView += (sender, e) =>
|
||||
{
|
||||
if (gcodeDisplayWidget.Visible)
|
||||
{
|
||||
gcode2DWidget.CenterPartInView();
|
||||
}
|
||||
};
|
||||
viewControls3D.TransformStateChanged += (s, e) =>
|
||||
{
|
||||
switch (e.TransformMode)
|
||||
{
|
||||
case ViewControls3DButtons.Translate:
|
||||
if (gcode2DWidget != null)
|
||||
{
|
||||
gcode2DWidget.TransformState = GCode2DWidget.ETransformState.Move;
|
||||
}
|
||||
break;
|
||||
|
||||
case ViewControls3DButtons.Scale:
|
||||
if (gcode2DWidget != null)
|
||||
{
|
||||
gcode2DWidget.TransformState = GCode2DWidget.ETransformState.Scale;
|
||||
}
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
// *************** AddGCodeFileControls ***************
|
||||
SetProcessingMessage("");
|
||||
if (gcode2DWidget != null
|
||||
&& loadedGCode == null)
|
||||
if (loadedGCode == null)
|
||||
{
|
||||
// If we have finished loading the gcode and the source file exists but we don't have any loaded gcode it is because the loader decided to not load it.
|
||||
if (File.Exists(printItem.FileLocation))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue