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
impl Clone for ColorBarElement
Source§impl Debug for ColorBarElement
impl Debug for ColorBarElement
Source§impl Draggable for ColorBarElement
impl Draggable for ColorBarElement
Source§fn nudge_element(&self) -> Element
fn nudge_element(&self) -> Element
Self::drag_by.Source§fn drag_by(&self, cfg: &mut C, dx: f32, dy: f32) -> NudgeResult
fn drag_by(&self, cfg: &mut C, dx: f32, dy: f32) -> NudgeResult
Config::nudge. Returns NudgeResult::Rejected (and leaves cfg
untouched) when the move would leave the chart area. Read moreSource§impl PartialEq for ColorBarElement
impl PartialEq for ColorBarElement
Source§impl Resizable for ColorBarElement
impl Resizable for ColorBarElement
Source§fn resize_targets(
&self,
handle: ResizeHandle,
) -> (Option<Element>, Option<Element>)
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]>
fn resize_handles( &self, cfg: &C, measure: &dyn MeasureText, ) -> Option<[(ResizeHandle, RectF); 8]>
SELECTION_PADDING).Source§fn hit_resize_handle(
&self,
cfg: &C,
measure: &dyn MeasureText,
x: f32,
y: f32,
) -> Option<ResizeHandle>
fn hit_resize_handle( &self, cfg: &C, measure: &dyn MeasureText, x: f32, y: f32, ) -> Option<ResizeHandle>
Source§fn resize_by(
&self,
cfg: &mut C,
handle: ResizeHandle,
dx: f32,
dy: f32,
) -> NudgeResult
fn resize_by( &self, cfg: &mut C, handle: ResizeHandle, dx: f32, dy: f32, ) -> NudgeResult
Config::nudge on its target element, so resize obeys exactly the
same feasibility rules as dragging those elements directly.Source§impl Selectable for ColorBarElement
impl Selectable for ColorBarElement
Source§fn bounds(&self, cfg: &Config, _measure: &dyn MeasureText) -> Option<RectF>
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
fn element_id(&self) -> String
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>
fn as_draggable(&self) -> Option<&dyn Draggable>
Source§fn as_resizable(&self) -> Option<&dyn Resizable>
fn as_resizable(&self) -> Option<&dyn Resizable>
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>
fn selection_box( &self, cfg: &C, measure: &dyn MeasureText, ) -> Option<SelectionBox>
SELECTION_PADDING px outside
the bounds, stroked SELECTION_STROKE_WIDTH px in
SELECTION_COLOR. Resizable elements additionally carry the eight
resize handle squares.