Change actor scroll cache to use guid and float instead of strings, remove onactor removed code to keep values after undo.
This commit is contained in:
@@ -21,7 +21,7 @@ namespace FlaxEditor.Windows
|
|||||||
{
|
{
|
||||||
private IEnumerable<object> undoRecordObjects;
|
private IEnumerable<object> undoRecordObjects;
|
||||||
|
|
||||||
private readonly Dictionary<string, string> _actorScrollValues = new Dictionary<string, string>();
|
private readonly Dictionary<Guid, float> _actorScrollValues = new Dictionary<Guid, float>();
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool UseLayoutData => true;
|
public override bool UseLayoutData => true;
|
||||||
@@ -63,7 +63,6 @@ namespace FlaxEditor.Windows
|
|||||||
|
|
||||||
VScrollBar.ValueChanged += OnScrollValueChanged;
|
VScrollBar.ValueChanged += OnScrollValueChanged;
|
||||||
Editor.SceneEditing.SelectionChanged += OnSelectionChanged;
|
Editor.SceneEditing.SelectionChanged += OnSelectionChanged;
|
||||||
Editor.Scene.ActorRemoved += OnActorRemoved;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@@ -77,11 +76,6 @@ namespace FlaxEditor.Windows
|
|||||||
_actorScrollValues.Clear();
|
_actorScrollValues.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnActorRemoved(ActorNode node)
|
|
||||||
{
|
|
||||||
_actorScrollValues.Remove(node.ID.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnScrollValueChanged()
|
private void OnScrollValueChanged()
|
||||||
{
|
{
|
||||||
if (Editor.SceneEditing.SelectionCount > 1)
|
if (Editor.SceneEditing.SelectionCount > 1)
|
||||||
@@ -100,7 +94,7 @@ namespace FlaxEditor.Windows
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_actorScrollValues[Editor.SceneEditing.Selection[0].ID.ToString()] = VScrollBar.TargetValue.ToString("0");
|
_actorScrollValues[Editor.SceneEditing.Selection[0].ID] = VScrollBar.TargetValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<object> GetUndoObjects(CustomEditorPresenter customEditorPresenter)
|
private IEnumerable<object> GetUndoObjects(CustomEditorPresenter customEditorPresenter)
|
||||||
@@ -121,12 +115,7 @@ namespace FlaxEditor.Windows
|
|||||||
|
|
||||||
// Set scroll value of window if it exists
|
// Set scroll value of window if it exists
|
||||||
if (Editor.SceneEditing.SelectionCount == 1)
|
if (Editor.SceneEditing.SelectionCount == 1)
|
||||||
{
|
VScrollBar.TargetValue = _actorScrollValues.GetValueOrDefault(Editor.SceneEditing.Selection[0].ID, 0);
|
||||||
if (_actorScrollValues.TryGetValue(Editor.SceneEditing.Selection[0].ID.ToString(), out var outValue))
|
|
||||||
VScrollBar.TargetValue = Convert.ToSingle(outValue);
|
|
||||||
else
|
|
||||||
VScrollBar.TargetValue = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
Reference in New Issue
Block a user