Fix undo not immediately removing copy/pasted layer (#1381)

Bugfix: Undo does not work when copy/pasting layers (or groups), it should remove the layer that was pasted
This commit is contained in:
xkef 2023-08-13 21:47:43 +02:00 committed by GitHub
parent 752df128e3
commit c9d3453e46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -393,17 +393,17 @@ impl MessageHandler<PortfolioMessage, (&InputPreprocessorMessageHandler, &Prefer
for entry in data.iter().rev() {
let destination_path = [shallowest_common_folder.to_vec(), vec![generate_uuid()]].concat();
responses.add_front(DocumentMessage::UpdateLayerMetadata {
layer_path: destination_path.clone(),
layer_metadata: entry.layer_metadata,
});
document.load_layer_resources(responses, &entry.layer.data, destination_path.clone(), self.active_document_id.unwrap());
responses.add_front(DocumentOperation::InsertLayer {
responses.add(DocumentOperation::InsertLayer {
layer: Box::new(entry.layer.clone()),
destination_path,
destination_path: destination_path.clone(),
insert_index: -1,
duplicating: false,
});
responses.add(DocumentMessage::UpdateLayerMetadata {
layer_path: destination_path,
layer_metadata: entry.layer_metadata,
});
}
responses.add(DocumentMessage::CommitTransaction);