Фикс выбора документа при перемещении
This commit is contained in:
@@ -231,26 +231,34 @@ public partial class EditorViewModel : ViewModelBase
|
||||
private void MoveDocumentUp()
|
||||
{
|
||||
if (Container is null || ActiveDocument is null) return;
|
||||
int idx = Container.Documents.IndexOf(ActiveDocument);
|
||||
var doc = ActiveDocument;
|
||||
int idx = Container.Documents.IndexOf(doc);
|
||||
if (idx <= 0) return;
|
||||
(Container.Documents[idx], Container.Documents[idx - 1]) = (Container.Documents[idx - 1], Container.Documents[idx]);
|
||||
SyncDocumentsList();
|
||||
_suppressDocumentSync = true;
|
||||
ActiveDocument = Container.Documents[idx - 1];
|
||||
_suppressDocumentSync = false;
|
||||
ReselectDocument(doc);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void MoveDocumentDown()
|
||||
{
|
||||
if (Container is null || ActiveDocument is null) return;
|
||||
int idx = Container.Documents.IndexOf(ActiveDocument);
|
||||
var doc = ActiveDocument;
|
||||
int idx = Container.Documents.IndexOf(doc);
|
||||
if (idx < 0 || idx >= Container.Documents.Count - 1) return;
|
||||
(Container.Documents[idx], Container.Documents[idx + 1]) = (Container.Documents[idx + 1], Container.Documents[idx]);
|
||||
SyncDocumentsList();
|
||||
ReselectDocument(doc);
|
||||
}
|
||||
|
||||
private void ReselectDocument(MinintDocument doc)
|
||||
{
|
||||
// Force SelectedItem rebinding after list rebuild even when the selected object is the same reference.
|
||||
_suppressDocumentSync = true;
|
||||
ActiveDocument = Container.Documents[idx + 1];
|
||||
ActiveDocument = null;
|
||||
ActiveDocument = doc;
|
||||
_suppressDocumentSync = false;
|
||||
SyncLayersAndCanvas(doc);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user