close popup button correctly

issue: MatterHackers/MCCentral#4150
Popup menu buttons should toggle on/off when clicked
This commit is contained in:
Lars Brubaker 2018-09-18 14:18:12 -07:00
parent e225f9dad0
commit a8ed62d6ad
2 changed files with 12 additions and 2 deletions

View file

@ -71,9 +71,19 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
set => base.BackgroundColor = value;
}
private bool downWhileOpen = false;
public override void OnMouseDown(MouseEventArgs mouseEvent)
{
downWhileOpen = menuVisible;
base.OnMouseDown(mouseEvent);
}
public override void OnClick(MouseEventArgs mouseEvent)
{
if (!menuVisible)
if (!menuVisible
&& !downWhileOpen)
{
var popupContent = this.PopupContent();
if (popupContent == null

@ -1 +1 @@
Subproject commit e7cdad21ee05c90084993ca7f1375aab84d9080f
Subproject commit 6502c636bfed604fa20c11db93ca2c2780d0cce7