Build the node graph frontend with placeholder graph info (#581)

* Build the node graph frontend

* Graph pan and zoom

* Graph's dot grid now pans/zooms also

* Interactive horisontal to vertical curves

* Data types and zooming on wires

* Icon definitions code beautification

* Add a visibility toggle

Co-authored-by: 0hypercube <0hypercube@gmail.com>
This commit is contained in:
Keavon Chambers
2022-05-10 22:34:25 -07:00
parent be6351573f
commit 07d5bef125
32 changed files with 826 additions and 145 deletions

View File

@@ -0,0 +1,7 @@
mod workspace_message;
mod workspace_message_handler;
#[doc(inline)]
pub use workspace_message::{WorkspaceMessage, WorkspaceMessageDiscriminant};
#[doc(inline)]
pub use workspace_message_handler::WorkspaceMessageHandler;

View File

@@ -0,0 +1,11 @@
use crate::message_prelude::*;
use serde::{Deserialize, Serialize};
#[remain::sorted]
#[impl_message(Message, Workspace)]
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize)]
pub enum WorkspaceMessage {
// Messages
NodeGraphToggleVisibility,
}

View File

@@ -0,0 +1,29 @@
use crate::input::InputPreprocessorMessageHandler;
use crate::message_prelude::*;
#[derive(Debug, Clone, Default)]
pub struct WorkspaceMessageHandler {
node_graph_visible: bool,
}
impl MessageHandler<WorkspaceMessage, &InputPreprocessorMessageHandler> for WorkspaceMessageHandler {
#[remain::check]
fn process_action(&mut self, message: WorkspaceMessage, _ipp: &InputPreprocessorMessageHandler, responses: &mut VecDeque<Message>) {
use WorkspaceMessage::*;
#[remain::sorted]
match message {
// Messages
NodeGraphToggleVisibility => {
self.node_graph_visible = !self.node_graph_visible;
responses.push_back(FrontendMessage::UpdateNodeGraphVisibility { visible: self.node_graph_visible }.into());
}
}
}
fn actions(&self) -> ActionList {
actions!(WorkspaceMessageDiscriminant;
NodeGraphToggleVisibility,
)
}
}