Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
L.Map.prototype.initialize.call(this, element, opts);
this._checkDeprecatedKey();
if (this.options._useTangram) {
var tangramOptions = opts.tangramOptions || {};
// debugTangram is deprecated; remove in v1.0
if (this.options.debugTangram) {
// tangramOptions = L.extend({}, tangramOptions, {debug: true});
console.warn('Mapzen.js warning: `options.debugTangram` is deprecated.');
}
// As of v1.0, scene will need to be part of tangramOptions
if (this.options.scene) {
tangramOptions = L.extend({}, tangramOptions, {scene: this.options.scene});
console.warn('Mapzen.js warning: `options.scene` is deprecated and will be removed in v1.0. Please use `options.tangramOptions.scene`.');
}
this._tangram = L.Nextzen._tangram(tangramOptions);
this._tangramLayer = this._tangram.addTo(this);
// tangramloaded event is deprecated; remove in v1.0
var self = this;
self._tangram.on('loaded', function (e) {
self.fire('tangramloaded', {
tangramLayer: e.layer,
tangramVersion: e.version
});
});
}
renderBoundingBox(rectangle, map) {
if (map) {
const shape = rectangle
// southwest longitude should not be greater than northeast
if (shape[0].lng > shape[1].lng) {
shape[1].lng += 360
}
const bounds = new L.LatLngBounds(...Array.from(shape || []))
const options = L.extend({}, L.Draw.Rectangle.prototype.options.shapeOptions, this._colorOptions)
const rect = new L.Rectangle(bounds, options)
rect.addTo(map)
map.panTo(L.latLngBounds(rect.getLatLngs()).getCenter())
this.setState({ drawnLayer: rect })
}
}
var L = require('leaflet');
var Geocoder = require('leaflet-control-geocoder');
var LRM = require('leaflet-routing-machine');
var locate = require('leaflet.locatecontrol');
var options = require('./lrm_options');
var links = require('./links');
var leafletOptions = require('./leaflet_options');
var ls = require('local-storage');
var tools = require('./tools');
var state = require('./state');
var localization = require('./localization');
require('./polyfill');
var parsedOptions = links.parse(window.location.search.slice(1));
var mergedOptions = L.extend(leafletOptions.defaultState, parsedOptions);
var local = localization.get(mergedOptions.language);
// load only after language was chosen
var itineraryBuilder = require('./itinerary_builder')(mergedOptions.language);
var mapLayer = leafletOptions.layer;
var overlay = leafletOptions.overlay;
var baselayer = ls.get('layer') ? mapLayer[0][ls.get('layer')] : mapLayer[0]['Mapbox Streets'];
var layers = ls.get('getOverlay') && [baselayer, overlay['Small Components']] || baselayer;
var map = L.map('map', {
zoomControl: true,
dragging: true,
layers: layers,
maxZoom: 18
}).setView(mergedOptions.center, mergedOptions.zoom);
onClick: function(e) {
if (this._map.clickLocked) {
return;
}
const marker = this.findMarkerFromMouseEvent(e);
if (marker) {
L.extend(e, {marker: marker});
this.fire('markerclick', e);
}
},
locate.init = function(conf) {
L.extend(locate.config, conf || {});
};
r: L.Browser.retina ? '@2x' : '',
s: this._getSubdomain(coords),
x: coords.x,
y: coords.y,
z: this._getZoomForUrl(),
};
data.bbox = geoTileToBbox(data);
if (this._map && !this._map.options.crs.infinite) {
const invertedY = this._globalTileRange.max.y - coords.y;
if (this.options.tms) {
data.y = invertedY;
}
data['-y'] = invertedY;
}
return L.Util.template(this._url, L.extend(data, this.options));
}
initialize: function(t) {
t.edit && (void 0 === t.edit.selectedPathOptions && (t.edit.selectedPathOptions = this.options.edit.selectedPathOptions), t.edit.selectedPathOptions = L.extend({}, this.options.edit.selectedPathOptions, t.edit.selectedPathOptions)), t.remove && (t.remove = L.extend({}, this.options.remove, t.remove)), t.poly && (t.poly = L.extend({}, this.options.poly, t.poly)), this._toolbarClass = "leaflet-draw-edit", L.Toolbar.prototype.initialize.call(this, t), this._selectedFeatureCount = 0
},
getModeHandlers: function(t) {
setShape: function(shape) {
this.options = L.extend({}, this.options, shape);
this._updateShape();
},
});
renderPolygon(polygon, featureGroup) {
if (featureGroup) {
const options = L.extend(
{},
L.Draw.Polygon.prototype.options.shapeOptions,
colorOptions
)
const poly = new L.SphericalPolygon(polygon, options)
poly.type = 'polygon'
poly.addTo(featureGroup)
this.setState({
drawnLayer: poly,
drawnLayerType: 'polygon'
})
this.setLayer(poly)
}
}
initialize: function(t) {
t.edit && (void 0 === t.edit.selectedPathOptions && (t.edit.selectedPathOptions = this.options.edit.selectedPathOptions), t.edit.selectedPathOptions = L.extend({}, this.options.edit.selectedPathOptions, t.edit.selectedPathOptions)), t.remove && (t.remove = L.extend({}, this.options.remove, t.remove)), t.poly && (t.poly = L.extend({}, this.options.poly, t.poly)), this._toolbarClass = "leaflet-draw-edit", L.Toolbar.prototype.initialize.call(this, t), this._selectedFeatureCount = 0
},
getModeHandlers: function(t) {