1.4.0 • Published 2 years ago

@forter/map v1.4.0

Weekly downloads
21
License
Apache-2.0
Repository
github
Last release
2 years ago

fc-map

An element by Forter

Usage

<script>
   import '@forter/map';
</script>

<fc-map></fc-map>

Examples

<!-- complex -->
    <fc-map zoom="12" lat="22.3193" long="114.1694" .markers="${{'cities':{'opened':true,'data':[{'position':[51.5074,0.1278],'label':'London','icon':{'iconUrl':'https://img.icons8.com/material-rounded/2x/marker.png','iconSize':[28,28],'iconAnchor':[0,0],'popupAnchor':[14,-7]},'tooltipClass':'darkTooltip'},{'position':[40.7128,-74.006],'label':'New York','icon':{'iconUrl':'https://img.icons8.com/material-rounded/2x/marker.png','iconSize':[28,28],'iconAnchor':[0,0],'popupAnchor':[14,-7]},'tooltipClass':'darkTooltip'},{'position':[22.3193,114.1694],'label':'Hong Kong','icon':{'iconUrl':'https://img.icons8.com/material-rounded/2x/marker.png','iconSize':[28,28],'iconAnchor':[0,0],'popupAnchor':[14,-7]},'tooltipClass':'darkTooltip'}]},'buildings':{'opened':false,'data':[{'position':[22.3034,114.1602],'label':'ICC (Tallest Building in Hong Kong)','icon':{'iconUrl':'https://img.icons8.com/material-rounded/2x/building.png','iconSize':[28,28],'iconAnchor':[0,0],'popupAnchor':[14,-7]},'tooltipClass':'darkTooltip'},{'position':[40.7127,-74.0134],'label':'One World Trade Center (Tallest Building in NYC)','icon':{'iconUrl':'https://img.icons8.com/material-rounded/2x/building.png','iconSize':[28,28],'iconAnchor':[0,0],'popupAnchor':[14,-7]},'tooltipClass':'darkTooltip'},{'position':[51.5045,0.0865],'label':'The Shard (Tallest Building in London)','icon':{'iconUrl':'https://img.icons8.com/material-rounded/2x/building.png','iconSize':[28,28],'iconAnchor':[0,0],'popupAnchor':[14,-7]},'tooltipClass':'darkTooltip'}]}}}">

     <fc-layout slot="buttons" rows=1 columns=3 gap="30px" style="margin: 15px 0px 15px 15px;" flowColumn>
      <fc-button onclick="this.parentNode.parentNode.setView({ lat: 51.5074, long: 0.1278, zoom: 12 })" intent="primary">Go To London</fc-button>
      <fc-button onclick="this.parentNode.parentNode.setView({ lat: 40.7128, long: -74.0060, zoom: 12 })" intent="primary">Go To New York</fc-button>
      <fc-button onclick="this.parentNode.parentNode.flyTo({ lat: 22.3193, long: 114.1694, zoom: 12 })" intent="primary">Fly To Hong Kong</fc-button>
     </fc-layout>

    </fc-map>

Properties

PropertyAttributeTypeDefaultDescription
latlatstring"51.5074"lat coordinates. example: 48.8566
layerButtonHiddenlayerButtonHiddenstringfalseshow layers button
longlongstring"0.1278"long coordinates. example: 2.3522
markersmarkersany{}map's markers. example {"cities":{"opened":true,"data":[{"position":[51.5074,0.1278],"label":"London","icon":{"iconUrl":"https://img.icons8.com/material-rounded/2x/marker.png","iconSize":[28,28],"iconAnchor":[0,0],"popupAnchor":[14,-7]},"tooltipClass":"darkTooltip"},{"position":[40.7128,-74.006],"label":"New York","icon":{"iconUrl":"https://img.icons8.com/material-rounded/2x/marker.png","iconSize":[28,28],"iconAnchor":[0,0],"popupAnchor":[14,-7]},"tooltipClass":"darkTooltip"},{"position":[22.3193,114.1694],"label":"Hong Kong","icon":{"iconUrl":"https://img.icons8.com/material-rounded/2x/marker.png","iconSize":[28,28],"iconAnchor":[0,0],"popupAnchor":[14,-7]},"tooltipClass":"darkTooltip"}]},"buildings":{"opened":false,"data":[{"position":[22.3034,114.1602],"label":"ICC (Tallest Building in Hong Kong)","icon":{"iconUrl":"https://img.icons8.com/material-rounded/2x/building.png","iconSize":[28,28],"iconAnchor":[0,0],"popupAnchor":[14,-7]},"tooltipClass":"darkTooltip"},{"position":[40.7127,-74.0134],"label":"One World Trade Center (Tallest Building in NYC)","icon":{"iconUrl":"https://img.icons8.com/material-rounded/2x/building.png","iconSize":[28,28],"iconAnchor":[0,0],"popupAnchor":[14,-7]},"tooltipClass":"darkTooltip"},{"position":[51.5045,0.0865],"label":"The Shard (Tallest Building in London)","icon":{"iconUrl":"https://img.icons8.com/material-rounded/2x/building.png","iconSize":[28,28],"iconAnchor":[0,0],"popupAnchor":[14,-7]},"tooltipClass":"darkTooltip"}]}}
noZoomControlno-zoom-controlbooleanfalseno zoom control
zoomzoomstring"10"zoom level. example: 2

Events

EventDescription
fly-totransition a move in map from one location to another. example: { "lat": 22.3193, "long": 114.1694, "zoom": 12, "options": { "animation": true, "duration": 3 } }, method: flyTo
set-viewset the map location. example: { "lat": 51.5074, "long": 0.1278, "zoom": 12, "options": { "animation": true } }, method: setView

CSS Custom Properties

PropertyDescription
--fc-map-heightheight (has to be in px).
--fc-map-z-indexz-index (make sure map is not on top of modal or others) example: 2
1.4.0

2 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago