lustre_kakaomap
KakaoMap wrapper for Lustre applications.
Provides map initialization, view rendering, and map control effects.
Use with lustre_kakaomap/coords, lustre_kakaomap/marker,
lustre_kakaomap/events, and other sub-modules.
Types
Values
pub fn add_control(
id id: String,
control control: types.ControlType,
position position: types.ControlPosition,
) -> effect.Effect(msg)
Adds a built-in control to the map.
pub fn add_overlay_map_type(
id id: String,
overlay overlay: types.OverlayMapTypeId,
) -> effect.Effect(msg)
Adds an overlay tile layer.
pub fn center(position: coords.LatLng) -> MapOption
Sets the initial center coordinate. Required.
pub fn destroy(id id: String) -> effect.Effect(msg)
Destroys the map instance and cleans up all resources.
pub fn disable_double_click(disabled: Bool) -> MapOption
Disables double-click event and zoom.
pub fn disable_double_click_zoom(disabled: Bool) -> MapOption
Disables double-click zoom only.
pub fn get_bounds(
id id: String,
handler handler: fn(coords.LatLngBounds) -> msg,
) -> effect.Effect(msg)
Gets the current visible bounds of the map.
pub fn get_center(
id id: String,
handler handler: fn(coords.LatLng) -> msg,
) -> effect.Effect(msg)
Gets the current center position of the map.
kakaomap.get_center(id: "map", handler: GotCenter)
pub fn get_level(
id id: String,
handler handler: fn(Int) -> msg,
) -> effect.Effect(msg)
Gets the current zoom level of the map.
pub fn get_map_type(
id id: String,
handler handler: fn(types.MapTypeId) -> msg,
) -> effect.Effect(msg)
Gets the current map type.
pub fn init(
id id: String,
options options: List(MapOption),
) -> effect.Effect(msg)
Initializes the KakaoMap instance on the container with the given id.
kakaomap.init(id: "mymap", options: [
kakaomap.center(coords.seoul()),
kakaomap.level(3),
kakaomap.draggable(True),
])
pub fn jump(
id id: String,
position position: coords.LatLng,
level lvl: Int,
) -> effect.Effect(msg)
Jumps to a center and zoom level.
pub fn keyboard_shortcuts(enabled: Bool) -> MapOption
Enables/disables keyboard shortcuts.
pub fn map(
id id: String,
attributes attributes: List(attribute.Attribute(msg)),
) -> element.Element(msg)
Renders the map container div element.
kakaomap.map(id: "mymap", attributes: [
attribute.style([#("width", "100%"), #("height", "400px")]),
])
pub fn max_level(level: Int) -> MapOption
Sets the maximum zoom level (most zoomed out).
pub fn min_level(level: Int) -> MapOption
Sets the minimum zoom level (most zoomed in).
pub fn pan_by(
id id: String,
dx dx: Int,
dy dy: Int,
) -> effect.Effect(msg)
Pans the map by the given pixel offset.
pub fn pan_to(
id id: String,
position position: coords.LatLng,
) -> effect.Effect(msg)
Pans smoothly to the given coordinate.
pub fn relayout(id id: String) -> effect.Effect(msg)
Triggers a map relayout (call after container resize).
pub fn remove_overlay_map_type(
id id: String,
overlay overlay: types.OverlayMapTypeId,
) -> effect.Effect(msg)
Removes an overlay tile layer.
pub fn script(app_key app_key: String) -> element.Element(msg)
Generates a script element to load the KakaoMap SDK.
kakaomap.script(app_key: "YOUR_APP_KEY")
pub fn script_with_libraries(
app_key app_key: String,
libraries libraries: List(String),
) -> element.Element(msg)
Generates a script element to load the KakaoMap SDK with additional libraries.
kakaomap.script_with_libraries(
app_key: "YOUR_KEY",
libraries: ["services", "clusterer"],
)
pub fn set_bounds(
id id: String,
bounds bounds: coords.LatLngBounds,
) -> effect.Effect(msg)
Adjusts the map to fit the given bounds.
pub fn set_center(
id id: String,
position position: coords.LatLng,
) -> effect.Effect(msg)
Sets the center coordinate of the map.
pub fn set_draggable(
id id: String,
enabled enabled: Bool,
) -> effect.Effect(msg)
Sets whether the map is draggable.
pub fn set_level(
id id: String,
level lvl: Int,
) -> effect.Effect(msg)
Sets the zoom level.
pub fn set_map_type(
id id: String,
map_type map_type_id: types.MapTypeId,
) -> effect.Effect(msg)
Sets the map type (Roadmap, Skyview, Hybrid).
pub fn set_zoomable(
id id: String,
enabled enabled: Bool,
) -> effect.Effect(msg)
Sets whether the map is zoomable via scroll wheel.
pub fn tile_animation(enabled: Bool) -> MapOption
Enables/disables tile loading animation.