Actions

Widget

Map: Difference between revisions

From Dragon Eye Atlas

No edit summary
No edit summary
Line 52: Line 52:
   map.setLayoutProperty('contours-lines', 'visibility', 'none');
   map.setLayoutProperty('contours-lines', 'visibility', 'none');
<!--{/if}-->
<!--{/if}-->
  map.on('mouseenter', 'realms-labels', function() { map.getCanvas().style.cursor = 'pointer'; });
  map.on('mouseleave', 'realms-labels', function() { map.getCanvas().style.cursor = ''; });


   map.on('mouseenter', 'towns-labels', function() { map.getCanvas().style.cursor = 'pointer'; });
   map.on('mouseenter', 'towns-labels', function() { map.getCanvas().style.cursor = 'pointer'; });
   map.on('mouseleave', 'towns-labels', function() { map.getCanvas().style.cursor = ''; });
   map.on('mouseleave', 'towns-labels', function() { map.getCanvas().style.cursor = ''; });


   map.on('mouseenter', 'realms-labels', function() { map.getCanvas().style.cursor = 'pointer'; });
   map.on('mouseenter', 'villages-labels', function() { map.getCanvas().style.cursor = 'pointer'; });
   map.on('mouseleave', 'realms-labels', function() { map.getCanvas().style.cursor = ''; });
   map.on('mouseleave', 'villages-labels', function() { map.getCanvas().style.cursor = ''; });
 


  map.on('click', 'realms-labels', function(e) {
      event.stopPropagation();
      var name = e.features[0].properties.name;
      // this could probably improved with the proper mediawiki magic word, but need to figure out which one and how to make it work in widgets
      window.location.href = '/dragoneye/atlas/'+name;
  });


   map.on('click', 'towns-labels', function(e) {
   map.on('click', 'towns-labels', function(e) {
Line 67: Line 77:
   });
   });


   map.on('click', 'realms-labels', function(e) {
   map.on('click', 'villages-labels', function(e) {
       event.stopPropagation();
       event.stopPropagation();
       var name = e.features[0].properties.name;
       var name = e.features[0].properties.Burg;
       // this could probably improved with the proper mediawiki magic word, but need to figure out which one and how to make it work in widgets
       // this could probably improved with the proper mediawiki magic word, but need to figure out which one and how to make it work in widgets
       window.location.href = '/dragoneye/atlas/'+name;
       window.location.href = '/dragoneye/atlas/'+name+'_(village)';
   });
   });



Revision as of 08:51, 2 November 2019

Map Widget

New and unified map widget.

Parameters

  • lon, lat, zoom - longitude, latitude and zoom for the map (defaults: 1, 30, 4)
  • width, height - dimensions of the map itself on the page, in px or % (defaults: 50%, 400px)
  • bounds - optional bounds array, replaces lon,lat,zoom
  • show, filter = show must be one of "realm", "culture", "religion" or "province" and filter must be the (short) name of the entity to highlight
  • info - set to show the information overlay/popup on click

Examples

  • {{#widget:Map|bounds=[[0, 25], [8, 31]]}}
  • {{#Widget:Map|lat=31|lon=-15.5|zoom=3}}