#[repr(C)]pub struct MapWidget {
pub layer: MapTileLayer,
pub viewport: MapViewport,
pub container_style: CssPropertyWithConditionsVec,
pub on_viewport_changed: OptionMapViewportChanged,
pub on_pin_tap: OptionMapPinTap,
}Fields§
§layer: MapTileLayer§viewport: MapViewport§container_style: CssPropertyWithConditionsVec§on_viewport_changed: OptionMapViewportChangedOptional hook fired when the user pans / zooms (effects / persist the viewport). FFI-exposed; re-set on each fresh build.
on_pin_tap: OptionMapPinTapOptional hook fired when the user taps the map, with the tapped lat/lon. FFI-exposed; re-set on each fresh build.
Implementations§
Source§impl MapWidget
impl MapWidget
pub fn create(layer: MapTileLayer) -> Self
pub fn with_viewport(self, viewport: MapViewport) -> Self
pub fn with_container_style(self, css: CssPropertyWithConditionsVec) -> Self
Sourcepub fn set_on_viewport_changed<C: Into<MapViewportChangedCallback>>(
&mut self,
data: RefAny,
callback: C,
)
pub fn set_on_viewport_changed<C: Into<MapViewportChangedCallback>>( &mut self, data: RefAny, callback: C, )
Set a hook fired when the user pans / zooms the map. The map owns its
own pan/pinch state; this lets your app observe or persist the
resulting MapViewport. The backreference DI pattern (architecture.md).
Sourcepub fn with_on_viewport_changed<C: Into<MapViewportChangedCallback>>(
self,
data: RefAny,
callback: C,
) -> Self
pub fn with_on_viewport_changed<C: Into<MapViewportChangedCallback>>( self, data: RefAny, callback: C, ) -> Self
Builder form of set_on_viewport_changed.
Sourcepub fn set_on_pin_tap<C: Into<MapPinTapCallback>>(
&mut self,
data: RefAny,
callback: C,
)
pub fn set_on_pin_tap<C: Into<MapPinTapCallback>>( &mut self, data: RefAny, callback: C, )
Set a hook fired when the user taps the map (a press + release at ~the same point, no drag), with the tapped lat/lon. The backreference DI pattern (architecture.md).
Sourcepub fn with_on_pin_tap<C: Into<MapPinTapCallback>>(
self,
data: RefAny,
callback: C,
) -> Self
pub fn with_on_pin_tap<C: Into<MapPinTapCallback>>( self, data: RefAny, callback: C, ) -> Self
Builder form of set_on_pin_tap.
Sourcepub fn latlon_at_px(
viewport: MapViewport,
px: LogicalPosition,
container: LogicalSize,
) -> MapLatLon
pub fn latlon_at_px( viewport: MapViewport, px: LogicalPosition, container: LogicalSize, ) -> MapLatLon
Project a screen pixel px (relative to the map node’s top-left, in a
node of size container) to a lat/lon on the map at viewport. Small-
angle Mercator (accurate at city zooms). Inverse of
px_at_latlon. Exposed so apps don’t reimplement
the projection (e.g. to drop a pin where the user tapped).
Sourcepub fn px_at_latlon(
viewport: MapViewport,
coord: MapLatLon,
container: LogicalSize,
) -> LogicalPosition
pub fn px_at_latlon( viewport: MapViewport, coord: MapLatLon, container: LogicalSize, ) -> LogicalPosition
Inverse of latlon_at_px: where coord lands in
container pixels at viewport.
Sourcepub fn dom(self) -> Dom
pub fn dom(self) -> Dom
Construct the rendered Dom. The returned Dom is a single
<div> with:
- A
MapTileCacheRefAnydataset (initialised from this widget’sviewport+layer). - A
DatasetMergeCallbackso the cache survives relayout. - A
VirtualViewchild that re-renders the visible-tile grid on bounds change. - Mouse-down / mouse-move / mouse-up callbacks that pan the
viewport while a drag is active (the widget owns the
pan state via
MapTileCache::drag_anchor, so user code doesn’t have to wire anything). - Pinch callbacks that zoom in / out.
No tile-fetch worker is wired — tiles render as placeholders.
Use dom_with_fetch to supply one.
Sourcepub fn dom_with_fetch(self, cb: ThreadCallback) -> Dom
pub fn dom_with_fetch(self, cb: ThreadCallback) -> Dom
Like dom, but wires a tile-fetch worker thread.
cb runs on a framework Thread per visible tile: it reads the
TileFetchInit, fetches + decodes, then
sender.send(ThreadReceiveMsg::WriteBack(...)) a TileReadyMsg
targeting map_tile_writeback. The standard worker is
azul_dll::desktop::extra::map::tile_fetch_worker; wrap it in a
ThreadCallback to pass it here. See the recipe in
MOBILE_SESSION_LOG.md.
Trait Implementations§
impl StructuralPartialEq for MapWidget
Auto Trait Implementations§
impl Freeze for MapWidget
impl RefUnwindSafe for MapWidget
impl Send for MapWidget
impl Sync for MapWidget
impl Unpin for MapWidget
impl UnsafeUnpin for MapWidget
impl UnwindSafe for MapWidget
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more