Struct widgetry::DrawWithTooltips [−][src]
pub struct DrawWithTooltips { draw: Drawable, tooltips: Vec<(Polygon, Text, Option<ClickOutcome>)>, hover: Box<dyn Fn(&Polygon) -> GeomBatch>, hovering_on_idx: Option<usize>, top_left: ScreenPt, dims: ScreenDims, }
Fields
draw: Drawable
tooltips: Vec<(Polygon, Text, Option<ClickOutcome>)>
hover: Box<dyn Fn(&Polygon) -> GeomBatch>
hovering_on_idx: Option<usize>
top_left: ScreenPt
dims: ScreenDims
Implementations
impl DrawWithTooltips
[src]
impl DrawWithTooltips
[src]pub fn new_widget(
ctx: &EventCtx<'_>,
batch: GeomBatch,
tooltips: Vec<(Polygon, Text, Option<ClickOutcome>)>,
hover: Box<dyn Fn(&Polygon) -> GeomBatch>
) -> Widget
[src]
ctx: &EventCtx<'_>,
batch: GeomBatch,
tooltips: Vec<(Polygon, Text, Option<ClickOutcome>)>,
hover: Box<dyn Fn(&Polygon) -> GeomBatch>
) -> Widget
batch
: the GeomBatch
to draw
tooltips
: (hitbox, text, clickable action) tuples where each text
is shown when the
user hovers over the respective hitbox
. If an action is present and the user
clicks the hitbox
, then it acts like a button click. It’s assumed the
hitboxes are non-overlapping.
hover
: returns a GeomBatch to render upon hovering. Return an GeomBox::new()
if
you want hovering to be a no-op
Trait Implementations
impl WidgetImpl for DrawWithTooltips
[src]
impl WidgetImpl for DrawWithTooltips
[src]