File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
src/main/kotlin/de/saring/leafletmap Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -219,6 +219,28 @@ class LeafletMapView : StackPane() {
219219 execScript(" $markerName .setIcon(${newMarker.iconName} );" )
220220 }
221221
222+ /* *
223+ * Activates the on marker click alert
224+ */
225+ fun addOnMarkerClick (markerName : String , icao : String ){
226+ execScript(" $markerName .on('click', function(e){ alert('plane,$icao ')})" )
227+ }
228+
229+ /* *
230+ * Activates the move alert
231+ */
232+ fun initMapDrag (){
233+ execScript(" myMap.on('moveend', function (e) { alert('move,' + myMap.getCenter()); });" );
234+ }
235+
236+ /* *
237+ * Activates the click alert
238+ */
239+ fun initMapClick (){
240+ execScript(" myMap.on('click', function (e) { alert('click,' + e.latlng); });" );
241+ }
242+
243+ /* *
222244 * Draws a track path along the specified positions in the color red and zooms the map to fit the track perfectly.
223245 *
224246 * @param positions list of track positions
@@ -239,4 +261,13 @@ class LeafletMapView : StackPane() {
239261 }
240262
241263 private fun execScript (script : String ) = webEngine.executeScript(script)
264+
265+ /* *
266+ * Returns the WebEngine of the map
267+ *
268+ * @return the webEngine
269+ */
270+ fun getWebEngine (): WebEngine {
271+ return webEngine
272+ }
242273}
You can’t perform that action at this time.
0 commit comments