KNMapViewEventListener
INFO
This English reference is based on Directions SDK 1.12.8-hotfix02. For the latest version, see the Korean reference.
Receives camera gestures (panning, zooming, tilting, and rotating) and map touch events such as single taps and double taps. Implement KNMapViewEventListener and register it with KNMapView.
Methods
onSingleTapped
Called when the map is tapped once. Returns the screen position and KATEC coordinates of the tapped location.
Example code — onSingleTapped
mapView.mapViewEventListener = object : KNMapViewEventListener {
override fun onSingleTapped(mapView: KNMapView?, screenPoint: IntPoint, coordinate: FloatPoint) {
// Implement as needed
}
}fun onSingleTapped( mapView: KNMapView?,
screenPoint: IntPoint,
coordinate: FloatPoint )Parameters
| Name | Description |
|---|---|
mapView | Map view where the touch event occurred |
screenPoint | Screen coordinates where the touch event occurred |
coordinate | KATEC coordinates where the touch event occurred |
onDoubleTapped
Called when the map is double-tapped. Returns the screen position and KATEC coordinates of the last tap.
Example code — onDoubleTapped
mapView.mapViewEventListener = object : KNMapViewEventListener {
override fun onDoubleTapped(mapView: KNMapView?, screenPoint: IntPoint, coordinate: FloatPoint) {
// Implement as needed
}
}fun onDoubleTapped( mapView: KNMapView?,
screenPoint: IntPoint,
coordinate: FloatPoint )Parameters
| Name | Description |
|---|---|
mapView | Map view where the touch event occurred |
screenPoint | Last Screen coordinates where the touch event occurred |
coordinate | Last KATEC coordinates where the touch event occurred |
onLongPressed
Called when a point on the map is pressed and held. Returns its screen position and KATEC coordinates.
Example code — onLongPressed
mapView.mapViewEventListener = object : KNMapViewEventListener {
override fun onLongPressed(mapView: KNMapView?, screenPoint: IntPoint, coordinate: FloatPoint) {
// Implement as needed
}
}fun onLongPressed( mapView: KNMapView?,
screenPoint: IntPoint,
coordinate: FloatPoint )Parameters
| Name | Description |
|---|---|
mapView | Map view where the touch event occurred |
screenPoint | Screen coordinates where the touch event occurred |
coordinate | KATEC coordinates where the touch event occurred |
onPanningStarted
Called when a panning gesture starts. Returns the screen position and KATEC coordinates where the gesture started.
Example code — onPanningStarted
mapView.mapViewEventListener = object : KNMapViewEventListener {
override fun onPanningStarted(mapView: KNMapView?, screenPoint: IntPoint, coordinate: FloatPoint) {
// Implement as needed
}
}fun onPanningStarted( mapView: KNMapView?,
screenPoint: IntPoint,
coordinate: FloatPoint )Parameters
| Name | Description |
|---|---|
mapView | Map view where the touch event occurred |
screenPoint | Screen coordinates where the touch event occurred |
coordinate | KATEC coordinates where the touch event occurred |
onPanningChanging
Called while a panning gesture is in progress. Returns the current screen position and KATEC coordinates.
Example code — onPanningChanging
mapView.mapViewEventListener = object : KNMapViewEventListener {
override fun onPanningChanging(mapView: KNMapView?, screenPoint: IntPoint, coordinate: FloatPoint) {
// Implement as needed
}
}fun onPanningChanging( mapView: KNMapView?,
screenPoint: IntPoint,
coordinate: FloatPoint )Parameters
| Name | Description |
|---|---|
mapView | Map view where the touch event occurred |
screenPoint | Screen coordinates according to changing position |
coordinate | KATEC coordinates according to changing location |
onPanningEnded
Called when a panning gesture ends. Returns the screen position and KATEC coordinates where the finger was lifted.
Example code — onPanningEnded
mapView.mapViewEventListener = object : KNMapViewEventListener {
override fun onPanningEnded(mapView: KNMapView?, screenPoint: IntPoint, coordinate: FloatPoint) {
// Implement as needed
}
}fun onPanningEnded( mapView: KNMapView?,
screenPoint: IntPoint,
coordinate: FloatPoint )Parameters
| Name | Description |
|---|---|
mapView | Map view where the touch event occurred |
screenPoint | Screen coordinates when the event ends |
coordinate | KATEC coordinates at the end of the event |
onZoomingStarted
Called when a two-finger zoom gesture starts. Returns the screen position and zoom level.
Example code — onZoomingStarted
mapView.mapViewEventListener = object : KNMapViewEventListener {
override fun onZoomStarted(mapView: KNMapView?, screenPoint: IntPoint, zoom: Float) {
// Implement as needed
}
}fun onZoomingStarted mapView: KNMapView?
screenPoint: IntPoint
zoom: Float )Parameters
| Name | Description |
|---|---|
mapView | Map view where the touch event occurred |
screenPoint | Screen coordinates where the touch event occurred |
zoom | Current zoom level of the map |
onZoomingChanging
Called while a two-finger zoom gesture is in progress. Returns the current screen position and zoom level.
Example code — onZoomingChanging
mapView.mapViewEventListener = object : KNMapViewEventListener {
override fun onZoomChanging(mapView: KNMapView?, screenPoint: IntPoint, zoom: Float) {
// Implement as needed
}
}fun onZoomingChanging( mapView: KNMapView?,
screenPoint: IntPoint,
zoom: Float )Parameters
| Name | Description |
|---|---|
mapView | Map view where the touch event occurred |
screenPoint | Screen coordinates according to screen reduction/enlargement |
zoom | Current zoom level of the map |
onZoomingEnded
Called when a two-finger zoom gesture ends. Returns the screen position where the fingers were lifted and the zoom level.
Example code — onZoomingEnded
mapView.mapViewEventListener = object : KNMapViewEventListener {
override fun onZoomEnded(mapView: KNMapView?, screenPoint: IntPoint, zoom: Float) {
// Implement as needed
}
}fun onZoomingEnded( mapView: KNMapView?,
screenPoint: IntPoint,
zoom: Float )Parameters
| Name | Description |
|---|---|
mapView | Map view where the touch event occurred |
screenPoint | Screen coordinates when the event ends |
zoom | Current zoom level of the map |
onBearingStarted
Called when a two-finger rotation gesture starts. Returns the screen position and rotation angle.
Example code — onBearingStarted
mapView.mapViewEventListener = object : KNMapViewEventListener {
override fun onBearingStarted(mapView: KNMapView?, screenPoint: IntPoint, bearing: Float) {
// Implement as needed
}
}fun onBearingStarted( mapView: KNMapView?,
screenPoint: IntPoint,
bearing: Float )Parameters
| Name | Description |
|---|---|
mapView | Map view where the touch event occurred |
screenPoint | Screen coordinates where the touch event occurred |
bearing | Current rotation angle of the map |
onBearingChanging
Called while a two-finger rotation gesture is in progress. Returns the current screen position and rotation angle.
Example code — onBearingChanging
mapView.mapViewEventListener = object : KNMapViewEventListener {
override fun onBearingChanging(mapView: KNMapView?, screenPoint: IntPoint, bearing: Float) {
// Implement as needed
}
}fun onBearingChanging( mapView: KNMapView?,
screenPoint: IntPoint,
bearing: Float )Parameters
| Name | Description |
|---|---|
mapView | Map view where the touch event occurred |
screenPoint | Screen coordinates according to screen rotation |
bearing | Current rotation angle of the map |
onBearingEnded
Called when a two-finger rotation gesture ends. Returns the screen position where the fingers were lifted and the rotation angle.
Example code — onBearingEnded
mapView.mapViewEventListener = object : KNMapViewEventListener {
override fun onBearingEnded(mapView: KNMapView?, screenPoint: IntPoint, bearing: Float) {
// Implement as needed
}
}fun onBearingEnded( mapView: KNMapView?,
screenPoint: IntPoint,
bearing: Float )Parameters
| Name | Description |
|---|---|
mapView | Map view where the touch event occurred |
screenPoint | Screen coordinates when the event ends |
bearing | Current rotation angle of the map |
onTiltStarted
Called when a two-finger tilt gesture starts. Returns the screen position and tilt value.
Example code — onTiltStarted
mapView.mapViewEventListener = object : KNMapViewEventListener {
override fun onTiltStarted(mapView: KNMapView?, screenPoint: IntPoint, tilt: Float) {
// Implement as needed
}
}fun onTiltStarted( mapView: KNMapView?,
screenPoint: IntPoint,
tilt: Float )Parameters
| Name | Description |
|---|---|
mapView | Map view where the touch event occurred |
screenPoint | Screen coordinates where the touch event occurred |
tilt | Current tilt of the map |
onTiltChanging
Called while a two-finger tilt gesture is in progress. Returns the current screen position and tilt value.
Example code — onTiltChanging
mapView.mapViewEventListener = object : KNMapViewEventListener {
override fun onTiltChanging(mapView: KNMapView?, screenPoint: IntPoint, tilt: Float) {
// Implement as needed
}
}fun onTiltChanging( mapView: KNMapView?,
screenPoint: IntPoint,
tilt: Float )Parameters
| Name | Description |
|---|---|
mapView | Map view where the touch event occurred |
screenPoint | Screen coordinates during the tilt gesture |
tilt | Current map tilt |
onTiltEnded
Called when a two-finger tilt gesture ends. Returns the screen position where the fingers were lifted and the tilt value.
Example code — onTiltEnded
mapView.mapViewEventListener = object : KNMapViewEventListener {
override fun onTiltEnded(mapView: KNMapView?, screenPoint: IntPoint, tilt: Float) {
// Implement as needed
}
}fun onTiltEnded( mapView: KNMapView?,
screenPoint: IntPoint,
tilt: Float )Parameters
| Name | Description |
|---|---|
mapView | Map view where the touch event occurred |
screenPoint | Screen coordinates when the event ends |
tilt | Current tilt of the map |
onCameraAnimationCanceled
Called when a camera animation started by animateCamera is canceled.
Example code — onCameraAnimationCanceled
mapView.mapViewEventListener = object : KNMapViewEventListener {
override fun onCameraAnimationCanceled(mapView: KNMapView?, cameraUpdate: KNMapCameraUpdate?) {
// Implement as needed
}
}fun onCameraAnimationCanceled( mapView: KNMapView?,
cameraUpdate: KNMapCameraUpdate? = null )Parameters
| Name | Description |
|---|---|
mapView | Map view where the camera event occurred |
cameraUpdate | Camera update information |
onCameraAnimationEnded
Called when a camera animation started by animateCamera ends.
Example code — onCameraAnimationEnded
mapView.mapViewEventListener = object : KNMapViewEventListener {
override fun onCameraAnimationEnded(mapView: KNMapView?, cameraUpdate: KNMapCameraUpdate?) {
// Implement as needed
}
}fun onCameraAnimationEnded( mapView: KNMapView?,
cameraUpdate: KNMapCameraUpdate? = null )Parameters
| Name | Description |
|---|---|
mapView | Map view where the camera event occurred |
cameraUpdate | Camera update information |
onUserLocationAnimationEnded
Called when the user-location animation ends.
Example code — onUserLocationAnimationEnded
mapView.mapViewEventListener = object : KNMapViewEventListener {
override fun onUserLocationAnimationEnded(mapView: KNMapView?) {
// Implement as needed
}
}fun onUserLocationAnimationEnded( mapView: KNMapView? )Parameters
| Name | Description |
|---|---|
mapView | Map view with user location registered |
onPOISelected
Called when a point of interest (POI) on the map is selected. Returns the selected POI ID, name, and KATEC coordinates.
fun onPOISelected( poiId: Long,
poiName: Array <String?>?,
coordinate: FloatPoint )Parameters
| Name | Description |
|---|---|
poiId | ID of selected point of interest (POI) |
poiName | Name information for selected point of interest (POI) |
coordinate | KATEC information of selected point of interest (POI) |
onRouteSelected
Called when a route on the map is selected. Returns the selected route and its index.
fun onRouteSelected( route: KNRoute,
index: Int )Parameters
| Name | Description |
|---|---|
route | selected route |
index | index of the selected route in the list of routes registered on the map |