Making the grab controls selectable
This commit is contained in:
parent
4fab94263c
commit
c61a7d9ae8
2 changed files with 28 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue