pub struct DecorationLayout {
pub data_area: Option<RectF>,
pub offsets: Vec<DecorationOffset>,
pub selected: Option<DecorationId>,
}Fields§
§data_area: Option<RectF>Explicit plot region in logical pixels. None uses the measured automatic region; a chosen region must fit inside it to retain space for labels.
offsets: Vec<DecorationOffset>§selected: Option<DecorationId>Decoration selection is separate from data selection and hover.
Implementations§
Source§impl DecorationLayout
impl DecorationLayout
pub fn offset(&self, id: &DecorationId) -> [f32; 2]
Sourcepub fn effective_offset(&self, id: &DecorationId) -> [f32; 2]
pub fn effective_offset(&self, id: &DecorationId) -> [f32; 2]
Axis labels follow detached axes, plus their own freely editable offset.
pub fn reset(&mut self, id: &DecorationId)
pub fn resolve_data_area(&self, automatic: RectF) -> Result<RectF, &'static str>
pub fn validate(&self) -> Result<(), &'static str>
Trait Implementations§
Source§impl Clone for DecorationLayout
impl Clone for DecorationLayout
Source§impl Debug for DecorationLayout
impl Debug for DecorationLayout
Source§impl Default for DecorationLayout
impl Default for DecorationLayout
Source§impl<'de> Deserialize<'de> for DecorationLayoutwhere
DecorationLayout: Default,
impl<'de> Deserialize<'de> for DecorationLayoutwhere
DecorationLayout: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl DragConfig for DecorationLayout
impl DragConfig for DecorationLayout
type Element = DecorationElement
fn nudge(&mut self, element: DecorationElement, dx: f32, dy: f32) -> NudgeResult
Source§impl Draggable<DecorationLayout> for DecorationElement
impl Draggable<DecorationLayout> for DecorationElement
Source§fn nudge_element(&self) -> DecorationElement
fn nudge_element(&self) -> DecorationElement
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
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 moreSource§impl PartialEq for DecorationLayout
impl PartialEq for DecorationLayout
Source§impl Resizable<DecorationLayout> for DecorationElement
impl Resizable<DecorationLayout> for DecorationElement
Source§fn resize_targets(&self, handle: ResizeHandle) -> (Option<Self>, Option<Self>)
fn resize_targets(&self, handle: ResizeHandle) -> (Option<Self>, Option<Self>)
The nudge elements a handle’s (horizontal, vertical) motion drives —
the only thing an implementation defines.
None components are
discarded (an edge-midpoint handle resizes along one dimension).Source§fn resize_by(
&self,
cfg: &mut DecorationLayout,
handle: ResizeHandle,
dx: f32,
dy: f32,
) -> NudgeResult
fn resize_by( &self, cfg: &mut DecorationLayout, 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§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]>
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>
fn hit_resize_handle( &self, cfg: &C, measure: &dyn MeasureText, x: f32, y: f32, ) -> Option<ResizeHandle>
Default handle hit test.
Source§impl Selectable<DecorationLayout> for DecorationElement
impl Selectable<DecorationLayout> for DecorationElement
Source§fn bounds(&self, cfg: &DecorationLayout, _: &dyn MeasureText) -> Option<RectF>
fn bounds(&self, cfg: &DecorationLayout, _: &dyn MeasureText) -> Option<RectF>
Interaction bounds of this element under
cfg, or None when the
element is hidden, empty, or the layout is infeasible. Text-bearing
elements use measure; tick-label elements remain representative
strips rather than exact rendered-label unions.Source§fn as_draggable(&self) -> Option<&dyn Draggable<DecorationLayout>>
fn as_draggable(&self) -> Option<&dyn Draggable<DecorationLayout>>
Source§fn as_resizable(&self) -> Option<&dyn Resizable<DecorationLayout>>
fn as_resizable(&self) -> Option<&dyn Resizable<DecorationLayout>>
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 element_id(&self) -> String
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 selection_box(
&self,
cfg: &C,
measure: &dyn MeasureText,
) -> Option<SelectionBox>
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
fn contains(&self, cfg: &C, measure: &dyn MeasureText, x: f32, y: f32) -> bool
Default hit test: point-in-bounds.
Source§impl Serialize for DecorationLayout
impl Serialize for DecorationLayout
impl StructuralPartialEq for DecorationLayout
Auto Trait Implementations§
impl Freeze for DecorationLayout
impl RefUnwindSafe for DecorationLayout
impl Send for DecorationLayout
impl Sync for DecorationLayout
impl Unpin for DecorationLayout
impl UnsafeUnpin for DecorationLayout
impl UnwindSafe for DecorationLayout
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