Skip to content

Commit

Permalink
Support copycoords in leaflet
Browse files Browse the repository at this point in the history
  • Loading branch information
JeroenDeDauw committed Nov 29, 2018
1 parent 0899245 commit d72be7e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
6 changes: 6 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ different releases and which versions of PHP and MediaWiki they support, see the
[platform compatibility tables](INSTALL.md#platform-compatibility-and-release-status).


## Maps 6.3.0

Released on November 29th, 2018.

* The `copycoords` parameter (shows coordinates on right click of marker) now works for Leaflet

## Maps 6.2.2

Released on November 27th, 2018.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "6.2.x-dev"
"dev-master": "6.3.x-dev"
}
},
"replace": {
Expand Down
2 changes: 1 addition & 1 deletion extension.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Maps",
"version": "6.2.2",
"version": "6.3.0",

"author": [
"[https://www.mediawiki.org/wiki/User:Jeroen_De_Dauw Jeroen De Dauw]",
Expand Down
14 changes: 12 additions & 2 deletions resources/leaflet/jquery.leaflet.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

/**
* Creates a new marker with the provided data and returns it.
* @param {Object} markerData Contains the fields lat, lon, title, text and icon
* @param {Object} properties Contains the fields lat, lon, title, text and icon
* @return {L.Marker}
*/
this.createMarker = function (properties) {
Expand Down Expand Up @@ -55,14 +55,24 @@
if( properties.hasOwnProperty('text') && properties.text.length > 0 ) {
marker.bindPopup( properties.text );
}

if ( options.copycoords ) {
marker.on(
'contextmenu',
function( e ) {
console.log(e);
prompt(mw.msg('maps-copycoords-prompt'), e.latlng.lat + ',' + e.latlng.lng);
}
);
}

return marker;
};

/**
* Creates a new marker with the provided data, adds it to the map
* and returns it.
* @param {Object} markerData Contains the fields lat, lon, title, text and icon
* @param {Object} properties Contains the fields lat, lon, title, text and icon
* @return {L.Marker}
*/
this.addMarker = function (properties) {
Expand Down

0 comments on commit d72be7e

Please sign in to comment.