Actions

Widget

Difference between revisions of "Map"

From Dragon Eye Atlas

Line 119: Line 119:


<!--{if $info}-->
<!--{if $info}-->
   map.setLayoutProperty('overlay_major', 'visibility', 'visible');
   map.setLayoutProperty('overlay-major', 'visibility', 'visible');
   map.setPaintProperty('overlay_major', 'fill-opacity', 0);
   map.setPaintProperty('overlay-major', 'fill-opacity', 0);


   var biome = "";
   var biome = "";
Line 129: Line 129:
   });
   });


   map.on('click', 'overlay', function(e) {
   map.on('click', 'overlay-major', function(e) {
       var Realm = "(none)";
       var Realm = "(none)";
      var Province = "(none)";
       var Culture = "(none)";
       var Culture = "(none)";
       var Religion = "(none)";
       var Religion = "(none)";
Line 137: Line 136:
         switch (feature.properties.class) {
         switch (feature.properties.class) {
             case 'realm':    Realm = feature.properties.name; break;
             case 'realm':    Realm = feature.properties.name; break;
            case 'province': Province = feature.properties.name; break;
             case 'culture':  Culture = feature.properties.name; break;
             case 'culture':  Culture = feature.properties.name; break;
             case 'religion': Religion = feature.properties.name; break;
             case 'religion': Religion = feature.properties.name; break;
Line 145: Line 143:
       new mapboxgl.Popup()
       new mapboxgl.Popup()
         .setLngLat(e.lngLat.wrap())
         .setLngLat(e.lngLat.wrap())
         .setHTML("<table><tr><td>Biome:</td><td>"+biome+"</td></tr><tr><td>Realm:</td><td>"+Realm+"</td></tr><tr><td>Province:</td><td>"+Province+"</td></tr><tr><td>Culture:</td><td>"+Culture+"</td></tr><tr><td>Religion:</td><td>"+Religion+"</td></tr></table>")
         .setHTML("<table><tr><td>Biome:</td><td>"+biome+"</td></tr><tr><td>Realm:</td><td>"+Realm+"</td></tr><tr><td>Culture:</td><td>"+Culture+"</td></tr><tr><td>Religion:</td><td>"+Religion+"</td></tr></table>")
         .addTo(map);
         .addTo(map);
   });
   });

Revision as of 14:01, 12 March 2020

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
  • overlay - activate color overlay, most be one of "realm", "culture, "religion" or "province"
  • zone - activate zone overlay
  • 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}}