MapControls

Handles user interactions (mouse and keyboard) for a MapLibre map.

Mouse controls:

  • Left drag: Pan the map

  • Mouse wheel: Zoom in/out

  • Right drag horizontal: Rotate the map

  • Right drag vertical: Tilt/pitch the map

  • Ctrl+Left drag: Alternative for rotate/tilt

  • Double-click: Zoom in at point (animated)

  • Shift+Double-click: Zoom out at point (animated)

Keyboard controls:

  • Arrow keys: Pan the map

  • +/- or =/- keys: Zoom in/out

Constructors

Link copied to clipboard
constructor(component: Component, map: MapLibreMap, config: MapControls.Config = Config(), observer: MapControls.Observer? = null)

Types

Link copied to clipboard
data class Config(val enableDragPan: Boolean = true, val enableScrollZoom: Boolean = true, val enableDoubleClickZoom: Boolean = true, val enableDragRotate: Boolean = true, val enableDragTilt: Boolean = true, val enableKeyboardPan: Boolean = true, val enableKeyboardZoom: Boolean = true, val panSpeed: Double = 1.0, val zoomSpeed: Double = 1.0, val rotateSpeed: Double = 1.0, val tiltSpeed: Double = 1.0)
Link copied to clipboard
interface Observer

Properties

Link copied to clipboard

Functions

Link copied to clipboard
fun disable()

Disable interaction handling

Link copied to clipboard
fun enable()

Enable interaction handling

Link copied to clipboard
open override fun keyPressed(e: KeyEvent)
Link copied to clipboard
open override fun keyReleased(e: KeyEvent)
Link copied to clipboard
open override fun keyTyped(e: KeyEvent)
Link copied to clipboard
open override fun mouseClicked(e: MouseEvent)
Link copied to clipboard
open override fun mouseDragged(e: MouseEvent)
Link copied to clipboard
open override fun mouseEntered(e: MouseEvent)
Link copied to clipboard
open override fun mouseExited(e: MouseEvent)
Link copied to clipboard
open override fun mouseMoved(e: MouseEvent)
Link copied to clipboard
open override fun mousePressed(e: MouseEvent)
Link copied to clipboard
open override fun mouseReleased(e: MouseEvent)
Link copied to clipboard
open override fun mouseWheelMoved(e: MouseWheelEvent)