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

leaflet

Package Overview
Dependencies
Maintainers
5
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

leaflet - npm Package Compare versions

Comparing version 1.9.3 to 1.9.4

2

package.json
{
"name": "leaflet",
"version": "1.9.3",
"version": "1.9.4",
"homepage": "https://leafletjs.com/",

@@ -5,0 +5,0 @@ "description": "JavaScript library for mobile-friendly interactive maps",

@@ -86,2 +86,3 @@

this._handlingClick = false;
this._preventClick = false;

@@ -362,2 +363,7 @@ for (var i in baseLayers) {

_onInputClick: function () {
// expanding the control on mobile with a click can cause adding a layer - we don't want this
if (this._preventClick) {
return;
}
var inputs = this._layerControlInputs,

@@ -422,6 +428,9 @@ input, layer;

var section = this._section;
this._preventClick = true;
DomEvent.on(section, 'click', DomEvent.preventDefault);
this.expand();
var that = this;
setTimeout(function () {
DomEvent.off(section, 'click', DomEvent.preventDefault);
that._preventClick = false;
});

@@ -428,0 +437,0 @@ }

@@ -313,4 +313,4 @@ import * as DomEvent from './DomEvent';

_outlineElement = element;
_outlineStyle = element.style.outline;
element.style.outline = 'none';
_outlineStyle = element.style.outlineStyle;
element.style.outlineStyle = 'none';
DomEvent.on(window, 'keydown', restoreOutline);

@@ -323,3 +323,3 @@ }

if (!_outlineElement) { return; }
_outlineElement.style.outline = _outlineStyle;
_outlineElement.style.outlineStyle = _outlineStyle;
_outlineElement = undefined;

@@ -326,0 +326,0 @@ _outlineStyle = undefined;

@@ -205,4 +205,8 @@ import {Evented} from '../core/Events';

if (this._moved && this._moving) {
var fireDragend = this._moved && this._moving;
this._moving = false;
Draggable._dragging = false;
if (fireDragend) {
// @event dragend: DragEndEvent

@@ -215,7 +219,4 @@ // Fired when the drag ends.

}
this._moving = false;
Draggable._dragging = false;
}
});
import {Point, toPoint} from './Point';
import * as Util from '../core/Util';
import {toLatLng} from '../geo/LatLng';
import {centroid} from './PolyUtil';
import {toLatLngBounds} from '../geo/LatLngBounds';

@@ -260,9 +262,19 @@

var centroidLatLng = toLatLng([0, 0]);
var bounds = toLatLngBounds(latlngs);
var areaBounds = bounds.getNorthWest().distanceTo(bounds.getSouthWest()) * bounds.getNorthEast().distanceTo(bounds.getNorthWest());
// tests showed that below 1700 rounding errors are happening
if (areaBounds < 1700) {
// getting a inexact center, to move the latlngs near to [0, 0] to prevent rounding errors
centroidLatLng = centroid(latlngs);
}
var len = latlngs.length;
var points = [];
for (var j in latlngs) {
points.push(crs.project(toLatLng(latlngs[j])));
for (i = 0; i < len; i++) {
var latlng = toLatLng(latlngs[i]);
points.push(crs.project(toLatLng([latlng.lat - centroidLatLng.lat, latlng.lng - centroidLatLng.lng])));
}
var len = points.length;
for (i = 0, halfDist = 0; i < len - 1; i++) {

@@ -292,3 +304,5 @@ halfDist += points[i].distanceTo(points[i + 1]) / 2;

}
return crs.unproject(toPoint(center));
var latlngCenter = crs.unproject(toPoint(center));
return toLatLng([latlngCenter.lat + centroidLatLng.lat, latlngCenter.lng + centroidLatLng.lng]);
}
import * as LineUtil from './LineUtil';
import {toLatLng} from '../geo/LatLng';
import {toPoint} from './Point';
import {toLatLngBounds} from '../geo/LatLngBounds';
/*

@@ -58,3 +59,3 @@ * @namespace PolyUtil

/* @function polygonCenter(latlngs: LatLng[] crs: CRS): LatLng
/* @function polygonCenter(latlngs: LatLng[], crs: CRS): LatLng
* Returns the center ([centroid](http://en.wikipedia.org/wiki/Centroid)) of the passed LatLngs (first ring) from a polygon.

@@ -74,8 +75,19 @@ */

