pub struct ScreenPolylineVisual { /* private fields */ }Expand description
One open line strip in top-left/downward logical screen pixels.
One component represents the whole path, with continuous joins/dashes and only two endpoint caps. Two points provide a styled line. Engine owns stroke validation, clipping and tessellation. Repeating the first point at the end is rejected: Engine 0.4.2 has no closed styled-path contract.
Clones share immutable points and style; setters validate before replacing state. World cameras and fixed interpolation do not transform these coordinates. CPU creation requires no window or GPU.
Implementations§
Source§impl ScreenPolylineVisual
impl ScreenPolylineVisual
Sourcepub const DEFAULT_MAX_POINTS: usize = 65_536
pub const DEFAULT_MAX_POINTS: usize = 65_536
Default per-path point ceiling; aggregate extraction limits are separate.
Sourcepub fn new(
points: &[LogicalScreenPosition],
style: StrokeStyle2d,
) -> Result<Self, ScreenPolylineError>
pub fn new( points: &[LogicalScreenPosition], style: StrokeStyle2d, ) -> Result<Self, ScreenPolylineError>
Copies a bounded open path with explicit logical stroke style. Invalid geometry/style, world-unit widths and point-buffer reservation failures are errors. Small shared metadata uses Rust’s ordinary allocator.
Sourcepub fn with_point_limit(
points: &[LogicalScreenPosition],
style: StrokeStyle2d,
max_points: usize,
) -> Result<Self, ScreenPolylineError>
pub fn with_point_limit( points: &[LogicalScreenPosition], style: StrokeStyle2d, max_points: usize, ) -> Result<Self, ScreenPolylineError>
Creates a path with an immutable point-count ceiling, at least two. This is not an application quota; set aggregate RenderLimits separately.
Sourcepub fn points(&self) -> &[LogicalScreenPosition]
pub fn points(&self) -> &[LogicalScreenPosition]
Borrows all immutable logical-screen points.
Sourcepub const fn max_points(&self) -> usize
pub const fn max_points(&self) -> usize
Returns the fixed per-path point-count ceiling.
Sourcepub fn style(&self) -> StrokeStyle2d
pub fn style(&self) -> StrokeStyle2d
Returns logical width/color, caps, joins, dashes and markers.
Sourcepub fn point_allocation_bytes(&self) -> usize
pub fn point_allocation_bytes(&self) -> usize
Returns point Vec capacity bytes, excluding shared-Arc metadata. Clones report shared storage; do not sum them as independent allocations.
Sourcepub fn set_points(
&mut self,
points: &[LogicalScreenPosition],
) -> Result<(), ScreenPolylineError>
pub fn set_points( &mut self, points: &[LogicalScreenPosition], ) -> Result<(), ScreenPolylineError>
Atomically copies new points. Equal points skip validation and copying.
Sourcepub fn set_style(
&mut self,
style: StrokeStyle2d,
) -> Result<(), ScreenPolylineError>
pub fn set_style( &mut self, style: StrokeStyle2d, ) -> Result<(), ScreenPolylineError>
Atomically changes style, preserving shared point storage.
Sourcepub const fn draw_order_depth(&self) -> f32
pub const fn draw_order_depth(&self) -> f32
Returns within-layer ordering depth, not camera depth.
Sourcepub fn set_draw_order_depth(
&mut self,
depth: f32,
) -> Result<(), ScreenVisualError>
pub fn set_draw_order_depth( &mut self, depth: f32, ) -> Result<(), ScreenVisualError>
Sets finite ordering depth; rejection leaves the old value intact.
Sourcepub const fn clip(&self) -> ScreenClip
pub const fn clip(&self) -> ScreenClip
Returns the fixed logical-screen clip.
Sourcepub fn set_clip(&mut self, clip: ScreenClip)
pub fn set_clip(&mut self, clip: ScreenClip)
Sets clipping without copying or moving points.
Sourcepub fn hit_test_centerline(
&self,
sample: PointerSample,
radius: f32,
) -> Result<bool, ScreenPolylineError>
pub fn hit_test_centerline( &self, sample: PointerSample, radius: f32, ) -> Result<bool, ScreenPolylineError>
Picks the clipped centerline within a finite nonnegative logical radius.
This is editor selection, not painted-pixel coverage: it includes dash gaps and endpoint disks, ignoring caps, joins, markers, alpha and stroke width. Supply the selection radius explicitly. Work is linear in the bounded point count, without allocations or GPU access.
Trait Implementations§
Source§impl Clone for ScreenPolylineVisual
impl Clone for ScreenPolylineVisual
Source§impl Component for ScreenPolylineVisual
impl Component for ScreenPolylineVisual
Source§const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::Table
const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::Table
Source§type Mutability = Mutable
type Mutability = Mutable
Component<Mutability = Mutable>,
while immutable components will instead have Component<Mutability = Immutable>. Read moreSource§fn register_required_components(
_requiree: ComponentId,
required_components: &mut RequiredComponentsRegistrator<'_, '_>,
)
fn register_required_components( _requiree: ComponentId, required_components: &mut RequiredComponentsRegistrator<'_, '_>, )
Source§fn clone_behavior() -> ComponentCloneBehavior
fn clone_behavior() -> ComponentCloneBehavior
Source§fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>
fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>
ComponentRelationshipAccessor required for working with relationships in dynamic contexts. Read moreSource§fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
EntityMapper. This is used to remap entities in contexts like scenes and entity cloning.
When deriving Component, this is populated by annotating fields containing entities with #[entities] Read moreSource§impl Debug for ScreenPolylineVisual
impl Debug for ScreenPolylineVisual
Source§impl PartialEq for ScreenPolylineVisual
impl PartialEq for ScreenPolylineVisual
impl StructuralPartialEq for ScreenPolylineVisual
Auto Trait Implementations§
impl Freeze for ScreenPolylineVisual
impl RefUnwindSafe for ScreenPolylineVisual
impl Send for ScreenPolylineVisual
impl Sync for ScreenPolylineVisual
impl Unpin for ScreenPolylineVisual
impl UnsafeUnpin for ScreenPolylineVisual
impl UnwindSafe for ScreenPolylineVisual
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut ComponentsRegistrator<'_>, ) -> impl Iterator<Item = ComponentId> + use<C>
Source§fn get_component_ids(
components: &Components,
) -> impl Iterator<Item = Option<ComponentId>>
fn get_component_ids( components: &Components, ) -> impl Iterator<Item = Option<ComponentId>>
Source§impl<C> BundleFromComponents for Cwhere
C: Component,
impl<C> BundleFromComponents for Cwhere
C: Component,
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ConditionalSend for Twhere
T: Send,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.