Actions

Widget

Difference between revisions of "Map"

From Dragon Eye Atlas

(Undo revision 1757 by Tom (talk))
Tag: Undo
Line 47: Line 47:


map.on("load", function() {
map.on("load", function() {
<!--{if $zone}-->
  map.setFilter('zones', ["all", ["==", "name", "<!--{$zone|escape:'html'}-->"]]);
  map.setLayoutProperty('zones', 'visibility', 'visible');
  map.setLayoutProperty('contours-labels', 'visibility', 'none');
  map.setLayoutProperty('contours-lines', 'visibility', 'none');
<!--{/if}-->
<!--{if $show}-->
<!--{if $show}-->
   map.setFilter('overlay', ["all", ["==", "class", "<!--{$show|escape:'html'}-->"], ["!=", "name", "<!--{$filter|escape:'html'}-->"]]);
   <!--{if $show eq "province"}-->
   map.setLayoutProperty('overlay', 'visibility', 'visible');
      map.setFilter('overlay-minor', ["all", ["==", "class", "<!--{$show|escape:'html'}-->"], ["!=", "name", "<!--{$filter|escape:'html'}-->"]]);
      map.setLayoutProperty('overlay-minor', 'visibility', 'visible');
      map.setLayoutProperty('contours-labels', 'visibility', 'none');
      map.setLayoutProperty('contours-lines', 'visibility', 'none');
   <!--{elseif $show eq "state"}-->
      map.setFilter('overlay-minor', ["all", ["==", "class", "<!--{$show|escape:'html'}-->"], ["!=", "name", "<!--{$filter|escape:'html'}-->"]]);
      map.setLayoutProperty('overlay-minor', 'visibility', 'visible');
      map.setLayoutProperty('contours-labels', 'visibility', 'none');
      map.setLayoutProperty('contours-lines', 'visibility', 'none');
  <!--{elseif $show eq "zone"}-->
      map.setFilter('overlay-minor', ["all", ["==", "class", "<!--{$show|escape:'html'}-->"], ["!=", "name", "<!--{$filter|escape:'html'}-->"]]);
      map.setLayoutProperty('overlay-minor', 'visibility', 'visible');
      map.setLayoutProperty('contours-labels', 'visibility', 'none');
      map.setLayoutProperty('contours-lines', 'visibility', 'none');
  <!--{else}-->
      map.setFilter('overlay-major', ["all", ["==", "class", "<!--{$show|escape:'html'}-->"], ["!=", "name", "<!--{$filter|escape:'html'}-->"]]);
      map.setLayoutProperty('overlay-major', 'visibility', 'visible');
  <!--{/if}-->
   map.setLayoutProperty('realms-labels', 'visibility', 'none');
   map.setLayoutProperty('realms-labels', 'visibility', 'none');
   map.setLayoutProperty('contours-labels', 'visibility', 'none');
   map.setLayoutProperty('contours-labels', 'visibility', 'none');

Revision as of 14:18, 24 February 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}}