diff --git a/ApplicationView/PrinterModels.cs b/ApplicationView/PrinterModels.cs index 9447909c2..47f5ab3e0 100644 --- a/ApplicationView/PrinterModels.cs +++ b/ApplicationView/PrinterModels.cs @@ -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 diff --git a/PartPreviewWindow/PrinterTabPage.cs b/PartPreviewWindow/PrinterTabPage.cs index 18cd23ad1..9e4934615 100644 --- a/PartPreviewWindow/PrinterTabPage.cs +++ b/PartPreviewWindow/PrinterTabPage.cs @@ -162,9 +162,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow BackgroundColor = theme.InteractionLayerOverlayColor, }; + var modelViewSidePanel = view3DWidget.Descendants().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); diff --git a/PartPreviewWindow/View3D/TumbleCubeControl.cs b/PartPreviewWindow/View3D/TumbleCubeControl.cs index a993f4292..807882f22 100644 --- a/PartPreviewWindow/View3D/TumbleCubeControl.cs +++ b/PartPreviewWindow/View3D/TumbleCubeControl.cs @@ -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) { diff --git a/PartPreviewWindow/View3D/View3DWidget.cs b/PartPreviewWindow/View3D/View3DWidget.cs index 7be3f2cc4..1cfba59b4 100644 --- a/PartPreviewWindow/View3D/View3DWidget.cs +++ b/PartPreviewWindow/View3D/View3DWidget.cs @@ -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; diff --git a/SettingsManagement/UserSettings.cs b/SettingsManagement/UserSettings.cs index fe8226a36..177ee52ec 100644 --- a/SettingsManagement/UserSettings.cs +++ b/SettingsManagement/UserSettings.cs @@ -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); diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index b59dbc5a4..2f823d074 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit b59dbc5a4ec76f32eaaea710d03472cfea26b5fa +Subproject commit 2f823d0749e8f3986d4e010ef1169d38df5486a6