Commit c16a636e authored by Deployer's avatar Deployer

Fixed setRTLTextPlugin issue when the map instance is called multiple times

parent ba8984cf
......@@ -14,8 +14,8 @@ CedarMaps JS is a javascript library for building interactive maps. It's simply
Recommended usage is via the CedarMaps CDN. Just include CSS and JavaScript files in `<head>` section of your HTML file.
```html
<script src='https://api.cedarmaps.com/cedarmaps-gl.js/v2.0.0/cedarmaps.js'></script>
<link href='https://api.cedarmaps.com/cedarmaps-gl.js/v2.0.0/cedarmaps.css' rel='stylesheet'/>
<script src='https://api.cedarmaps.com/cedarmaps-gl.js/v2.1.1/cedarmaps.js'></script>
<link href='https://api.cedarmaps.com/cedarmaps-gl.js/v2.1.1/cedarmaps.css' rel='stylesheet'/>
```
and put the following code in the `<body>` of your HTML file:
......
......@@ -5,8 +5,8 @@
<meta charset="UTF-8">
<title>CedarMaps - Basic Map Load with a Marker</title>
<script src='../dist/v2.0.0/cedarmaps.js'></script>
<link href='../dist/v2.0.0/cedarmaps.css' rel='stylesheet'/>
<script src='../dist/v2.1.1/cedarmaps.js'></script>
<link href='../dist/v2.1.1/cedarmaps.css' rel='stylesheet'/>
<script src='../access-token.js'></script>
<style>
......
......@@ -5,11 +5,11 @@
<meta charset="UTF-8">
<title>CedarMaps - Basic Map Load with a Marker</title>
<script src='../dist/v2.0.0/cedarmaps.js'></script>
<link href='../dist/v2.0.0/cedarmaps.css' rel='stylesheet'/>
<script src='../dist/v2.1.1/cedarmaps.js'></script>
<link href='../dist/v2.1.1/cedarmaps.css' rel='stylesheet'/>
<script src='../access-token.js'></script>
<style>
body {
margin: 0;
......
......@@ -5,8 +5,8 @@
<meta charset="UTF-8">
<title>CedarMaps - Simple Map Load</title>
<script src='../dist/v2.0.0/cedarmaps.js'></script>
<link href='../dist/v2.0.0/cedarmaps.css' rel='stylesheet'/>
<script src='../dist/v2.1.1/cedarmaps.js'></script>
<link href='../dist/v2.1.1/cedarmaps.css' rel='stylesheet'/>
<script src='../access-token.js'></script>
<style>
body {
......
......@@ -5,10 +5,9 @@
<meta charset="UTF-8">
<title>CedarMaps - Basic Map Load with a Marker</title>
<script src='../dist/v2.0.0/cedarmaps.js'></script>
<link href='../dist/v2.0.0/cedarmaps.css' rel='stylesheet'/>
<script src='../dist/v2.1.1/cedarmaps.js'></script>
<link href='../dist/v2.1.1/cedarmaps.css' rel='stylesheet'/>
<link href='./css/reverse-geocoder.css' rel='stylesheet'/>
<script src='../access-token.js'></script>
<style>
......
......@@ -2,7 +2,7 @@
"author": "CedarStudios",
"name": "cedarmaps.js",
"description": "CedarMaps javascript API built on top of mapbox.js",
"version": "2.0.0",
"version": "2.1.1",
"homepage": "http://www.cedarmaps.com/",
"repository": {
"type": "git",
......
......@@ -6,13 +6,13 @@ const styleMapper = {
'style://streets-light': 'https://api.cedarmaps.com/v1/styles/cedarmaps.light.json',
'style://streets-dark': 'https://api.cedarmaps.com/v1/styles/cedarmaps.dark.json'
}
mapboxGl.setRTLTextPlugin('https://api.cedarmaps.com/cedarmaps-gl.js/rtl-plugin.js');
const map = (accessToken, options) => {
const {style} = options
const cedarMapsStyle = styleMapper[style]
if (!style) throw Error('Invalid style provided')
mapboxGl.accessToken = ''
mapboxGl.setRTLTextPlugin('https://api.cedarmaps.com/cedarmaps-gl.js/rtl-plugin.js');
return new mapboxGl.Map({...options, style: `${cedarMapsStyle}?access_token=${accessToken}`})
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment