Add double clicking a node frame to open the graph panel (#862)
Double Click to Open Node UI
This commit is contained in:
parent
01a9724389
commit
ccdfdd3015
|
|
@ -407,16 +407,16 @@ impl Fsm for SelectToolFsmState {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
(_, EditLayer) => {
|
(_, EditLayer) => {
|
||||||
|
// On double click with select tool we sometimes want to edit the double clicked layers
|
||||||
|
|
||||||
|
// Setup required data for checking the clicked layer
|
||||||
let mouse_pos = input.mouse.position;
|
let mouse_pos = input.mouse.position;
|
||||||
let tolerance = DVec2::splat(SELECTION_TOLERANCE);
|
let tolerance = DVec2::splat(SELECTION_TOLERANCE);
|
||||||
let quad = Quad::from_box([mouse_pos - tolerance, mouse_pos + tolerance]);
|
let quad = Quad::from_box([mouse_pos - tolerance, mouse_pos + tolerance]);
|
||||||
|
|
||||||
if let Some(Ok(intersect)) = document
|
// Check the last (top most) intersection layer.
|
||||||
.graphene_document
|
if let Some(intersect_layer_path) = document.graphene_document.intersects_quad_root(quad, font_cache).last() {
|
||||||
.intersects_quad_root(quad, font_cache)
|
if let Ok(intersect) = document.graphene_document.layer(intersect_layer_path) {
|
||||||
.last()
|
|
||||||
.map(|path| document.graphene_document.layer(path))
|
|
||||||
{
|
|
||||||
match intersect.data {
|
match intersect.data {
|
||||||
LayerDataType::Text(_) => {
|
LayerDataType::Text(_) => {
|
||||||
responses.push_front(ToolMessage::ActivateTool { tool_type: ToolType::Text }.into());
|
responses.push_front(ToolMessage::ActivateTool { tool_type: ToolType::Text }.into());
|
||||||
|
|
@ -425,9 +425,16 @@ impl Fsm for SelectToolFsmState {
|
||||||
LayerDataType::Shape(_) => {
|
LayerDataType::Shape(_) => {
|
||||||
responses.push_front(ToolMessage::ActivateTool { tool_type: ToolType::Path }.into());
|
responses.push_front(ToolMessage::ActivateTool { tool_type: ToolType::Path }.into());
|
||||||
}
|
}
|
||||||
|
LayerDataType::NodeGraphFrame(_) => {
|
||||||
|
let replacement_selected_layers = vec![intersect_layer_path.clone()];
|
||||||
|
let layer_path = intersect_layer_path.clone();
|
||||||
|
responses.push_back(DocumentMessage::SetSelectedLayers { replacement_selected_layers }.into());
|
||||||
|
responses.push_back(NodeGraphMessage::OpenNodeGraph { layer_path }.into());
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue