Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
mapbox-gl-controls
Advanced tools
npm install mapbox-gl-controls
Include styles from package: mapbox-gl-controls/lib/controls.css
import { RulerControl } from 'mapbox-gl-controls';
map.addControl(new RulerControl(), 'top-right');
map.on('ruler.on', () => console.log('ruler: on'));
map.on('ruler.off', () => console.log('ruler: off'));
// with miles:
map.addControl(new RulerControl({
units: 'miles',
labelFormat: n => `${n.toFixed(2)} ml`,
}), 'top-right');
Adds style switcher similar to Google Maps.
import { StylesControl } from 'mapbox-gl-controls';
// with default styles:
map.addControl(new StylesControl(), 'top-left');
// with custom styles:
map.addControl(new StylesControl({
styles: [
{
label: 'Streets',
styleName: 'Mapbox Streets',
styleUrl: 'mapbox://styles/mapbox/streets-v9',
}, {
label: 'Satellite',
styleName: 'Satellite',
styleUrl: 'mapbox://styles/mapbox/satellite-v9',
},
],
onChange: (style) => console.log(style),
}), 'top-left');
import { CompassControl } from 'mapbox-gl-controls';
map.addControl(new CompassControl(), 'top-right');
import { ZoomControl } from 'mapbox-gl-controls';
map.addControl(new ZoomControl(), 'top-right');
Localize map. Language can be set dynamically with .setLanguage(lang)
method.
import { LanguageControl } from 'mapbox-gl-controls';
// with browser detect:
map.addControl(new LanguageControl());
// with custom language:
const languageControl = new LanguageControl({
language: 'ru',
});
map.addControl(languageControl);
// change language to multi language after control has been added:
languageControl.setLanguage('mul');
Inspect control to debug style layers and source
import { InspectControl } from 'mapbox-gl-controls';
map.addControl(new InspectControl(), 'bottom-right');
Shows tooltip on hover on some layer or whole map.
import { TooltipControl } from 'mapbox-gl-controls';
map.addLayer({
id: '$fill',
type: 'fill',
source: { type: 'geojson', data: polygon },
paint: { 'fill-opacity': 0.3, 'fill-color': '#4264fb' },
});
map.addControl(new TooltipControl({ layer: '$fill' }));
FAQs
Controls for mapbox-gl
The npm package mapbox-gl-controls receives a total of 990 weekly downloads. As such, mapbox-gl-controls popularity was classified as not popular.
We found that mapbox-gl-controls demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.