Skip to content

Commit d66992a

Browse files
committed
Reverted changes for #453 and added undo functionality to Paste
1 parent 6bcbb9f commit d66992a

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

editor/src/document/document_file.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ impl DocumentMessageHandler {
275275

276276
pub fn selected_layers_without_children(&self) -> Vec<Vec<LayerId>> {
277277
let mut sorted_layers = self.selected_layers().collect::<Vec<_>>();
278+
// Sorting here creates groups of similar UUID paths
278279
sorted_layers.sort();
279280

280281
if sorted_layers.is_empty() {

editor/src/document/document_message_handler.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -366,23 +366,20 @@ impl MessageHandler<DocumentsMessage, &InputPreprocessor> for DocumentsMessageHa
366366
(Err(e), _) => warn!("Could not access selected layer {:?}: {:?}", layer_path, e),
367367
}
368368
}
369+
//responses.push_back(DeselectAllLayers.into());
369370
}
370371
Cut(clipboard) => {
371372
responses.push_back(Copy(clipboard).into());
372373
responses.push_back(DeleteSelectedLayers.into());
373374
}
374375
Paste(clipboard) => {
375376
let document = self.active_document();
376-
let mut shallowest_common_folder = document
377+
let shallowest_common_folder = document
377378
.graphene_document
378379
.shallowest_common_folder(document.selected_layers())
379380
.expect("While pasting, the selected layers did not exist while attempting to find the appropriate folder path for insertion");
380381

381-
// We want to paste folders at the same depth as their copy source
382-
if !shallowest_common_folder.is_empty() && document.selected_layers_contains(shallowest_common_folder) {
383-
shallowest_common_folder = &shallowest_common_folder[..shallowest_common_folder.len() - 1];
384-
}
385-
382+
responses.push_back(StartTransaction.into());
386383
responses.push_back(
387384
PasteIntoFolder {
388385
clipboard,
@@ -391,6 +388,7 @@ impl MessageHandler<DocumentsMessage, &InputPreprocessor> for DocumentsMessageHa
391388
}
392389
.into(),
393390
);
391+
responses.push_back(CommitTransaction.into());
394392
}
395393
PasteIntoFolder { clipboard, path, insert_index } => {
396394
let paste = |entry: &CopyBufferEntry, responses: &mut VecDeque<_>| {

0 commit comments

Comments
 (0)