mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-08-20 05:00:14 +00:00
Reverted changes for #453 and added undo functionality to Paste
This commit is contained in:
parent
6bcbb9f82f
commit
d66992ac94
2 changed files with 5 additions and 6 deletions
|
@ -275,6 +275,7 @@ impl DocumentMessageHandler {
|
||||||
|
|
||||||
pub fn selected_layers_without_children(&self) -> Vec<Vec<LayerId>> {
|
pub fn selected_layers_without_children(&self) -> Vec<Vec<LayerId>> {
|
||||||
let mut sorted_layers = self.selected_layers().collect::<Vec<_>>();
|
let mut sorted_layers = self.selected_layers().collect::<Vec<_>>();
|
||||||
|
// Sorting here creates groups of similar UUID paths
|
||||||
sorted_layers.sort();
|
sorted_layers.sort();
|
||||||
|
|
||||||
if sorted_layers.is_empty() {
|
if sorted_layers.is_empty() {
|
||||||
|
|
|
@ -366,6 +366,7 @@ impl MessageHandler<DocumentsMessage, &InputPreprocessor> for DocumentsMessageHa
|
||||||
(Err(e), _) => warn!("Could not access selected layer {:?}: {:?}", layer_path, e),
|
(Err(e), _) => warn!("Could not access selected layer {:?}: {:?}", layer_path, e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//responses.push_back(DeselectAllLayers.into());
|
||||||
}
|
}
|
||||||
Cut(clipboard) => {
|
Cut(clipboard) => {
|
||||||
responses.push_back(Copy(clipboard).into());
|
responses.push_back(Copy(clipboard).into());
|
||||||
|
@ -373,16 +374,12 @@ impl MessageHandler<DocumentsMessage, &InputPreprocessor> for DocumentsMessageHa
|
||||||
}
|
}
|
||||||
Paste(clipboard) => {
|
Paste(clipboard) => {
|
||||||
let document = self.active_document();
|
let document = self.active_document();
|
||||||
let mut shallowest_common_folder = document
|
let shallowest_common_folder = document
|
||||||
.graphene_document
|
.graphene_document
|
||||||
.shallowest_common_folder(document.selected_layers())
|
.shallowest_common_folder(document.selected_layers())
|
||||||
.expect("While pasting, the selected layers did not exist while attempting to find the appropriate folder path for insertion");
|
.expect("While pasting, the selected layers did not exist while attempting to find the appropriate folder path for insertion");
|
||||||
|
|
||||||
// We want to paste folders at the same depth as their copy source
|
responses.push_back(StartTransaction.into());
|
||||||
if !shallowest_common_folder.is_empty() && document.selected_layers_contains(shallowest_common_folder) {
|
|
||||||
shallowest_common_folder = &shallowest_common_folder[..shallowest_common_folder.len() - 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
responses.push_back(
|
responses.push_back(
|
||||||
PasteIntoFolder {
|
PasteIntoFolder {
|
||||||
clipboard,
|
clipboard,
|
||||||
|
@ -391,6 +388,7 @@ impl MessageHandler<DocumentsMessage, &InputPreprocessor> for DocumentsMessageHa
|
||||||
}
|
}
|
||||||
.into(),
|
.into(),
|
||||||
);
|
);
|
||||||
|
responses.push_back(CommitTransaction.into());
|
||||||
}
|
}
|
||||||
PasteIntoFolder { clipboard, path, insert_index } => {
|
PasteIntoFolder { clipboard, path, insert_index } => {
|
||||||
let paste = |entry: &CopyBufferEntry, responses: &mut VecDeque<_>| {
|
let paste = |entry: &CopyBufferEntry, responses: &mut VecDeque<_>| {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue