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 2.3.4 to 2.3.5

1

lib/RulerControl/RulerControl.d.ts

@@ -53,2 +53,3 @@ import { Marker } from 'mapbox-gl';

mapClickListener(event: any): void;
updateSource(): void;
updateLabels(): void;

@@ -55,0 +56,0 @@ getMarkerNode(): HTMLDivElement;

19

lib/RulerControl/RulerControl.js

@@ -115,4 +115,2 @@ import mapboxgl from 'mapbox-gl';

const markerNode = this.getMarkerNode();
const lineSource = this.map.getSource(SOURCE_LINE);
const symbolSource = this.map.getSource(SOURCE_SYMBOL);
const marker = new mapboxgl.Marker({ element: markerNode, draggable: true })

@@ -123,7 +121,6 @@ .setLngLat(event.lngLat)

this.coordinates.push(newCoordinate);
this.map.fire('ruler.change', { coordinates: this.coordinates });
this.updateLabels();
lineSource.setData(lineStringFeature(this.coordinates));
symbolSource.setData(pointFeatureCollection(this.coordinates, this.labels));
this.updateSource();
this.markers.push(marker);
this.map.fire('ruler.change', { coordinates: this.coordinates });
marker.on('drag', () => {

@@ -134,6 +131,14 @@ const index = this.markers.indexOf(marker);

this.updateLabels();
lineSource.setData(lineStringFeature(this.coordinates));
symbolSource.setData(pointFeatureCollection(this.coordinates, this.labels));
this.updateSource();
});
marker.on('dragend', () => {
this.map.fire('ruler.change', { coordinates: this.coordinates });
});
}
updateSource() {
const lineSource = this.map.getSource(SOURCE_LINE);
const symbolSource = this.map.getSource(SOURCE_SYMBOL);
lineSource.setData(lineStringFeature(this.coordinates));
symbolSource.setData(pointFeatureCollection(this.coordinates, this.labels));
}
updateLabels() {

@@ -140,0 +145,0 @@ const { coordinates, units, labelFormat } = this;

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

@@ -5,0 +5,0 @@ "description": "Controls for mapbox-gl",

@@ -167,4 +167,3 @@ import mapboxgl, { GeoJSONSource, Marker } from 'mapbox-gl';

const markerNode = this.getMarkerNode();
const lineSource = this.map.getSource(SOURCE_LINE) as GeoJSONSource;
const symbolSource = this.map.getSource(SOURCE_SYMBOL) as GeoJSONSource;
const marker = new mapboxgl.Marker({ element: markerNode, draggable: true })

@@ -174,9 +173,7 @@ .setLngLat(event.lngLat)

const newCoordinate = [event.lngLat.lng, event.lngLat.lat];
this.coordinates.push(newCoordinate);
this.map.fire('ruler.change', { coordinates: this.coordinates });
this.updateLabels();
lineSource.setData(lineStringFeature(this.coordinates));
symbolSource.setData(pointFeatureCollection(this.coordinates, this.labels));
this.updateSource();
this.markers.push(marker);
this.map.fire('ruler.change', { coordinates: this.coordinates });

@@ -188,7 +185,17 @@ marker.on('drag', () => {

this.updateLabels();
lineSource.setData(lineStringFeature(this.coordinates));
symbolSource.setData(pointFeatureCollection(this.coordinates, this.labels));
this.updateSource();
});
marker.on('dragend', () => {
this.map.fire('ruler.change', { coordinates: this.coordinates });
});
}
updateSource() {
const lineSource = this.map.getSource(SOURCE_LINE) as GeoJSONSource;
const symbolSource = this.map.getSource(SOURCE_SYMBOL) as GeoJSONSource;
lineSource.setData(lineStringFeature(this.coordinates));
symbolSource.setData(pointFeatureCollection(this.coordinates, this.labels));
}
updateLabels() {

@@ -195,0 +202,0 @@ const { coordinates, units, labelFormat } = this;

Sorry, the diff of this file is not supported yet

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