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 ...@@ -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. Recommended usage is via the CedarMaps CDN. Just include CSS and JavaScript files in `<head>` section of your HTML file.
```html ```html
<script src='https://api.cedarmaps.com/cedarmaps-gl.js/v2.0.0/cedarmaps.js'></script> <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.0.0/cedarmaps.css' rel='stylesheet'/> <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: and put the following code in the `<body>` of your HTML file:
...@@ -91,4 +91,4 @@ Mapbox GL object ...@@ -91,4 +91,4 @@ Mapbox GL object
## api ## api
CedarMaps API. please see [cedarmaps npm package](https://www.npmjs.com/package/cedar-maps) for more information CedarMaps API. please see [cedarmaps npm package](https://www.npmjs.com/package/cedar-maps) for more information
\ No newline at end of file
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>CedarMaps - Basic Map Load with a Marker</title> <title>CedarMaps - Basic Map Load with a Marker</title>
<script src='../dist/v2.0.0/cedarmaps.js'></script> <script src='../dist/v2.1.1/cedarmaps.js'></script>
<link href='../dist/v2.0.0/cedarmaps.css' rel='stylesheet'/> <link href='../dist/v2.1.1/cedarmaps.css' rel='stylesheet'/>
<script src='../access-token.js'></script> <script src='../access-token.js'></script>
<style> <style>
...@@ -64,4 +64,4 @@ ...@@ -64,4 +64,4 @@
</script> </script>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -5,11 +5,11 @@ ...@@ -5,11 +5,11 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>CedarMaps - Basic Map Load with a Marker</title> <title>CedarMaps - Basic Map Load with a Marker</title>
<script src='../dist/v2.0.0/cedarmaps.js'></script> <script src='../dist/v2.1.1/cedarmaps.js'></script>
<link href='../dist/v2.0.0/cedarmaps.css' rel='stylesheet'/> <link href='../dist/v2.1.1/cedarmaps.css' rel='stylesheet'/>
<script src='../access-token.js'></script> <script src='../access-token.js'></script>
<style> <style>
body { body {
margin: 0; margin: 0;
...@@ -65,4 +65,4 @@ ...@@ -65,4 +65,4 @@
</script> </script>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>CedarMaps - Simple Map Load</title> <title>CedarMaps - Simple Map Load</title>
<script src='../dist/v2.0.0/cedarmaps.js'></script> <script src='../dist/v2.1.1/cedarmaps.js'></script>
<link href='../dist/v2.0.0/cedarmaps.css' rel='stylesheet'/> <link href='../dist/v2.1.1/cedarmaps.css' rel='stylesheet'/>
<script src='../access-token.js'></script> <script src='../access-token.js'></script>
<style> <style>
body { body {
...@@ -86,4 +86,4 @@ ...@@ -86,4 +86,4 @@
</script> </script>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -5,10 +5,9 @@ ...@@ -5,10 +5,9 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>CedarMaps - Basic Map Load with a Marker</title> <title>CedarMaps - Basic Map Load with a Marker</title>
<script src='../dist/v2.0.0/cedarmaps.js'></script> <script src='../dist/v2.1.1/cedarmaps.js'></script>
<link href='../dist/v2.0.0/cedarmaps.css' rel='stylesheet'/> <link href='../dist/v2.1.1/cedarmaps.css' rel='stylesheet'/>
<link href='./css/reverse-geocoder.css' rel='stylesheet'/> <link href='./css/reverse-geocoder.css' rel='stylesheet'/>
<script src='../access-token.js'></script> <script src='../access-token.js'></script>
<style> <style>
...@@ -119,4 +118,4 @@ ...@@ -119,4 +118,4 @@
</script> </script>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"author": "CedarStudios", "author": "CedarStudios",
"name": "cedarmaps.js", "name": "cedarmaps.js",
"description": "CedarMaps javascript API built on top of mapbox.js", "description": "CedarMaps javascript API built on top of mapbox.js",
"version": "2.0.0", "version": "2.1.1",
"homepage": "http://www.cedarmaps.com/", "homepage": "http://www.cedarmaps.com/",
"repository": { "repository": {
"type": "git", "type": "git",
......
...@@ -6,13 +6,13 @@ const styleMapper = { ...@@ -6,13 +6,13 @@ const styleMapper = {
'style://streets-light': 'https://api.cedarmaps.com/v1/styles/cedarmaps.light.json', 'style://streets-light': 'https://api.cedarmaps.com/v1/styles/cedarmaps.light.json',
'style://streets-dark': 'https://api.cedarmaps.com/v1/styles/cedarmaps.dark.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 map = (accessToken, options) => {
const {style} = options const {style} = options
const cedarMapsStyle = styleMapper[style] const cedarMapsStyle = styleMapper[style]
if (!style) throw Error('Invalid style provided') if (!style) throw Error('Invalid style provided')
mapboxGl.accessToken = '' mapboxGl.accessToken = ''
mapboxGl.setRTLTextPlugin('https://api.cedarmaps.com/cedarmaps-gl.js/rtl-plugin.js');
return new mapboxGl.Map({...options, style: `${cedarMapsStyle}?access_token=${accessToken}`}) return new mapboxGl.Map({...options, style: `${cedarMapsStyle}?access_token=${accessToken}`})
} }
...@@ -20,4 +20,4 @@ module.exports = { ...@@ -20,4 +20,4 @@ module.exports = {
map, map,
gl: mapboxGl, gl: mapboxGl,
api: cedarMapsMethods api: cedarMapsMethods
} }
\ No newline at end of file
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