Repository navigation
Replace the Svelte node graph view with a Graphene-rendered graph UI - #4992
timon-schelling wants to merge 1 commit into
Conversation
|
!build (Run ID 44932059322) |
There was a problem hiding this comment.
6 issues found across 69 files
Confidence score: 3/5
- In
types.rs, peer-applied name changes skip the width-cache invalidation used for local renames, so layer sizing can stay stale after a remote rename. Invalidate the cache for peer updates too. - In
nodes.rs, rows with both a secondary input and output hide the output label. Draw each connector’s label on its respective side. - In
layer.rs, the name box overlaps the visibility button, grip, and locked-layer button. Reserve space for the right-side controls. - The PR title is missing the required
Graphene:prefix. Rename it toGraphene: Implement base graph UI.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="editor/src/messages/portfolio/document/utility_types/network_interface/types.rs">
<violation number="1" location="editor/src/messages/portfolio/document/utility_types/network_interface/types.rs:1171">
P2: The layer width cache now includes the name's text width, but name changes applied from a peer skip the invalidation that local renames do. `apply` mirrors `DisplayName` through `NodeMut::set_display_name` without calling `invalidate_node_appearance`, so a layer renamed remotely can keep its old width. Invalidate the node's appearance in the `NodeMetadataChange::DisplayName` arm of `apply.rs`, or confirm that reconcile unloads it.</violation>
</file>
<file name="node-graph/graph-ui/src/dashes.rs">
<violation number="1" location="node-graph/graph-ui/src/dashes.rs:132">
P2: `corner_length` is measured with `radius`, but the corner arcs are drawn with `arc_radius` (`radius - inset`). Use `arc_radius` so the dash distances match the stroked centerline.</violation>
</file>
<file name="editor/src/node_graph_executor/runtime.rs">
<violation number="1" location="editor/src/node_graph_executor/runtime.rs:656">
P3: The three `expect` calls in `stand_in_executor` will panic the runtime thread if the stand-in network fails to preprocess, compile, or type-check. Consider a graceful fallback, or document why these cannot fail.</violation>
</file>
<file name="node-graph/graph-ui/src/layer.rs">
<violation number="1" location="node-graph/graph-ui/src/layer.rs:100">
P2: `name_width` does not reserve space for the right-side buttons. The name box ends at x=232, which overlaps the visibility button (228..252), the grip (220..228), and the lock button when the layer is locked. Subtract the width of the buttons from the name width, or document that the overlap is intended.</violation>
</file>
<file name="node-graph/graph-ui/src/nodes.rs">
<violation number="1" location="node-graph/graph-ui/src/nodes.rs:438">
P2: Rows with both a secondary input and output render only the input label, hiding the output name (for example, `Area` beside `Width`). Draw each present connector’s label on its respective side of the row.</violation>
</file>
<file name="node-graph/graph-ui/Cargo.toml">
<violation number="1" location="node-graph/graph-ui/Cargo.toml:3">
P2: Custom agent: **PR title enforcement**
Prefix this Graphene node-graph UI change with `Graphene:`; the title should read `Graphene: Implement base graph UI`.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| @@ -0,0 +1,42 @@ | |||
| [package] | |||
| name = "graph-ui" | |||
| description = "The node graph UI of Graphite, drawn by Graphene" | |||
There was a problem hiding this comment.
P2: Custom agent: PR title enforcement
Prefix this Graphene node-graph UI change with Graphene:; the title should read Graphene: Implement base graph UI.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At node-graph/graph-ui/Cargo.toml, line 3:
<comment>Prefix this Graphene node-graph UI change with `Graphene:`; the title should read `Graphene: Implement base graph UI`.</comment>
<file context>
@@ -0,0 +1,42 @@
+[package]
+name = "graph-ui"
+description = "The node graph UI of Graphite, drawn by Graphene"
+version.workspace = true
+license.workspace = true
</file context>
| /// Width in grid units from the left edge of the layer's thumbnail to its left end, cached since text measurement is slow. Only loaded for layers. | ||
| pub(crate) layer_width: TransientCache<u32>, | ||
| /// Width in grid units from the left edge of the layer's thumbnail to its left end, and the measured width of its name, cached since text measurement is slow. Only loaded for layers. | ||
| pub(crate) layer_width: TransientCache<(u32, f64)>, |
There was a problem hiding this comment.
P2: The layer width cache now includes the name's text width, but name changes applied from a peer skip the invalidation that local renames do. apply mirrors DisplayName through NodeMut::set_display_name without calling invalidate_node_appearance, so a layer renamed remotely can keep its old width. Invalidate the node's appearance in the NodeMetadataChange::DisplayName arm of apply.rs, or confirm that reconcile unloads it.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At editor/src/messages/portfolio/document/utility_types/network_interface/types.rs, line 1171:
<comment>The layer width cache now includes the name's text width, but name changes applied from a peer skip the invalidation that local renames do. `apply` mirrors `DisplayName` through `NodeMut::set_display_name` without calling `invalidate_node_appearance`, so a layer renamed remotely can keep its old width. Invalidate the node's appearance in the `NodeMetadataChange::DisplayName` arm of `apply.rs`, or confirm that reconcile unloads it.</comment>
<file context>
@@ -1169,8 +1167,8 @@ pub struct DocumentNodeTransientMetadata {
- /// Width in grid units from the left edge of the layer's thumbnail to its left end, cached since text measurement is slow. Only loaded for layers.
- pub(crate) layer_width: TransientCache<u32>,
+ /// Width in grid units from the left edge of the layer's thumbnail to its left end, and the measured width of its name, cached since text measurement is slow. Only loaded for layers.
+ pub(crate) layer_width: TransientCache<(u32, f64)>,
}
</file context>
| pub(crate) fn border(min: DVec2, max: DVec2, radius: f64, gaps: &[[DVec2; 2]], dashed: bool) -> BezPath { | ||
| let inset = BORDER_WIDTH / 2.; | ||
| let arc_radius = radius - inset; | ||
| let corner_length = flattened_arc_length(radius, [0., FRAC_PI_2]); |
There was a problem hiding this comment.
P2: corner_length is measured with radius, but the corner arcs are drawn with arc_radius (radius - inset). Use arc_radius so the dash distances match the stroked centerline.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At node-graph/graph-ui/src/dashes.rs, line 132:
<comment>`corner_length` is measured with `radius`, but the corner arcs are drawn with `arc_radius` (`radius - inset`). Use `arc_radius` so the dash distances match the stroked centerline.</comment>
<file context>
@@ -0,0 +1,349 @@
+pub(crate) fn border(min: DVec2, max: DVec2, radius: f64, gaps: &[[DVec2; 2]], dashed: bool) -> BezPath {
+ let inset = BORDER_WIDTH / 2.;
+ let arc_radius = radius - inset;
+ let corner_length = flattened_arc_length(radius, [0., FRAC_PI_2]);
+ let [left, top] = (min + inset).to_array();
+ let [right, bottom] = (max - inset).to_array();
</file context>
| let corner_length = flattened_arc_length(radius, [0., FRAC_PI_2]); | |
| let corner_length = flattened_arc_length(arc_radius, [0., FRAC_PI_2]); |
| } | ||
|
|
||
| pub fn name_width(&self) -> f64 { | ||
| self.width as f64 * GRID_SIZE - LAYER_NAME_LEFT - LAYER_DETAILS_MARGIN |
There was a problem hiding this comment.
P2: name_width does not reserve space for the right-side buttons. The name box ends at x=232, which overlaps the visibility button (228..252), the grip (220..228), and the lock button when the layer is locked. Subtract the width of the buttons from the name width, or document that the overlap is intended.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At node-graph/graph-ui/src/layer.rs, line 100:
<comment>`name_width` does not reserve space for the right-side buttons. The name box ends at x=232, which overlaps the visibility button (228..252), the grip (220..228), and the lock button when the layer is locked. Subtract the width of the buttons from the name width, or document that the overlap is intended.</comment>
<file context>
@@ -0,0 +1,174 @@
+ }
+
+ pub fn name_width(&self) -> f64 {
+ self.width as f64 * GRID_SIZE - LAYER_NAME_LEFT - LAYER_DETAILS_MARGIN
+ }
+
</file context>
|
|
||
| for row in 1..card.rows() { | ||
| let (input, output) = (card.secondary_inputs.get(row - 1), card.secondary_outputs.get(row - 1)); | ||
| let Some(connector) = input.or(output) else { continue }; |
There was a problem hiding this comment.
P2: Rows with both a secondary input and output render only the input label, hiding the output name (for example, Area beside Width). Draw each present connector’s label on its respective side of the row.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At node-graph/graph-ui/src/nodes.rs, line 438:
<comment>Rows with both a secondary input and output render only the input label, hiding the output name (for example, `Area` beside `Width`). Draw each present connector’s label on its respective side of the row.</comment>
<file context>
@@ -0,0 +1,826 @@
+
+ for row in 1..card.rows() {
+ let (input, output) = (card.secondary_inputs.get(row - 1), card.secondary_outputs.get(row - 1));
+ let Some(connector) = input.or(output) else { continue };
+ let name = labels.label(&connector.name, NODE_WIDTH - 2. * NODE_ROW_PADDING)?;
+ let left = if input.is_some() { NODE_ROW_PADDING } else { NODE_WIDTH - NODE_ROW_PADDING - name.width };
</file context>
| ..Default::default() | ||
| }; | ||
| graph_ui::render::wrap_network(&mut network); | ||
| preprocessor.preprocess(&mut network, &|_| None).expect("The stand-in network preprocesses"); |
There was a problem hiding this comment.
P3: The three expect calls in stand_in_executor will panic the runtime thread if the stand-in network fails to preprocess, compile, or type-check. Consider a graceful fallback, or document why these cannot fail.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At editor/src/node_graph_executor/runtime.rs, line 656:
<comment>The three `expect` calls in `stand_in_executor` will panic the runtime thread if the stand-in network fails to preprocess, compile, or type-check. Consider a graceful fallback, or document why these cannot fail.</comment>
<file context>
@@ -505,10 +610,52 @@ impl NodeRuntime {
+ ..Default::default()
+ };
+ graph_ui::render::wrap_network(&mut network);
+ preprocessor.preprocess(&mut network, &|_| None).expect("The stand-in network preprocesses");
+ let compiled = Compiler {}.compile_single(network).expect("The stand-in network compiles");
+ DynamicExecutor::new(compiled.network).expect("The stand-in network is typed")
</file context>
Wasm: 48.63 MB — JS: 0.72 MB — CSS: 0.12 MB — Fonts: 0.69 MB — Images: 0.09 MB — All Assets: 50.25 MB |
3f5acd8 to
1d89bab
Compare
1d89bab to
8552cbe
Compare
8552cbe to
2c85279
Compare
Keavon
left a comment
There was a problem hiding this comment.
The only regression I found is the loss of hover animations on node/layer/redirect dot/import/export connectors. Good to merge once fixed (or in a followup).
No description provided.