Фикс выбора документа при перемещении
This commit is contained in:
@@ -231,26 +231,34 @@ public partial class EditorViewModel : ViewModelBase
|
|||||||
private void MoveDocumentUp()
|
private void MoveDocumentUp()
|
||||||
{
|
{
|
||||||
if (Container is null || ActiveDocument is null) return;
|
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;
|
if (idx <= 0) return;
|
||||||
(Container.Documents[idx], Container.Documents[idx - 1]) = (Container.Documents[idx - 1], Container.Documents[idx]);
|
(Container.Documents[idx], Container.Documents[idx - 1]) = (Container.Documents[idx - 1], Container.Documents[idx]);
|
||||||
SyncDocumentsList();
|
SyncDocumentsList();
|
||||||
_suppressDocumentSync = true;
|
ReselectDocument(doc);
|
||||||
ActiveDocument = Container.Documents[idx - 1];
|
|
||||||
_suppressDocumentSync = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private void MoveDocumentDown()
|
private void MoveDocumentDown()
|
||||||
{
|
{
|
||||||
if (Container is null || ActiveDocument is null) return;
|
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;
|
if (idx < 0 || idx >= Container.Documents.Count - 1) return;
|
||||||
(Container.Documents[idx], Container.Documents[idx + 1]) = (Container.Documents[idx + 1], Container.Documents[idx]);
|
(Container.Documents[idx], Container.Documents[idx + 1]) = (Container.Documents[idx + 1], Container.Documents[idx]);
|
||||||
SyncDocumentsList();
|
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;
|
_suppressDocumentSync = true;
|
||||||
ActiveDocument = Container.Documents[idx + 1];
|
ActiveDocument = null;
|
||||||
|
ActiveDocument = doc;
|
||||||
_suppressDocumentSync = false;
|
_suppressDocumentSync = false;
|
||||||
|
SyncLayersAndCanvas(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
Reference in New Issue
Block a user