Skip to main content

SelectionStyle

Struct SelectionStyle 

Source
pub struct SelectionStyle {
    pub kind: SelectionKind,
    pub highlight: Color,
    pub handle: Color,
    pub zoom: f32,
}
Expand description

Theme-extension value carrying the selection look — see the module doc.

Fields§

§kind: SelectionKind§highlight: Color

Tint painted behind the selected glyphs.

§handle: Color

Handle grip/bar color.

§zoom: f32

Glass only: lens magnification (1.0 = no zoom).

Implementations§

Source§

impl SelectionStyle

Source

pub fn flat() -> Self

The Material/default look — exactly the colors the widgets used before selection became themeable.

Source

pub fn glass() -> Self

The Liquid-Glass look: cooler, softer tint; near-white glass handles; a magnifier lens over the selected run. Zoom is a subtle 1.15x “lift” — a stronger lens crops the ends of the selection out of the pill (physically correct, but wrong as selection UX; found live at 1.35x).

Source

pub fn lens_uniforms(radius: f32, zoom: f32) -> Vec<u8>

Pack the lens uniforms (radius, zoom + two pad scalars) in the WGSL layout builtin::SELECTION_LENS declares — four tightly packed f32s, one 16-byte uniform row.

Source

pub fn glass_lens(&self, x0: f32, x1: f32, y_top: f32, line_h: f32) -> GlassLens

The glass lens geometry for a single-line selection spanning x0..x1 on a line at y_top with height line_h — the pill rect, the end-bar x positions, and the grip anchor y. Used by BOTH TextInput’s painting AND the engine’s handle-drag grab, so the visible grips and the draggable anchors can never drift apart (found live: grips pinned at the unzoomed endpoints floated far inside the pill on wide selections, disconnected from the bars).

Trait Implementations§

Source§

impl Clone for SelectionStyle

Source§

fn clone(&self) -> SelectionStyle

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SelectionStyle

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SelectionStyle

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for SelectionStyle

Source§

fn eq(&self, other: &SelectionStyle) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SelectionStyle

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.