Fix regression with double-click in the Path tool not working (#2963)
* Fix double click in path tool not working * Remove debug line --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
parent
08ec1d08f6
commit
f15023ef58
|
|
@ -3,6 +3,7 @@ use crate::messages::prelude::*;
|
|||
#[impl_message(Message, Defer)]
|
||||
#[derive(PartialEq, Clone, Debug, serde::Serialize, serde::Deserialize)]
|
||||
pub enum DeferMessage {
|
||||
SetGraphSubmissionIndex(u64),
|
||||
TriggerGraphRun(u64),
|
||||
AfterGraphRun { messages: Vec<Message> },
|
||||
TriggerNavigationReady,
|
||||
|
|
|
|||
|
|
@ -17,15 +17,23 @@ impl MessageHandler<DeferMessage, ()> for DeferMessageHandler {
|
|||
DeferMessage::AfterNavigationReady { messages } => {
|
||||
self.after_viewport_resize.extend_from_slice(&messages);
|
||||
}
|
||||
DeferMessage::SetGraphSubmissionIndex(execution_id) => {
|
||||
self.current_graph_submission_id = execution_id + 1;
|
||||
}
|
||||
DeferMessage::TriggerGraphRun(execution_id) => {
|
||||
self.current_graph_submission_id = execution_id;
|
||||
for message in self.after_graph_run.extract_if(.., |x| x.0 < self.current_graph_submission_id) {
|
||||
responses.push_front(message.1);
|
||||
if self.after_graph_run.is_empty() {
|
||||
return;
|
||||
}
|
||||
// Find the index of the last message we can process
|
||||
let num_elements_to_remove = self.after_graph_run.binary_search_by_key(&(execution_id + 1), |x| x.0).unwrap_or_else(|pos| pos - 1);
|
||||
let elements = self.after_graph_run.drain(0..=num_elements_to_remove);
|
||||
for (_, message) in elements.rev() {
|
||||
responses.add_front(message);
|
||||
}
|
||||
}
|
||||
DeferMessage::TriggerNavigationReady => {
|
||||
for message in self.after_viewport_resize.drain(..) {
|
||||
responses.push_front(message);
|
||||
for message in self.after_viewport_resize.drain(..).rev() {
|
||||
responses.add_front(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1880,14 +1880,15 @@ impl DocumentMessageHandler {
|
|||
|
||||
let previous_network = std::mem::replace(&mut self.network_interface, network_interface);
|
||||
|
||||
// TODO: Remove once the footprint is used to load the imports/export distances from the edge
|
||||
responses.push_front(NodeGraphMessage::UnloadWires.into());
|
||||
responses.push_front(NodeGraphMessage::SetGridAlignedEdges.into());
|
||||
|
||||
// Push the UpdateOpenDocumentsList message to the bus in order to update the save status of the open documents
|
||||
responses.push_front(NodeGraphMessage::ForceRunDocumentGraph.into());
|
||||
responses.push_front(NodeGraphMessage::SelectedNodesUpdated.into());
|
||||
responses.push_front(PortfolioMessage::UpdateOpenDocumentsList.into());
|
||||
responses.add(PortfolioMessage::UpdateOpenDocumentsList);
|
||||
responses.add(NodeGraphMessage::SelectedNodesUpdated);
|
||||
responses.add(NodeGraphMessage::ForceRunDocumentGraph);
|
||||
|
||||
// TODO: Remove once the footprint is used to load the imports/export distances from the edge
|
||||
responses.add(NodeGraphMessage::UnloadWires);
|
||||
responses.add(NodeGraphMessage::SetGridAlignedEdges);
|
||||
|
||||
Some(previous_network)
|
||||
}
|
||||
pub fn redo_with_history(&mut self, ipp: &InputPreprocessorMessageHandler, responses: &mut VecDeque<Message>) {
|
||||
|
|
|
|||
|
|
@ -363,13 +363,15 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageContext<'_>> for Portfolio
|
|||
self.executor.update_font_cache(self.persistent_data.font_cache.clone());
|
||||
for document_id in self.document_ids.iter() {
|
||||
let inspect_node = self.inspect_node_id();
|
||||
let _ = self.executor.submit_node_graph_evaluation(
|
||||
if let Ok(message) = self.executor.submit_node_graph_evaluation(
|
||||
self.documents.get_mut(document_id).expect("Tried to render non-existent document"),
|
||||
ipp.viewport_bounds.size().as_uvec2(),
|
||||
timing_information,
|
||||
inspect_node,
|
||||
true,
|
||||
);
|
||||
) {
|
||||
responses.add(message);
|
||||
}
|
||||
}
|
||||
|
||||
if self.active_document_mut().is_some() {
|
||||
|
|
@ -846,11 +848,14 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageContext<'_>> for Portfolio
|
|||
ignore_hash,
|
||||
);
|
||||
|
||||
if let Err(description) = result {
|
||||
responses.add(DialogMessage::DisplayDialogError {
|
||||
title: "Unable to update node graph".to_string(),
|
||||
description,
|
||||
});
|
||||
match result {
|
||||
Err(description) => {
|
||||
responses.add(DialogMessage::DisplayDialogError {
|
||||
title: "Unable to update node graph".to_string(),
|
||||
description,
|
||||
});
|
||||
}
|
||||
Ok(message) => responses.add(message),
|
||||
}
|
||||
}
|
||||
PortfolioMessage::ToggleRulers => {
|
||||
|
|
|
|||
|
|
@ -67,10 +67,12 @@ pub trait Responses {
|
|||
}
|
||||
|
||||
impl Responses for VecDeque<Message> {
|
||||
#[inline(always)]
|
||||
fn add(&mut self, message: impl Into<Message>) {
|
||||
self.push_back(message.into());
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn add_front(&mut self, message: impl Into<Message>) {
|
||||
self.push_front(message.into());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2229,7 +2229,9 @@ impl Fsm for PathToolFsmState {
|
|||
tool_data.snapping_axis = None;
|
||||
tool_data.sliding_point_info = None;
|
||||
|
||||
responses.add(DocumentMessage::EndTransaction);
|
||||
if drag_occurred || extend_selection {
|
||||
responses.add(DocumentMessage::EndTransaction);
|
||||
}
|
||||
responses.add(PathToolMessage::SelectedPointUpdated);
|
||||
tool_data.snap_manager.cleanup(responses);
|
||||
tool_data.opposite_handle_position = None;
|
||||
|
|
@ -2282,7 +2284,9 @@ impl Fsm for PathToolFsmState {
|
|||
tool_data.saved_points_before_anchor_convert_smooth_sharp.clear();
|
||||
|
||||
responses.add(DocumentMessage::EndTransaction);
|
||||
responses.add(PathToolMessage::SelectedPointUpdated);
|
||||
responses.add(DeferMessage::AfterGraphRun {
|
||||
messages: vec![PathToolMessage::SelectedPointUpdated.into()],
|
||||
});
|
||||
}
|
||||
|
||||
return PathToolFsmState::Ready;
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ impl NodeGraphExecutor {
|
|||
}
|
||||
|
||||
/// Adds an evaluate request for whatever current network is cached.
|
||||
pub(crate) fn submit_current_node_graph_evaluation(&mut self, document: &mut DocumentMessageHandler, viewport_resolution: UVec2, time: TimingInformation) -> Result<(), String> {
|
||||
pub(crate) fn submit_current_node_graph_evaluation(&mut self, document: &mut DocumentMessageHandler, viewport_resolution: UVec2, time: TimingInformation) -> Result<Message, String> {
|
||||
let render_config = RenderConfig {
|
||||
viewport: Footprint {
|
||||
transform: document.metadata().document_to_viewport,
|
||||
|
|
@ -155,7 +155,7 @@ impl NodeGraphExecutor {
|
|||
|
||||
self.futures.insert(execution_id, ExecutionContext { export_config: None });
|
||||
|
||||
Ok(())
|
||||
Ok(DeferMessage::SetGraphSubmissionIndex(execution_id).into())
|
||||
}
|
||||
|
||||
/// Evaluates a node graph, computing the entire graph
|
||||
|
|
@ -166,11 +166,9 @@ impl NodeGraphExecutor {
|
|||
time: TimingInformation,
|
||||
inspect_node: Option<NodeId>,
|
||||
ignore_hash: bool,
|
||||
) -> Result<(), String> {
|
||||
) -> Result<Message, String> {
|
||||
self.update_node_graph(document, inspect_node, ignore_hash)?;
|
||||
self.submit_current_node_graph_evaluation(document, viewport_resolution, time)?;
|
||||
|
||||
Ok(())
|
||||
self.submit_current_node_graph_evaluation(document, viewport_resolution, time)
|
||||
}
|
||||
|
||||
/// Evaluates a node graph for export
|
||||
|
|
|
|||
Loading…
Reference in New Issue