Skip to content

Commit

Permalink
Skip folders on a different indentation level during reorder
Browse files Browse the repository at this point in the history
  • Loading branch information
TrueDoctor committed Aug 11, 2021
1 parent 34e1bb1 commit c16c70d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion editor/src/document/document_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,8 @@ impl MessageHandler<DocumentMessage, &InputPreprocessor> for DocumentMessageHand
1 => selected_layers.last(),
_ => unreachable!(),
} {
if let Some(pos) = all_layer_paths.iter().position(|path| path == pivot) {
let all_layer_paths:Vec<_> = all_layer_paths.iter().filter(|layer|layer.len() == pivot.len()).collect();
if let Some(pos) = all_layer_paths.iter().position(|path| *path == pivot) {
let max = all_layer_paths.len() as i64 - 1;
let insert_pos = (pos as i64 + relative_position as i64).clamp(0, max) as usize;
let insert = all_layer_paths.get(insert_pos);
Expand Down

0 comments on commit c16c70d

Please sign in to comment.