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.6.1 to 1.6.2

57

lib/around.js

@@ -34,5 +34,3 @@ function _classCallCheck(instance, Constructor) {

var AroundControl =
/*#__PURE__*/
function () {
var AroundControl = /*#__PURE__*/function () {
function AroundControl() {

@@ -46,2 +44,5 @@ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

this.onClick = this.onClick.bind(this);
this.isActive = false;
this.beforeZoom = null;
this.beforeCenter = null;
}

@@ -64,14 +65,5 @@

value: function onAdd(map) {
var _this = this;
this.map = map;
this.insertControls();
this.button.addEventListener('click', this.onClick);
this.map.on('pitchend', function () {
if (_this.map.getPitch() > 30) {
_this.container.classList.add('-active');
} else {
_this.container.classList.remove('-active');
}
});
return this.container;

@@ -82,24 +74,34 @@ }

value: function onClick() {
this.isActive = !this.isActive;
var duration = 600;
var on = {
bearing: -40,
pitch: 60,
center: this.center,
var options = {
duration: duration
};
var off = {
bearing: 0,
pitch: 0,
duration: duration
};
if (this.minZoom && this.minZoom > this.map.getZoom()) {
on.zoom = this.minZoom;
if (this.minZoom) {
options.zoom = this.minZoom;
}
if (this.map.getPitch() > 30) {
this.map.easeTo(off);
if (this.isActive) {
this.beforeZoom = this.map.getZoom();
this.beforeCenter = this.map.getCenter();
this.container.classList.add('-active');
options = Object.assign(options, {
bearing: -40,
pitch: 60,
center: this.center
});
} else {
this.map.easeTo(on);
options = Object.assign(options, {
bearing: 0,
pitch: 0
});
options.zoom = this.beforeZoom;
options.center = this.beforeCenter;
this.beforeZoom = null;
this.beforeCenter = null;
this.container.classList.remove('-active');
}
this.map.easeTo(options);
}

@@ -111,2 +113,5 @@ }, {

this.map = undefined;
this.isActive = false;
this.beforeZoom = null;
this.beforeCenter = null;
}

@@ -113,0 +118,0 @@ }]);

@@ -33,5 +33,3 @@ function _classCallCheck(instance, Constructor) {

var CompassControl =
/*#__PURE__*/
function () {
var CompassControl = /*#__PURE__*/function () {
function CompassControl() {

@@ -38,0 +36,0 @@ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

@@ -152,5 +152,3 @@ function _classCallCheck(instance, Constructor) {

var InspectControl =
/*#__PURE__*/
function () {
var InspectControl = /*#__PURE__*/function () {
function InspectControl() {

@@ -157,0 +155,0 @@ _classCallCheck(this, InspectControl);

@@ -106,5 +106,3 @@ function _classCallCheck(instance, Constructor) {

var LanguageControl =
/*#__PURE__*/
function () {
var LanguageControl = /*#__PURE__*/function () {
function LanguageControl() {

@@ -111,0 +109,0 @@ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

@@ -88,5 +88,3 @@ import mapboxgl from 'mapbox-gl';

var RulerControl =
/*#__PURE__*/
function () {
var RulerControl = /*#__PURE__*/function () {
function RulerControl() {

@@ -93,0 +91,0 @@ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

@@ -42,5 +42,3 @@ function _classCallCheck(instance, Constructor) {

var StylesControl =
/*#__PURE__*/
function () {
var StylesControl = /*#__PURE__*/function () {
function StylesControl() {

@@ -47,0 +45,0 @@ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

@@ -39,5 +39,3 @@ function _classCallCheck(instance, Constructor) {

var TooltipControl =
/*#__PURE__*/
function () {
var TooltipControl = /*#__PURE__*/function () {
function TooltipControl() {

@@ -44,0 +42,0 @@ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

@@ -35,5 +35,3 @@ function _classCallCheck(instance, Constructor) {

var ZoomControl =
/*#__PURE__*/
function () {
var ZoomControl = /*#__PURE__*/function () {
function ZoomControl() {

@@ -40,0 +38,0 @@ _classCallCheck(this, ZoomControl);

{
"name": "mapbox-gl-controls",
"version": "1.6.1",
"version": "1.6.2",
"main": "./lib/index.js",

@@ -14,9 +14,9 @@ "description": "Controls for mapbox-gl",

"devDependencies": {
"@babel/core": "^7.8.4",
"@babel/preset-env": "^7.8.4",
"@babel/core": "^7.8.7",
"@babel/preset-env": "^7.8.7",
"documentation": "^12.1.4",
"eslint": "^6.8.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-config-airbnb-base": "^14.1.0",
"eslint-plugin-import": "^2.20.1",
"mapbox-gl": "^1.7.0",
"mapbox-gl": "^1.8.1",
"postcss-cli": "^7.1.0",

@@ -26,3 +26,3 @@ "postcss-import": "^12.0.1",

"rollup": "^1.31.0",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-babel": "^4.4.0",
"@rollup/plugin-commonjs": "^11.0.2",

@@ -29,0 +29,0 @@ "@rollup/plugin-node-resolve": "^7.1.1",

@@ -15,2 +15,5 @@ import icon3D from './icon-3d.svg';

this.onClick = this.onClick.bind(this);
this.isActive = false;
this.beforeZoom = null;
this.beforeCenter = null;
}

@@ -33,9 +36,2 @@

this.button.addEventListener('click', this.onClick);
this.map.on('pitchend', () => {
if (this.map.getPitch() > 30) {
this.container.classList.add('-active');
} else {
this.container.classList.remove('-active');
}
});
return this.container;

@@ -45,20 +41,30 @@ }

onClick() {
this.isActive = !this.isActive;
const duration = 600;
const on = {
bearing: -40,
pitch: 60,
center: this.center,
duration,
};
const off = { bearing: 0, pitch: 0, duration };
if (this.minZoom && this.minZoom > this.map.getZoom()) {
on.zoom = this.minZoom;
let options = { duration };
if (this.minZoom) {
options.zoom = this.minZoom;
}
if (this.map.getPitch() > 30) {
this.map.easeTo(off);
if (this.isActive) {
this.beforeZoom = this.map.getZoom();
this.beforeCenter = this.map.getCenter();
this.container.classList.add('-active');
options = Object.assign(options, {
bearing: -40,
pitch: 60,
center: this.center,
});
} else {
this.map.easeTo(on);
options = Object.assign(options, {
bearing: 0, pitch: 0,
});
options.zoom = this.beforeZoom;
options.center = this.beforeCenter;
this.beforeZoom = null;
this.beforeCenter = null;
this.container.classList.remove('-active');
}
this.map.easeTo(options);
}

@@ -69,3 +75,6 @@

this.map = undefined;
this.isActive = false;
this.beforeZoom = null;
this.beforeCenter = null;
}
}
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