mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-08-19 04:30:16 +00:00
Change the select tool to immediately start dragging when clicking a shape (#424)
* Change the select tool to immediately start dragging when clicking a shape * Fix operation order * Fix holding shift to add to selection
This commit is contained in:
parent
1186f33113
commit
b605466819
1 changed files with 14 additions and 10 deletions
|
@ -167,15 +167,9 @@ impl Fsm for SelectToolFsmState {
|
|||
let mut buffer = Vec::new();
|
||||
let mut selected: Vec<_> = document.selected_layers().map(|path| path.to_vec()).collect();
|
||||
let quad = data.selection_quad();
|
||||
let intersection = document.graphene_document.intersects_quad_root(quad);
|
||||
// If no layer is currently selected and the user clicks on a shape, select that.
|
||||
if selected.is_empty() {
|
||||
if let Some(layer) = intersection.last() {
|
||||
selected.push(layer.clone());
|
||||
buffer.push(DocumentMessage::SetSelectedLayers(selected.clone()).into());
|
||||
}
|
||||
}
|
||||
let mut intersection = document.graphene_document.intersects_quad_root(quad);
|
||||
// If the user clicks on a layer that is in their current selection, go into the dragging mode.
|
||||
// If the user clicks on new shape, make that layer their new selection.
|
||||
// Otherwise enter the box select mode
|
||||
let state = if selected.iter().any(|path| intersection.contains(path)) {
|
||||
buffer.push(DocumentMessage::StartTransaction.into());
|
||||
|
@ -184,9 +178,19 @@ impl Fsm for SelectToolFsmState {
|
|||
} else {
|
||||
if !input.keyboard.get(add_to_selection as usize) {
|
||||
buffer.push(DocumentMessage::DeselectAllLayers.into());
|
||||
data.layers_dragging.clear();
|
||||
}
|
||||
|
||||
if let Some(intersection) = intersection.pop() {
|
||||
selected = vec![intersection];
|
||||
buffer.push(DocumentMessage::AddSelectedLayers(selected.clone()).into());
|
||||
buffer.push(DocumentMessage::StartTransaction.into());
|
||||
data.layers_dragging.append(&mut selected);
|
||||
Dragging
|
||||
} else {
|
||||
data.drag_box_id = Some(add_bounding_box(&mut buffer));
|
||||
DrawingBox
|
||||
}
|
||||
};
|
||||
buffer.into_iter().rev().for_each(|message| responses.push_front(message));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue