Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mapbox-gl-controls

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mapbox-gl-controls - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

29

lib/styles.js

@@ -24,7 +24,9 @@ function _classCallCheck(instance, Constructor) {

var stylesDefault = [{
name: 'Streets',
url: 'mapbox://styles/mapbox/streets-v9'
label: 'Streets',
styleName: 'Mapbox Streets',
styleUrl: 'mapbox://styles/mapbox/streets-v9'
}, {
name: 'Satellite',
url: 'mapbox://styles/mapbox/satellite-v9'
label: 'Satellite',
styleName: 'Satellite',
styleUrl: 'mapbox://styles/mapbox/satellite-v9'
}];

@@ -53,7 +55,7 @@

var node = document.createElement('button');
node.textContent = style.name;
node.textContent = style.label;
node.addEventListener('click', function () {
if (node.classList.contains('-active')) return;
_this.map.setStyle(style.url);
_this.map.setStyle(style.styleUrl);
});

@@ -75,15 +77,10 @@

[].forEach.call(_this2.container.querySelectorAll('button'), function (div) {
return div.classList.remove('-active');
}); // remove GET params: ?optimize=true
div.classList.remove('-active');
});
var styleUrls = _this2.styles.map(function (style) {
if (typeof style.url === 'string') {
var styleUrlSplit = style.url.split('?');
return styleUrlSplit.length > 0 ? styleUrlSplit[0] : style.url;
}
return style.url;
var styleNames = _this2.styles.map(function (style) {
return style.styleName;
});
var currentStyleIndex = styleUrls.indexOf(_this2.map.getStyle().sprite.replace('sprites', 'styles'));
var currentStyleIndex = styleNames.indexOf(_this2.map.getStyle().name);

@@ -90,0 +87,0 @@ if (currentStyleIndex !== -1) {

{
"name": "mapbox-gl-controls",
"version": "1.1.1",
"version": "1.2.0",
"license": "MIT",

@@ -31,5 +31,5 @@ "homepage": "https://bravecow.github.io/mapbox-gl-controls/",

"peerDependencies": {
"mapbox-gl": "^0.54.0"
"mapbox-gl": "^0.54.0 <2.0.0"
},
"repository": "bravecow/mapbox-gl-controls"
}
const stylesDefault = [
{
name: 'Streets',
url: 'mapbox://styles/mapbox/streets-v9',
label: 'Streets',
styleName: 'Mapbox Streets',
styleUrl: 'mapbox://styles/mapbox/streets-v9',
}, {
name: 'Satellite',
url: 'mapbox://styles/mapbox/satellite-v9',
label: 'Satellite',
styleName: 'Satellite',
styleUrl: 'mapbox://styles/mapbox/satellite-v9',
},

@@ -24,6 +26,6 @@ ];

const node = document.createElement('button');
node.textContent = style.name;
node.textContent = style.label;
node.addEventListener('click', () => {
if (node.classList.contains('-active')) return;
this.map.setStyle(style.url);
this.map.setStyle(style.styleUrl);
});

@@ -39,12 +41,7 @@ this.nodes.push(node);

this.map.on('styledata', () => {
[].forEach.call(this.container.querySelectorAll('button'), div => div.classList.remove('-active'));
// remove GET params: ?optimize=true
const styleUrls = this.styles.map(style => {
if (typeof style.url === 'string') {
const styleUrlSplit = style.url.split('?');
return styleUrlSplit.length > 0 ? styleUrlSplit[0] : style.url;
}
return style.url;
[].forEach.call(this.container.querySelectorAll('button'), (div) => {
div.classList.remove('-active');
});
const currentStyleIndex = styleUrls.indexOf(this.map.getStyle().sprite.replace('sprites', 'styles'));
const styleNames = this.styles.map(style => style.styleName);
const currentStyleIndex = styleNames.indexOf(this.map.getStyle().name);
if (currentStyleIndex !== -1) {

@@ -51,0 +48,0 @@ const currentNode = this.nodes[currentStyleIndex];

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc