Merge pull request #3198 from larsbrubaker/design_tools

Got the view to be off center
This commit is contained in:
johnlewin 2018-04-18 10:53:27 -07:00 committed by GitHub
commit 6b64b5c7a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 23 deletions

View file

@ -691,24 +691,6 @@ namespace MatterHackers.MatterControl
UserSettings.Instance.set(UserSettingsKey.SelectedObjectPanelWidth, minimumValue.ToString());
}
}
public double GCodePanelWidth
{
get
{
if (double.TryParse(UserSettings.Instance.get(UserSettingsKey.GCodePanelWidth), out double controlWidth))
{
return Math.Max(controlWidth, 200);
}
return 200;
}
set
{
var minimumValue = Math.Max(value, 200);
UserSettings.Instance.set(UserSettingsKey.GCodePanelWidth, minimumValue.ToString());
}
}
}
public class PrinterConfig

View file

@ -162,9 +162,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
BackgroundColor = theme.InteractionLayerOverlayColor,
};
var modelViewSidePanel = view3DWidget.Descendants<ResizeContainer>().FirstOrDefault();
gcodeContainer = new ResizeContainer(gcodePanel)
{
Width = printer?.ViewState.GCodePanelWidth ?? 200,
Width = printer?.ViewState.SelectedObjectPanelWidth ?? 200,
VAnchor = VAnchor.Stretch,
HAnchor = HAnchor.Absolute,
SpliterBarColor = theme.SplitterBackground,
@ -173,6 +175,16 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
};
gcodeContainer.AddChild(gcodePanel);
modelViewSidePanel.BoundsChanged += (s, e) =>
{
gcodeContainer.Width = modelViewSidePanel.Width;
};
gcodeContainer.BoundsChanged += (s, e) =>
{
modelViewSidePanel.Width = gcodeContainer.Width;
};
var splitContainer = view3DWidget.FindNamedChildRecursive("SplitContainer");
splitContainer.AddChild(gcodeContainer);

View file

@ -113,7 +113,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
if (MouseDownOnWidget)
{
var movePosition = mouseEvent.Position;
Quaternion activeRotationQuaternion = TrackBallController.GetRotationForMove(world, Width, lastMovePosition, movePosition, false);
Quaternion activeRotationQuaternion = TrackBallController.GetRotationForMove(new Vector2(Width/2, Height/2), world, Width, lastMovePosition, movePosition, false);
if (activeRotationQuaternion != Quaternion.Identity)
{

View file

@ -120,6 +120,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
};
trackballTumbleWidget.AnchorAll();
this.BoundsChanged += UpdateRenderView;
// TumbleWidget
this.InteractionLayer.AddChild(trackballTumbleWidget);
@ -157,7 +159,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
BackgroundColor = theme.InteractionLayerOverlayColor,
SpliterBarColor = theme.SplitterBackground,
SplitterWidth = theme.SplitterWidth,
MinimumSize = new Vector2(theme.SplitterWidth, 0)
};
modelViewSidePanel.BoundsChanged += UpdateRenderView;
modelViewSidePanel.AddChild(
new SectionWidget(
@ -223,6 +227,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
this.sceneContext.SceneLoaded += SceneContext_SceneLoaded;
}
private void UpdateRenderView(object sender, EventArgs e)
{
trackballTumbleWidget.CenterOffsetX = -modelViewSidePanel.Width;
}
private void SceneContext_SceneLoaded(object sender, EventArgs e)
{
if (this.printerTabPage?.printerActionsBar?.sliceButton is GuiWidget sliceButton)
@ -422,7 +431,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
if (printer != null)
{
printer.ViewState.SelectedObjectPanelWidth = selectedObjectPanel.Width;
printer.ViewState.GCodePanelWidth = printerTabPage.gcodeContainer.Width;
}
viewControls3D.TransformStateChanged -= ViewControls3D_TransformStateChanged;

View file

@ -24,7 +24,6 @@ namespace MatterHackers.MatterControl
public const string SelectedObjectPanelWidth = nameof(SelectedObjectPanelWidth);
public const string ConfigurePrinter_CurrentTab = nameof(ConfigurePrinter_CurrentTab);
public const string ConfigurePrinterTabVisible = nameof(ConfigurePrinterTabVisible);
public const string GCodePanelWidth = nameof(GCodePanelWidth);
public const string MirrorPanelExpanded = nameof(MirrorPanelExpanded);
public const string MaterialsPanelExpanded = nameof(MaterialsPanelExpanded);
public const string ColorPanelExpanded = nameof(ColorPanelExpanded);

@ -1 +1 @@
Subproject commit b59dbc5a4ec76f32eaaea710d03472cfea26b5fa
Subproject commit 2f823d0749e8f3986d4e010ef1169d38df5486a6