From ab8748627d68932741b79b87bb19ccb81f81ee3f Mon Sep 17 00:00:00 2001 From: Dennis Kobert Date: Wed, 24 Jul 2024 01:44:57 +0200 Subject: [PATCH] Fix Layers panel UI not updating on selection change and expand/collapsing (#1847) Also fixes a panic on empty layer. * Fix layer properties updete on layer change + fix panic on empty layer * Fix Layers panel expand/collapse --------- Co-authored-by: Keavon Chambers --- editor/src/dispatcher.rs | 2 +- .../messages/portfolio/document/document_message_handler.rs | 2 +- .../document/node_graph/node_graph_message_handler.rs | 1 + editor/src/messages/tool/tool_messages/select_tool.rs | 3 +++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/editor/src/dispatcher.rs b/editor/src/dispatcher.rs index 62696157a5..b97d95118d 100644 --- a/editor/src/dispatcher.rs +++ b/editor/src/dispatcher.rs @@ -46,7 +46,7 @@ const DEBUG_MESSAGE_BLOCK_LIST: &[MessageDiscriminant] = &[ MessageDiscriminant::InputPreprocessor(InputPreprocessorMessageDiscriminant::FrameTimeAdvance), ]; // TODO: Find a way to combine these with the list above. We use strings for now since these are the standard variant names used by multiple messages. But having these also type-checked would be best. -const DEBUG_MESSAGE_ENDING_BLOCK_LIST: &[&str] = &["PointerMove", "PointerOutsideViewport"]; +const DEBUG_MESSAGE_ENDING_BLOCK_LIST: &[&str] = &["PointerMove", "PointerOutsideViewport", "Overlays", "Draw"]; impl Dispatcher { pub fn new() -> Self { diff --git a/editor/src/messages/portfolio/document/document_message_handler.rs b/editor/src/messages/portfolio/document/document_message_handler.rs index 7e3d7b2b70..169032497c 100644 --- a/editor/src/messages/portfolio/document/document_message_handler.rs +++ b/editor/src/messages/portfolio/document/document_message_handler.rs @@ -1015,7 +1015,7 @@ impl MessageHandler> for DocumentMessag } else { self.collapsed.0.push(layer); } - responses.add(NodeGraphMessage::RunDocumentGraph); + responses.add(NodeGraphMessage::SendGraph); } DocumentMessage::ToggleGridVisibility => { self.snapping_state.grid_snapping = !self.snapping_state.grid_snapping; diff --git a/editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs b/editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs index 7320cac817..660582f676 100644 --- a/editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs +++ b/editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs @@ -100,6 +100,7 @@ impl<'a> MessageHandler> for NodeGrap }); } responses.add(ArtboardToolMessage::UpdateSelectedArtboard); + responses.add(DocumentMessage::DocumentStructureChanged); responses.add(NodeGraphMessage::RunDocumentGraph); } NodeGraphMessage::ConnectNodesByWire { diff --git a/editor/src/messages/tool/tool_messages/select_tool.rs b/editor/src/messages/tool/tool_messages/select_tool.rs index 07dc910ea0..f01ed5b84e 100644 --- a/editor/src/messages/tool/tool_messages/select_tool.rs +++ b/editor/src/messages/tool/tool_messages/select_tool.rs @@ -441,6 +441,9 @@ impl Fsm for SelectToolFsmState { .next() .map(|layer| document.metadata().transform_to_viewport(layer)); let transform = transform.unwrap_or(DAffine2::IDENTITY); + if transform.matrix2.determinant() == 0. { + return self; + } let bounds = document .selected_nodes .selected_visible_and_unlocked_layers(document.metadata())