var centroidLatLng = toLatLng([0, 0]);
var bounds = toLatLngBounds(latlngs);
var areaBounds = bounds.getNorthWest().distanceTo(bounds.getSouthWest()) * bounds.getNorthEast().distanceTo(bounds.getNorthWest());
// tests showed that below 1700 rounding errors are happening
if (areaBounds < 1700) {
// getting a inexact center, to move the latlngs near to [0, 0] to prevent rounding errors
centroidLatLng = centroid(latlngs);
}
var len = latlngs.length;
var points = [];
for (var k in latlngs) {
points.push(crs.project(toLatLng(latlngs[k])));
for (i = 0; i < len; i++) {
var latlng = toLatLng(latlngs[i]);
points.push(crs.project(toLatLng([latlng.lat - centroidLatLng.lat, latlng.lng - centroidLatLng.lng])));
}
var len = points.length;
area = x = y = 0;

@@ -100,3 +112,21 @@

}
return crs.unproject(toPoint(center));
var latlngCenter = crs.unproject(toPoint(center));
return toLatLng([latlngCenter.lat + centroidLatLng.lat, latlngCenter.lng + centroidLatLng.lng]);
}
/* @function centroid(latlngs: LatLng[]): LatLng
* Returns the 'center of mass' of the passed LatLngs.
*/
export function centroid(coords) {
var latSum = 0;
var lngSum = 0;
var len = 0;
for (var i = 0; i < coords.length; i++) {
var latlng = toLatLng(coords[i]);
latSum += latlng.lat;
lngSum += latlng.lng;
len++;
}
return toLatLng([latSum / len, lngSum / len]);
}

@@ -291,3 +291,3 @@ import {LayerGroup} from './LayerGroup';

if (!levelsDeep && closed) {
if (!levelsDeep && closed && coords.length > 0) {
coords.push(coords[0].slice());

@@ -294,0 +294,0 @@ }

@@ -396,3 +396,3 @@ import {DivOverlay} from './DivOverlay';

_addFocusListenersOnLayer: function (layer) {
var el = layer.getElement();
var el = typeof layer.getElement === 'function' && layer.getElement();
if (el) {

@@ -408,3 +408,3 @@ DomEvent.on(el, 'focus', function () {

_setAriaDescribedByOnLayer: function (layer) {
var el = layer.getElement();
var el = typeof layer.getElement === 'function' && layer.getElement();
if (el) {

@@ -417,5 +417,17 @@ el.setAttribute('aria-describedby', this._tooltip._container.id);

_openTooltip: function (e) {
if (!this._tooltip || !this._map || (this._map.dragging && this._map.dragging.moving())) {
if (!this._tooltip || !this._map) {
return;
}
// If the map is moving, we will show the tooltip after it's done.
if (this._map.dragging && this._map.dragging.moving() && !this._openOnceFlag) {
this._openOnceFlag = true;
var that = this;
this._map.once('moveend', function () {
that._openOnceFlag = false;
that._openTooltip(e);
});
return;
}
this._tooltip._source = e.layer || e.target;

@@ -422,0 +434,0 @@

@@ -50,5 +50,4 @@ import {Layer} from '../Layer';

if (this._zoomAnimated) {
DomUtil.addClass(this._container, 'leaflet-zoom-animated');
}
// always keep transform-origin as 0 0
DomUtil.addClass(this._container, 'leaflet-zoom-animated');
}

@@ -55,0 +54,0 @@

@@ -1678,3 +1678,3 @@ import * as Util from '../core/Util';

this
._moveStart(true, false)
._moveStart(true, options.noMoveStart || false)
._animateZoom(center, zoom, true);

@@ -1681,0 +1681,0 @@ }, this);

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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