pub struct CollisionResolver { /* private fields */ }Expand description
Collision resolver for subtitle positioning
Implementations§
Source§impl CollisionResolver
impl CollisionResolver
Sourcepub fn set_collision_margin(&mut self, margin: f32)
pub fn set_collision_margin(&mut self, margin: f32)
Set collision margin
Sourcepub fn add_fixed(&mut self, event: PositionedEvent)
pub fn add_fixed(&mut self, event: PositionedEvent)
Add a positioned event that won’t be moved
Sourcepub fn find_position(&mut self, event: PositionedEvent) -> BoundingBox
pub fn find_position(&mut self, event: PositionedEvent) -> BoundingBox
Resolve collisions by stacking the event away from its alignment margin: bottom-aligned events (1-3) move up, top/middle (4-9) move down, until the event no longer overlaps any already-placed same-layer event. This matches libass “Normal” collisions, where earlier events keep the margin position and later events stack past them. The resolved box is recorded so that subsequent events stack against it.
Sourcepub fn positioned_events(&self) -> &[PositionedEvent]
pub fn positioned_events(&self) -> &[PositionedEvent]
Get all positioned events
Auto Trait Implementations§
impl Freeze for CollisionResolver
impl RefUnwindSafe for CollisionResolver
impl Send for CollisionResolver
impl Sync for CollisionResolver
impl Unpin for CollisionResolver
impl UnsafeUnpin for CollisionResolver
impl UnwindSafe for CollisionResolver
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
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more