Skip to main content

ColorBarElement

Struct ColorBarElement 

Source
pub struct ColorBarElement;
Expand description

The colourbar strip.

Carries no side of its own: the bar’s side lives in Config.colorbar, and a copy here would be a mirror that can disagree with what is drawn. That is also why the resize handles map to screen-side edges (Element::ColorBarEdge) and let nudge resolve which dimension each one drives.

Trait Implementations§

Source§

impl Clone for ColorBarElement

Source§

fn clone(&self) -> Self

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 ColorBarElement

Source§

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

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

impl Draggable for ColorBarElement

Source§

fn nudge_element(&self) -> Element

The nudge-path element this drag target moves. This mapping is the only thing an implementation defines; movement itself happens in Self::drag_by.
Source§

fn drag_by(&self, cfg: &mut C, dx: f32, dy: f32) -> NudgeResult

Default drag pipeline: apply the pointer delta through Config::nudge. Returns NudgeResult::Rejected (and leaves cfg untouched) when the move would leave the chart area. Read more
Source§

impl PartialEq for ColorBarElement

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl Resizable for ColorBarElement

Source§

fn resize_targets( &self, handle: ResizeHandle, ) -> (Option<Element>, Option<Element>)

Each handle drives the strip edges it touches — the same compass mapping the data area uses. Which of thickness_px / length_frac an edge changes depends on the bar’s orientation, and that resolution belongs to nudge: a handle only knows screen directions.

Source§

fn resize_handles( &self, cfg: &C, measure: &dyn MeasureText, ) -> Option<[(ResizeHandle, RectF); 8]>

Default handle geometry: eight squares on the selection box (element bounds + SELECTION_PADDING).
Source§

fn hit_resize_handle( &self, cfg: &C, measure: &dyn MeasureText, x: f32, y: f32, ) -> Option<ResizeHandle>

Default handle hit test.
Source§

fn resize_by( &self, cfg: &mut C, handle: ResizeHandle, dx: f32, dy: f32, ) -> NudgeResult

Default resize pipeline: each motion component routes through Config::nudge on its target element, so resize obeys exactly the same feasibility rules as dragging those elements directly.
Source§

impl Selectable for ColorBarElement

Source§

fn bounds(&self, cfg: &Config, _measure: &dyn MeasureText) -> Option<RectF>

The strip rect — the same one the renderer paints, offsets included, so the highlight box and the eight handles sit on the bar the user sees. Ticks and labels are outside it, as they are for an axis.

Source§

fn element_id(&self) -> String

Stable element name for hosts that key on identity rather than HitId (e.g. a wasm host exposing hit-testing as strings): "data_area", "axis_bottom", "tick_labels_left", "axis_title_left", "legend", "chart_title", "colorbar_axis", "colorbar_tick_labels", "colorbar_title". Custom host elements keep the default.
Source§

fn as_draggable(&self) -> Option<&dyn Draggable>

This element’s drag capability, if any. Elements that also implement Draggable override this with Some(self). Lets hosts go from a HitMap hit straight to dragging without knowing concrete types.
Source§

fn as_resizable(&self) -> Option<&dyn Resizable>

This element’s resize capability, if any. Elements that also implement Resizable override this with Some(self) — their selection box then grows the eight resize handles automatically.
Source§

fn selection_box( &self, cfg: &C, measure: &dyn MeasureText, ) -> Option<SelectionBox>

Default selection policy: a blue box SELECTION_PADDING px outside the bounds, stroked SELECTION_STROKE_WIDTH px in SELECTION_COLOR. Resizable elements additionally carry the eight resize handle squares.
Source§

fn contains(&self, cfg: &C, measure: &dyn MeasureText, x: f32, y: f32) -> bool

Default hit test: point-in-bounds.
Source§

fn register_into(self, map: &mut HitMap<C>) -> HitId
where Self: Sized + Send + Sync + 'static,

Default registration: every Selectable can enter a HitMap the same way. Returns the id the map will report from hit_test. (Send + Sync because hosts store hit maps in cross-thread render state, e.g. egui’s CallbackResources.)
Source§

impl StructuralPartialEq for ColorBarElement

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.