Skip to content
This repository has been archived by the owner on Jul 5, 2018. It is now read-only.

Commit

Permalink
provide custom markers for map
Browse files Browse the repository at this point in the history
show different icon depending on whether the monument has pictures
or not

see https://mingle.corp.wikimedia.org/projects/wlm_android_app/cards/119
WARNING: the api changes from version 0.3 to 0.4 for icons - so have future
proofed this for when we upgrade
TODO: icons currently have no shadow effect so don't look as good as they could
  • Loading branch information
jrobson committed Aug 13, 2012
1 parent 9d96ecc commit 004fd21
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
Binary file added assets/www/images/pin-no-photos.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/www/images/pin.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 12 additions & 1 deletion assets/www/js/geo.js
Expand Up @@ -138,7 +138,18 @@ define(['jquery', '../leaflet/leaflet-src', 'leafclusterer'], function() {
}

function addMonument(monument, onClick) {
var marker = new L.Marker(new L.LatLng(monument.lat, monument.lon));
var url = 'images/', iconOptions;
url += monument.image ? 'pin.png' : 'pin-no-photos.png';
if ( L.VERSION === '0.3' ) { // TODO: upgrade leaflet to 4.0
iconOptions = url;
} else {
iconOptions = {
iconUrl: url,
iconSize: [ 30, 50 ]
};
}
var markerIcon = new L.Icon( iconOptions );
var marker = new L.Marker( new L.LatLng( monument.lat, monument.lon ), { icon: markerIcon } );
var popup = "<div><strong>" + monument.name + "</strong></div>";
var popupDOM = $(popup).click(function() {
onClick(monument);
Expand Down

0 comments on commit 004fd21

Please sign in to comment.