pub struct Map { /* private fields */ }Expand description
See map.
Implementations§
Source§impl Map
impl Map
Sourcepub fn start(self, center: Point, scale: f32) -> Self
pub fn start(self, center: Point, scale: f32) -> Self
Opens centred on center (from MapBuilder::point) at scale
logical px per metre, instead of fitting the whole map.
Sourcepub fn focus(self, focus: Option<(Point, f32)>) -> Self
pub fn focus(self, focus: Option<(Point, f32)>) -> Self
Centres on center and zooms in to at least scale whenever this
differs from the focus of the last build, e.g. to show a search result.
Sourcepub fn fit(self, bounds: Rect) -> Self
pub fn fit(self, bounds: Rect) -> Self
Fits bounds (in MapBuilder::point units) to the widget, zooming
in or out, whenever they differ from the last build’s, e.g. to show
one region and then the whole map again.
Sourcepub fn overlay(
self,
f: impl Fn(&mut PaintCx<'_>, &dyn Fn(Point) -> Point) + 'static,
) -> Self
pub fn overlay( self, f: impl Fn(&mut PaintCx<'_>, &dyn Fn(Point) -> Point) + 'static, ) -> Self
Paints over the map, given a function from map points to logical px, e.g. to draw markers that keep their size while zooming.
Sourcepub fn on_tap(self, f: impl Fn(&mut EventCx<'_>, Point) + 'static) -> Self
pub fn on_tap(self, f: impl Fn(&mut EventCx<'_>, Point) + 'static) -> Self
Runs on a tap that didn’t pan or pinch, with the map point under it
in MapBuilder::point metres.
Sourcepub fn on_tap_scaled(
self,
f: impl Fn(&mut EventCx<'_>, Point, f32) + 'static,
) -> Self
pub fn on_tap_scaled( self, f: impl Fn(&mut EventCx<'_>, Point, f32) + 'static, ) -> Self
Map::on_tap, also given the scale in logical px per metre, e.g. to
take taps within a few px of a marker.
Trait Implementations§
Source§impl Styled for Map
impl Styled for Map
Source§fn style_mut(&mut self) -> &mut Style
fn style_mut(&mut self) -> &mut Style
Source§fn padding(self, p: f32) -> Self
fn padding(self, p: f32) -> Self
Source§fn padding_xy(self, x: f32, y: f32) -> Self
fn padding_xy(self, x: f32, y: f32) -> Self
x left and right and y top and bottom, logical px.Source§fn padding_top(self, p: f32) -> Self
fn padding_top(self, p: f32) -> Self
padding or
padding_xy set before it, e.g. clearing the status bar.Source§fn padding_right(self, p: f32) -> Self
fn padding_right(self, p: f32) -> Self
padding_top.Source§fn padding_bottom(self, p: f32) -> Self
fn padding_bottom(self, p: f32) -> Self
padding_top.Source§fn padding_left(self, p: f32) -> Self
fn padding_left(self, p: f32) -> Self
padding_top.Source§fn grow(self, g: f32) -> Self
fn grow(self, g: f32) -> Self
fill around a scroll().
With a zero size on that axis, siblings split the space by their
shares alone: height(0.0).grow(1.0) over height(0.0).grow(2.0)
is a third and two thirds.Source§fn shrink(self, s: f32) -> Self
fn shrink(self, s: f32) -> Self
row.Source§fn min_width(self, w: f32) -> Self
fn min_width(self, w: f32) -> Self
min_width(0.0) lets a flex child shrink below its content.Source§fn min_height(self, h: f32) -> Self
fn min_height(self, h: f32) -> Self
min_height(0.0) lets a flex child shrink below its content.Source§fn max_height(self, h: f32) -> Self
fn max_height(self, h: f32) -> Self
scroll() that grows with its content up to a point.Source§fn fill(self) -> Self
fn fill(self) -> Self
grow(1.0), the content’s size doesn’t push the parent. Use it on
every flex box between the window and a scroll(). In a row, siblings
that all fill get equal widths, whatever their content.Source§fn fill_width(self) -> Self
fn fill_width(self) -> Self
Source§fn align(self, a: AlignItems) -> Self
fn align(self, a: AlignItems) -> Self
Source§fn justify(self, j: AlignContent) -> Self
fn justify(self, j: AlignContent) -> Self
Source§impl Widget for Map
impl Widget for Map
fn style(&self) -> Style
fn paint(&self, cx: &mut PaintCx<'_>)
Source§fn event(&self, ev: &Event, cx: &mut EventCx<'_>)
fn event(&self, ev: &Event, cx: &mut EventCx<'_>)
fn children(&self) -> &[Element]
Source§fn expand(&self, _cx: &mut BuildCx<'_>)
fn expand(&self, _cx: &mut BuildCx<'_>)
children with this node’s id, state slot and providers;
lets a widget build its subtree from framework-owned state.Source§fn layer(&self) -> Option<Layer>
fn layer(&self) -> Option<Layer>
Layer’s box,
isn’t clipped by ancestors, paints above and gets input before the
rest of the tree.Source§fn focus(&self) -> Option<Focus>
fn focus(&self) -> Option<Focus>
EventCx::focused.Source§fn provide(&self) -> Option<&(dyn Any + 'static)>
fn provide(&self) -> Option<&(dyn Any + 'static)>
Scope::get.Source§fn measure(
&self,
_known: Size<Option<f32>>,
_available: Size<AvailableSpace>,
_text: &Text,
) -> Size<f32>
fn measure( &self, _known: Size<Option<f32>>, _available: Size<AvailableSpace>, _text: &Text, ) -> Size<f32>
Source§fn measure_key(&self) -> u64
fn measure_key(&self) -> u64
measure reads besides its arguments. Layout is
kept across rebuilds and a leaf is only re-measured when this changes,
so widgets whose size depends on their data must override it.Auto Trait Implementations§
impl !RefUnwindSafe for Map
impl !Send for Map
impl !Sync for Map
impl !UnwindSafe for Map
impl Forget for Map
impl Freeze for Map
impl Move for Map
impl Unpin for Map
impl UnsafeUnpin for Map
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.