Add the style of right-angle grid-aligned wires in the graph (#2182)

* Verticle and horizontal lines achieved(#2170)

* vertical lines alligned with grid dots

* fixed vertical lines positioning

* Deals with cases 5 and 6

* Fixed case 5 and other problematic zones

* edge cases solved

* edge cases fixed: HorizontalOut & HorizontalIn

* added comments

* Changed midX and midY

* Clean up if/else statements

* Consolidate code

* Consolidate further

* Add preference for wire style

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
Nitish Itankar
2025-02-13 07:58:43 +00:00
committed by GitHub
co-authored by Keavon Chambers
parent 2d90bb0cbf
commit 26fa8d967e
11 changed files with 393 additions and 58 deletions
@@ -1,4 +1,5 @@
use crate::messages::input_mapper::key_mapping::MappingVariant;
use crate::messages::portfolio::document::node_graph::utility_types::GraphWireStyle;
use crate::messages::preferences::SelectionMode;
use crate::messages::prelude::*;
@@ -12,6 +13,7 @@ pub struct PreferencesMessageHandler {
pub zoom_with_scroll: bool,
pub use_vello: bool,
pub vector_meshes: bool,
pub graph_wire_style: GraphWireStyle,
}
impl PreferencesMessageHandler {
@@ -37,6 +39,7 @@ impl Default for PreferencesMessageHandler {
imaginate_hostname: host_name,
use_vello,
} = Default::default();
Self {
imaginate_server_hostname: host_name,
imaginate_refresh_frequency: 1.,
@@ -44,6 +47,7 @@ impl Default for PreferencesMessageHandler {
zoom_with_scroll: matches!(MappingVariant::default(), MappingVariant::ZoomWithScroll),
use_vello,
vector_meshes: false,
graph_wire_style: GraphWireStyle::default(),
}
}
}
@@ -95,6 +99,10 @@ impl MessageHandler<PreferencesMessage, ()> for PreferencesMessageHandler {
PreferencesMessage::SelectionMode { selection_mode } => {
self.selection_mode = selection_mode;
}
PreferencesMessage::GraphWireStyle { style } => {
self.graph_wire_style = style;
responses.add(NodeGraphMessage::SendGraph);
}
}
// TODO: Reenable when Imaginate is restored (and move back up one line since the auto-formatter doesn't like it in that block)
// PreferencesMessage::ImaginateRefreshFrequency { seconds } => {