Skip to content

Commit 88da9dd

Browse files
committed
Strip 'editor:click_target' override on Path node so direct edits restore precise hit testing
1 parent 1ea9e5f commit 88da9dd

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

node-graph/libraries/core-types/src/table.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,13 @@ impl AttributeColumns {
489489
self.columns.iter().find_map(|(k, column)| if k == key { column.get_any(index)?.downcast_ref::<T>() } else { None })
490490
}
491491

492+
/// Removes the entire column for the given key, if present.
493+
fn remove_column(&mut self, key: &str) {
494+
if let Some(position) = self.columns.iter().position(|(k, _)| k == key) {
495+
self.columns.remove(position);
496+
}
497+
}
498+
492499
/// Finds or creates a column for the given key and type, returning its position.
493500
/// If a column with the key exists but has the wrong type, it is removed and replaced with a new column of the correct type, padded with defaults.
494501
/// A newly created column is filled with `T::default()` for all existing rows.
@@ -753,6 +760,11 @@ impl<T> Table<T> {
753760
self.attributes.set_value(key, index, value);
754761
}
755762

763+
/// Removes the entire attribute column for the given key, if present.
764+
pub fn remove_attribute(&mut self, key: &str) {
765+
self.attributes.remove_column(key);
766+
}
767+
756768
/// Runs the given closure on a mutable reference to the attribute value at the given row index,
757769
/// creating the column with defaults if it doesn't exist, and returns the closure's result.
758770
pub fn with_attribute_mut_or_default<U: Clone + Send + Sync + Default + Debug + PartialEq + CacheHash + 'static, R, F: FnOnce(&mut U) -> R>(&mut self, key: &str, index: usize, f: F) -> R {

node-graph/nodes/vector/src/vector_modification_nodes.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use core_types::table::Table;
22
use core_types::uuid::NodeId;
3-
use core_types::{ATTR_EDITOR_LAYER_PATH, ATTR_TRANSFORM, Ctx};
3+
use core_types::{ATTR_EDITOR_CLICK_TARGET, ATTR_EDITOR_LAYER_PATH, ATTR_TRANSFORM, Ctx};
44
use glam::DAffine2;
55
use graphic_types::Vector;
66
use vector_types::vector::VectorModification;
@@ -15,6 +15,9 @@ async fn path_modify(_ctx: impl Ctx, mut vector: Table<Vector>, modification: Bo
1515
}
1616
modification.apply(vector.element_mut(0).expect("push should give one item"));
1717

18+
// Drop stale click-target override so hit testing uses the geometry the user is now editing
19+
vector.remove_attribute(ATTR_EDITOR_CLICK_TARGET);
20+
1821
// Set the path to the encapsulating subgraph (drop our own trailing entry from `node_path`),
1922
// matching the `path_of_subgraph` proto so editor tools can route data back to the parent layer.
2023
let subgraph_path: Table<NodeId> = {

0 commit comments

Comments
 (0)