Actions

Widget

Map: Difference between revisions

From Dragon Eye Atlas

No edit summary
No edit summary
Line 50: Line 50:
   map.setLayoutProperty('contours-lines', 'visibility', 'none');
   map.setLayoutProperty('contours-lines', 'visibility', 'none');
<!--{/if}-->
<!--{/if}-->
  // Create a popup, but don't add it to the map yet.
  var popup = new mapboxgl.Popup({
      closeButton: false,
      closeOnClick: false
  });


   var biome = "";
   var biome = "";
Line 77: Line 72:
       });
       });
        
        
       popup.setLngLat(e.lngLat.wrap())
       new mapboxgl.Popup()
        .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>Province:</td><td>"+province+"</td></tr><tr><td>Culture:</td><td>"+culture+"</td></tr><tr><td>Religion:</td><td>"+religion+"</td></tr></table>")
         .addTo(map);
         .addTo(map);
  });
  map.on('mouseleave', 'overlay', function() {
      $("#mapinfo-realm").html("");
      $("#mapinfo-province").html("");
      $("#mapinfo-culture").html("");
      $("#mapinfo-religion").html("");
      popup.remove();
   });
   });



Revision as of 17:26, 11 October 2019

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

Examples

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