pub struct Field { /* private fields */ }Expand description
The infinite 2D space containing all Nodes.
Implementations§
Source§impl Field
impl Field
pub fn new() -> Self
pub fn nodes(&self) -> &HashMap<NodeId, Node>
pub fn node(&self, id: NodeId) -> Option<&Node>
pub fn node_mut(&mut self, id: NodeId) -> Option<&mut Node>
Sourcepub fn spawn_surface(
&mut self,
label: impl Into<String>,
pos: Vec2,
size: Vec2,
) -> NodeId
pub fn spawn_surface( &mut self, label: impl Into<String>, pos: Vec2, size: Vec2, ) -> NodeId
Spawn a basic Surface node.
pub fn spawn_surface_in_active_cluster( &mut self, id: ClusterId, label: impl Into<String>, size: Vec2, ) -> Result<NodeId, ClusterWorkspaceSpawnError>
pub fn spawn_surface_in_active_cluster_front( &mut self, id: ClusterId, label: impl Into<String>, size: Vec2, ) -> Result<NodeId, ClusterWorkspaceSpawnError>
pub fn remove_node_cluster_safe( &mut self, id: NodeId, ) -> Option<(Node, Option<RemoveNodeClusterEffect>)>
pub fn is_cluster_member(&self, id: NodeId) -> bool
pub fn is_active_cluster_member(&self, id: NodeId) -> bool
pub fn participates_in_field_dynamics(&self, id: NodeId) -> bool
pub fn participates_in_field_activity(&self, id: NodeId) -> bool
pub fn participates_in_field_view(&self, id: NodeId) -> bool
pub fn node_ids_all(&self) -> Vec<NodeId>
Sourcepub fn set_pinned(&mut self, id: NodeId, on: bool) -> bool
pub fn set_pinned(&mut self, id: NodeId, on: bool) -> bool
Set/unset movement pinning.
Sourcepub fn anchor(&mut self, id: NodeId, on: bool) -> bool
pub fn anchor(&mut self, id: NodeId, on: bool) -> bool
Back-compat alias: previously anchor() meant “pinned in place”.
Prefer set_pinned(). (We keep this to avoid churn in other modules.)
Sourcepub fn set_anchor(&mut self, id: NodeId, on: bool) -> bool
pub fn set_anchor(&mut self, id: NodeId, on: bool) -> bool
Set/unset routing anchor marker.
pub fn is_anchor(&self, id: NodeId) -> bool
Sourcepub fn carry(&mut self, id: NodeId, to: Vec2) -> bool
pub fn carry(&mut self, id: NodeId, to: Vec2) -> bool
Carry a node to a new position (respects pinning).
Sourcepub fn in_view(&self, view: Rect) -> Vec<NodeId>
pub fn in_view(&self, view: Rect) -> Vec<NodeId>
Return nodes that intersect the view rect AND are experience-visible.
Sourcepub fn in_view_all(&self, view: Rect) -> Vec<NodeId>
pub fn in_view_all(&self, view: Rect) -> Vec<NodeId>
Return all nodes that intersect the view rect (includes hidden nodes).
Sourcepub fn is_visible(&self, id: NodeId) -> bool
pub fn is_visible(&self, id: NodeId) -> bool
True iff the node exists and is not hidden by any visibility reason.
Explicit hide/show (does not touch cluster-hidden).
Sourcepub fn set_detached(&mut self, id: NodeId, on: bool) -> bool
pub fn set_detached(&mut self, id: NodeId, on: bool) -> bool
Detach/attach.
Sourcepub fn set_decay_level(&mut self, id: NodeId, level: DecayLevel) -> bool
pub fn set_decay_level(&mut self, id: NodeId, level: DecayLevel) -> bool
Apply a decay level to a node by mapping it to representation state.
pub fn set_state(&mut self, id: NodeId, state: NodeState) -> bool
pub fn set_resize_footprint(&mut self, id: NodeId, size: Option<Vec2>) -> bool
pub fn sync_active_footprint_to_intrinsic(&mut self, id: NodeId) -> bool
Sourcepub fn visuals_visible(&self) -> Vec<NodeVisual>
pub fn visuals_visible(&self) -> Vec<NodeVisual>
Canonical visuals feed: for full behavior, use build_visuals() directly.
These helpers delegate to the same implementation to avoid drift.
pub fn visuals_in_view(&self, view: Rect) -> Vec<NodeVisual>
pub fn cluster(&self, id: ClusterId) -> Option<&Cluster>
pub fn cluster_ids(&self) -> Vec<ClusterId>
pub fn cluster_mut(&mut self, id: ClusterId) -> Option<&mut Cluster>
pub fn move_member_into_active_cluster_workspace( &mut self, id: ClusterId, member: NodeId, ) -> bool
pub fn move_member_out_of_active_cluster_workspace( &mut self, id: ClusterId, member: NodeId, ) -> bool
Sourcepub fn remove_cluster(&mut self, id: ClusterId) -> Option<Cluster>
pub fn remove_cluster(&mut self, id: ClusterId) -> Option<Cluster>
Remove a cluster record (needed for cross-space transfer).
Sourcepub fn insert_cluster(&mut self, cluster: Cluster)
pub fn insert_cluster(&mut self, cluster: Cluster)
Insert an existing cluster record (needed for cross-space transfer).
pub fn create_cluster( &mut self, members: Vec<NodeId>, ) -> Result<ClusterId, ClusterCreateError>
pub fn cluster_id_for_core_public(&self, core: NodeId) -> Option<ClusterId>
pub fn cluster_id_for_member_public(&self, member: NodeId) -> Option<ClusterId>
pub fn add_member_to_cluster( &mut self, id: ClusterId, member: NodeId, ) -> Result<(), ClusterAddMemberError>
pub fn add_member_to_cluster_front( &mut self, id: ClusterId, member: NodeId, ) -> Result<(), ClusterAddMemberError>
pub fn remove_member_from_cluster( &mut self, id: ClusterId, member: NodeId, ) -> Option<ClusterRemoveMemberOutcome>
pub fn reorder_cluster_members( &mut self, id: ClusterId, ordered_members: Vec<NodeId>, ) -> Result<(), ClusterReorderError>
pub fn promote_cluster_member_to_master( &mut self, id: ClusterId, member: NodeId, ) -> Result<(), ClusterReorderError>
pub fn swap_cluster_overflow_member_with_visible( &mut self, id: ClusterId, overflow_member: NodeId, visible_member: NodeId, max_stack: usize, ) -> bool
pub fn reorder_cluster_overflow_member( &mut self, id: ClusterId, member: NodeId, target_overflow_index: usize, max_stack: usize, ) -> bool
pub fn cycle_cluster_stacking_members( &mut self, id: ClusterId, direction: ClusterCycleDirection, ) -> Option<NodeId>
pub fn dissolve_cluster(&mut self, id: ClusterId) -> bool
pub fn activate_cluster_workspace(&mut self, id: ClusterId) -> bool
pub fn deactivate_cluster_workspace(&mut self, id: ClusterId) -> bool
Sourcepub fn carry_cluster_by_core(&mut self, core: NodeId, to: Vec2) -> bool
pub fn carry_cluster_by_core(&mut self, core: NodeId, to: Vec2) -> bool
Drag the cluster by its core handle.
Sourcepub fn collapse_cluster(&mut self, id: ClusterId) -> Option<NodeId>
pub fn collapse_cluster(&mut self, id: ClusterId) -> Option<NodeId>
Collapse the cluster into a Core node.
Sourcepub fn expand_cluster(&mut self, id: ClusterId) -> bool
pub fn expand_cluster(&mut self, id: ClusterId) -> bool
Expand the cluster.