Add middle and right mouse button actions to asset/object pickers to clear value or show popup quickly
This commit is contained in:
@@ -322,7 +322,11 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
|
||||
// Deselect
|
||||
if (_value != null && button1Rect.Contains(ref location))
|
||||
{
|
||||
Focus();
|
||||
Value = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Picker dropdown menu
|
||||
if (_supportsPickDropDown && (isSelected ? button2Rect : button1Rect).Contains(ref location))
|
||||
@@ -372,6 +376,18 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
if (_hasValidDragOver)
|
||||
_hasValidDragOver = false;
|
||||
}
|
||||
if (button == MouseButton.Middle)
|
||||
{
|
||||
// Clear value
|
||||
Focus();
|
||||
Value = null;
|
||||
return true;
|
||||
}
|
||||
if (button == MouseButton.Right && _supportsPickDropDown)
|
||||
{
|
||||
// Show picker
|
||||
ShowDropDownMenu();
|
||||
}
|
||||
|
||||
return base.OnMouseUp(location, button);
|
||||
}
|
||||
|
||||
@@ -299,6 +299,7 @@ namespace FlaxEditor.GUI
|
||||
}
|
||||
else if (Button1Rect.Contains(location))
|
||||
{
|
||||
// Show picker
|
||||
Focus();
|
||||
OnSubmit();
|
||||
}
|
||||
@@ -318,6 +319,18 @@ namespace FlaxEditor.GUI
|
||||
}
|
||||
}
|
||||
}
|
||||
if (button == MouseButton.Middle && IconRect.Contains(ref location))
|
||||
{
|
||||
// Clear value
|
||||
Focus();
|
||||
Validator.SelectedItem = null;
|
||||
}
|
||||
if (button == MouseButton.Right && IconRect.Contains(ref location))
|
||||
{
|
||||
// Show picker
|
||||
Focus();
|
||||
OnSubmit();
|
||||
}
|
||||
|
||||
// Handled
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user