Skip to content

Commit

Permalink
Reverse coordinate order if shift key is pressed when copying
Browse files Browse the repository at this point in the history
  • Loading branch information
russss committed May 24, 2024
1 parent a6aecce commit 4645c2c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions web/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,13 @@ class EventMap {
() => this.marker!.location != null
)

contextMenu.addItem('Copy coordinates', (_e, coords) => {
contextMenu.addItem('Copy coordinates', (e, coords) => {
const [lng, lat] = roundPosition([coords.lng, coords.lat], this.map!.getZoom())
navigator.clipboard.writeText(lat + ', ' + lng)
if (e.shiftKey) {
navigator.clipboard.writeText(lng + ', ' + lat)
} else {
navigator.clipboard.writeText(lat + ', ' + lng)
}
})

initVehicles(this.map)
Expand Down

0 comments on commit 4645c2c

Please sign in to comment.