mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-01 00:08:12 +08:00
Fix chaining GRS commands so they work smoothly and don't add intermediate undo steps (#2297)
Fix GRS chaining behaviour and generalise Abort to have n≠1 undos Fixes https://discord.com/channels/731730685944922173/881073965047636018/1328281947918696458
This commit is contained in:
@@ -165,6 +165,9 @@ pub enum DocumentMessage {
|
||||
EndTransaction,
|
||||
CommitTransaction,
|
||||
AbortTransaction,
|
||||
RepeatedAbortTransaction {
|
||||
undo_count: usize,
|
||||
},
|
||||
AddTransaction,
|
||||
ToggleLayerExpansion {
|
||||
id: NodeId,
|
||||
|
||||
@@ -1183,11 +1183,17 @@ impl MessageHandler<DocumentMessage, DocumentMessageData<'_>> for DocumentMessag
|
||||
self.document_redo_history.clear();
|
||||
}
|
||||
DocumentMessage::AbortTransaction => {
|
||||
responses.add(DocumentMessage::RepeatedAbortTransaction { undo_count: 1 });
|
||||
}
|
||||
DocumentMessage::RepeatedAbortTransaction { undo_count } => {
|
||||
if self.network_interface.transaction_status() == TransactionStatus::Finished {
|
||||
return;
|
||||
}
|
||||
|
||||
self.undo(ipp, responses);
|
||||
for _ in 0..undo_count {
|
||||
self.undo(ipp, responses);
|
||||
}
|
||||
|
||||
self.network_interface.finish_transaction();
|
||||
responses.add(OverlaysMessage::Draw);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user