Add Shift for range-based selection in curve and timeline editors

This commit is contained in:
Wojtek Figat
2021-08-31 13:59:47 +02:00
parent d8f72daf94
commit d062601260
3 changed files with 51 additions and 20 deletions

View File

@@ -301,14 +301,33 @@ namespace FlaxEditor.GUI
{
if (_leftMouseDown)
{
// Check if user is pressing control
if (Root.GetKey(KeyboardKeys.Control))
{
// Toggle selection
keyframe.IsSelected = !keyframe.IsSelected;
_editor.UpdateTangents();
}
// Check if node isn't selected
else if (Root.GetKey(KeyboardKeys.Shift))
{
// Select range
keyframe.IsSelected = true;
int selectionStart = 0;
for (; selectionStart < _editor._points.Count; selectionStart++)
{
if (_editor._points[selectionStart].IsSelected)
break;
}
int selectionEnd = _editor._points.Count - 1;
for (; selectionEnd > selectionStart; selectionEnd--)
{
if (_editor._points[selectionEnd].IsSelected)
break;
}
selectionStart++;
for (; selectionStart < selectionEnd; selectionStart++)
_editor._points[selectionStart].IsSelected = true;
_editor.UpdateTangents();
}
else if (!keyframe.IsSelected)
{
// Select node