Fixing problem with uninitialized leveling data

Made vertical resize container show correct cursor

issue: MatterHackers/MCCentral#4327
VerticalResizeContainer has left resizer when in right mode
This commit is contained in:
Lars Brubaker 2018-10-23 09:47:23 -07:00
parent d667bf4756
commit dc9c87b899
3 changed files with 59 additions and 10 deletions

View file

@ -44,17 +44,32 @@ namespace MatterHackers.MatterControl.CustomWidgets
private int _splitterWidth;
GrabBarSide grabSide;
private bool mouseOverBar;
internal VerticalResizeContainer(ThemeConfig theme, GrabBarSide grabSide)
: base (FlowDirection.TopToBottom)
{
this.grabSide = grabSide;
this.HAnchor = HAnchor.Absolute;
this.Cursor = Cursors.VSplit;
this.SplitterWidth = theme.SplitterWidth;
this.SpliterBarColor = theme.SplitterBackground;
}
public override Cursors Cursor
{
get
{
if (mouseOverBar)
{
return Cursors.VSplit;
}
return Cursors.Default;
}
set => base.Cursor = value;
}
public Color SpliterBarColor { get; set; }
public int SplitterWidth
@ -112,6 +127,16 @@ namespace MatterHackers.MatterControl.CustomWidgets
public override void OnMouseMove(MouseEventArgs mouseEvent)
{
if ((grabSide == GrabBarSide.Left && mouseEvent.Position.X < LocalBounds.Left + this.SplitterWidth)
|| (grabSide == GrabBarSide.Right && mouseEvent.Position.X > LocalBounds.Right - this.SplitterWidth))
{
mouseOverBar = true;
}
else
{
mouseOverBar = false;
}
if (mouseDownOnBar)
{
int currentMouseX = (int)TransformToScreenSpace(mouseEvent.Position).X;