Making the grab controls selectable

This commit is contained in:
LarsBrubaker 2021-07-26 16:25:20 -07:00
parent 4fab94263c
commit c61a7d9ae8
2 changed files with 28 additions and 1 deletions

View file

@ -324,6 +324,7 @@ namespace MatterHackers.MatterControl.DesignTools
var image = leftHandle.Image;
var leftGraphics = image.NewGraphics2D();
leftGraphics.Line(image.Width, 0, image.Width, image.Height, theme.TextColor);
leftGraphics.FillRectangle(0, image.Height / 4, image.Width, image.Height / 4 * 3, theme.TextColor);
historgramWidget.AddChild(leftHandle);
var rightHandle = new ImageWidget((int)(handleWidth), (int)historgramWidget.Height);
@ -331,8 +332,34 @@ namespace MatterHackers.MatterControl.DesignTools
image = rightHandle.Image;
var rightGraphics = image.NewGraphics2D();
rightGraphics.Line(0, 0, 0, image.Height, theme.TextColor);
rightGraphics.FillRectangle(0, image.Height / 4, image.Width, image.Height / 4 * 3, theme.TextColor);
historgramWidget.AddChild(rightHandle);
var leftDown = false;
var rightDown = false;
historgramWidget.MouseDown += (s, e) =>
{
if (e.Button == MouseButtons.Left)
{
if (leftHandle.BoundsRelativeToParent.Contains(e.Position.X, 0))
{
leftDown = true;
}
}
};
historgramWidget.MouseMove += (s, e) =>
{
if (leftDown)
{
RangeStart = e.Position.X / _histogramRawCache.Width;
leftHandle.Position = new Vector2(RangeStart * _histogramRawCache.Width, 0);
}
};
historgramWidget.MouseUp += (s, e) =>
{
leftDown = false;
};
return historgramWidget;
}

@ -1 +1 @@
Subproject commit d48607c693f1c76be4b3531cc9cf3cf2f57905b3
Subproject commit 6882634e8d9c5abf18d2e0d4a6d6735d7b1b3d30