nakarte

Source code of https://map.sikmir.ru (fork)
git clone git://git.sikmir.ru/nakarte
Log | Files | Refs | LICENSE

commit 440de63d98b1d8443489172b00f48e775b2fb7bb
parent 62eafb9483f4b21b805070c4239bcb1d0d2c5841
Author: myadzel <myadzel@gmail.com>
Date:   Sun, 30 Mar 2025 20:36:52 +0300

tracks: Menu item for copy coordinates of point

fixes #1252

Diffstat:
Msrc/lib/leaflet.control.track-list/track-list.js | 7+++++++
1 file changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/lib/leaflet.control.track-list/track-list.js b/src/lib/leaflet.control.track-list/track-list.js @@ -28,6 +28,7 @@ import {createZipFile} from '~/lib/zip-writer'; import {splitLinesAt180Meridian} from "./lib/meridian180"; import {ElevationProvider} from '~/lib/elevations'; import {parseNktkSequence} from './lib/parsers/nktk'; +import * as coordFormats from '~/lib/leaflet.control.coordinates/formats'; const TRACKLIST_TRACK_COLORS = ['#77f', '#f95', '#0ff', '#f77', '#f7f', '#ee5']; @@ -818,6 +819,11 @@ L.Control.TrackList = L.Control.extend({ this.map.on('click', this.movePoint, this); }, + copyPointCoordinatesToClipboard: function(marker, e) { + const {lat, lng} = coordFormats.formatLatLng(marker.latlng.wrap(), coordFormats.SIGNED_DEGREES); + copyToClipboard(`${lat} ${lng}`, e.originalEvent); + }, + beginPointCreate: function(track) { this._beginPointEdit(); this.map.on('click', this.createNewPoint, this); @@ -1357,6 +1363,7 @@ L.Control.TrackList = L.Control.extend({ '-', {text: 'Rename', callback: this.renamePoint.bind(this, e.marker)}, {text: 'Move', callback: this.beginPointMove.bind(this, e.marker)}, + {text: 'Copy coordinates', callback: this.copyPointCoordinatesToClipboard.bind(this, e.marker, e)}, {text: 'Delete', callback: this.removePoint.bind(this, e.marker)}, ] ).show(e);