New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mapbox-gl

Package Overview
Dependencies
Maintainers
45
Versions
235
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mapbox-gl - npm Package Compare versions

Comparing version 0.11.0 to 0.11.1

.eslintrc

18

CHANGELOG.md

@@ -5,2 +5,20 @@ ## dev

## 0.11.1 (Sep 30 2015)
#### Bugfixes
* Add statistics and checkboxes to debug page
* Fix `Map#featuresAt` for non-4096 vector sources (#1529)
* Don't fire `mousemove` on drag-pan
* Fix maxBounds constrains (#1539)
* Fix maxBounds infinite loop (#1538)
* Fix memory leak in worker
* Assert valid `TileCoord`, fix wrap calculation in `TileCoord#cover` (#1483)
* Abort raster tile load if not in viewport (#1490)
#### API Improvements
* Add `Map` event listeners for `mouseup`, `contextmenu` (right click) (#1532)
## 0.11.0 (Sep 11 2015)

@@ -7,0 +25,0 @@

1

js/data/buffer/circle_vertex_buffer.js

@@ -11,2 +11,3 @@ 'use strict';

* including their centerpoint
* @private
*/

@@ -13,0 +14,0 @@ function CircleVertexBuffer(buffer) {

@@ -14,2 +14,3 @@ 'use strict';

* vector that is where it points.
* @private
*/

@@ -16,0 +17,0 @@ function CircleBucket(buffers) {

39

js/data/feature_tree.js

@@ -42,6 +42,5 @@ 'use strict';

// a point (or point+radius) query
radius = (params.radius || 0) * 4096 / args.scale;
radius = (params.radius || 0) * (args.tileExtent || 4096) / args.scale;
bounds = [x - radius, y - radius, x + radius, y + radius];
}
else {
} else {
// a rectangle query

@@ -91,7 +90,7 @@ bounds = [ args.minX, args.minY, args.maxX, args.maxY ];

function polyIntersectsBox(rings, bounds) {
if (polyContainsPoint(rings, new Point(bounds[0], bounds[1]))
|| polyContainsPoint(rings, new Point(bounds[0], bounds[3]))
|| polyContainsPoint(rings, new Point(bounds[2], bounds[1]))
|| polyContainsPoint(rings, new Point(bounds[2], bounds[3])))
return true;
if (polyContainsPoint(rings, new Point(bounds[0], bounds[1])) ||
polyContainsPoint(rings, new Point(bounds[0], bounds[3])) ||
polyContainsPoint(rings, new Point(bounds[2], bounds[1])) ||
polyContainsPoint(rings, new Point(bounds[2], bounds[3])))
return true;

@@ -115,7 +114,7 @@ return lineIntersectsBox(rings, bounds);

if (segmentCrossesHorizontal(p0, p1, bounds[0], bounds[2], bounds[1])
|| segmentCrossesHorizontal(p0, p1, bounds[0], bounds[2], bounds[3])
|| segmentCrossesHorizontal(i0, i1, bounds[1], bounds[3], bounds[0])
|| segmentCrossesHorizontal(i0, i1, bounds[1], bounds[3], bounds[2]))
return true;
if (segmentCrossesHorizontal(p0, p1, bounds[0], bounds[2], bounds[1]) ||
segmentCrossesHorizontal(p0, p1, bounds[0], bounds[2], bounds[3]) ||
segmentCrossesHorizontal(i0, i1, bounds[1], bounds[3], bounds[0]) ||
segmentCrossesHorizontal(i0, i1, bounds[1], bounds[3], bounds[2]))
return true;
}

@@ -133,5 +132,5 @@ }

if (p1.y === p0.y)
return (p1.y === y
&& Math.min(p0.x, p1.x) <= x2
&& Math.max(p0.x, p1.x) >= x1);
return p1.y === y &&
Math.min(p0.x, p1.x) <= x2 &&
Math.max(p0.x, p1.x) >= x1;

@@ -147,6 +146,6 @@ var r = (y - p0.y) / (p1.y - p0.y);

for (var j = 0; j < ring.length; j++) {
if (ring[j].x >= bounds[0]
&& ring[j].y >= bounds[1]
&& ring[j].x <= bounds[2]
&& ring[j].y <= bounds[3]) return true;
if (ring[j].x >= bounds[0] &&
ring[j].y >= bounds[1] &&
ring[j].x <= bounds[2] &&
ring[j].y <= bounds[3]) return true;
}

@@ -153,0 +152,0 @@ }

@@ -48,25 +48,25 @@ 'use strict';

switch (layout['text-anchor']) {
case 'right':
case 'top-right':
case 'bottom-right':
horizontalAlign = 1;
break;
case 'left':
case 'top-left':
case 'bottom-left':
horizontalAlign = 0;
break;
case 'right':
case 'top-right':
case 'bottom-right':
horizontalAlign = 1;
break;
case 'left':
case 'top-left':
case 'bottom-left':
horizontalAlign = 0;
break;
}
switch (layout['text-anchor']) {
case 'bottom':
case 'bottom-right':
case 'bottom-left':
verticalAlign = 1;
break;
case 'top':
case 'top-right':
case 'top-left':
verticalAlign = 0;
break;
case 'bottom':
case 'bottom-right':
case 'bottom-left':
verticalAlign = 1;
break;
case 'top':
case 'top-right':
case 'top-left':
verticalAlign = 0;
break;
}

@@ -73,0 +73,0 @@

@@ -94,2 +94,8 @@ 'use strict';

get center() { return this._center; },
set center(center) {
this._center = center;
this._constrain();
},
zoomScale: function(zoom) { return Math.pow(2, zoom); },

@@ -148,3 +154,2 @@ scaleZoom: function(scale) { return Math.log(scale) / Math.LN2; },

this.center = this.pointLocation(point);
this._constrain();
},

@@ -159,4 +164,2 @@

this.center = this.coordinateLocation(coordCenter._sub(translate));
this._constrain();
},

@@ -236,3 +239,3 @@

if (!inverted) throw "failed to invert matrix";
if (!inverted) throw new Error("failed to invert matrix");

@@ -297,4 +300,6 @@ // since we don't know the correct projected z value for the point,

_constrain: function() {
if (!this.center) return;
if (!this.center || !this.width || !this.height || this._constraining) return;
this._constraining = true;
var minY, maxY, minX, maxX, sy, sx, x2, y2,

@@ -323,2 +328,3 @@ size = this.size;

this.zoom += this.scaleZoom(s);
this._constraining = false;
return;

@@ -349,2 +355,4 @@ }

}
this._constraining = false;
},

@@ -351,0 +359,0 @@

@@ -48,3 +48,3 @@ 'use strict';

scale * transform.width / 2,
-scale * transform.height / 2
-scale * transform.height / 2
]);

@@ -64,3 +64,3 @@

scale * transform.width / 2,
-scale * transform.height / 2
-scale * transform.height / 2
]);

@@ -67,0 +67,0 @@

@@ -66,2 +66,3 @@ 'use strict';

* may be outside the tile, because raster tiles aren't clipped when rendering.
* @private
*/

@@ -111,2 +112,6 @@ createTile: function() {

reload: function() {
// noop
},
render: function(layers, painter) {

@@ -139,2 +144,3 @@ if (!this._loaded || !this.loaded()) return;

* be selectable, so always return an empty array.
* @private
*/

@@ -141,0 +147,0 @@ featuresAt: function(point, params, callback) {

@@ -45,3 +45,9 @@ 'use strict';

_loadTile: function(tile) {
ajax.getImage(normalizeURL(tile.coord.url(this.tiles), this.url), function(err, img) {
var url = normalizeURL(tile.coord.url(this.tiles), this.url);
tile.request = ajax.getImage(url, done.bind(this));
function done(err, img) {
delete tile.request;
if (tile.aborted)

@@ -79,3 +85,3 @@ return;

this.fire('tile.load', {tile: tile});
}.bind(this));
}
},

@@ -85,2 +91,7 @@

tile.aborted = true;
if (tile.request) {
tile.request.abort();
delete tile.request;
}
},

@@ -87,0 +98,0 @@

@@ -83,2 +83,3 @@ 'use strict';

y: result.y,
tileExtent: result.tile.tileExtent,
scale: result.scale,

@@ -85,0 +86,0 @@ source: this.id,

'use strict';
var assert = require('assert');
module.exports = TileCoord;
function TileCoord(z, x, y, w) {
if (w === undefined) w = 0;
this.z = z;
this.x = x;
this.y = y;
this.w = w;
assert(!isNaN(z));
assert(!isNaN(x));
assert(!isNaN(y));
assert(z >= 0);
assert(x >= 0);
assert(y >= 0);
if (isNaN(w)) w = 0;
this.z = +z;
this.x = +x;
this.y = +y;
this.w = +w;
// calculate id

@@ -138,7 +148,7 @@ w *= 2;

function scanLine(x0, x1, y) {
var x, wx;
var x, wx, coord;
if (y >= 0 && y <= tiles) {
for (x = x0; x < x1; x++) {
wx = (x + tiles) % tiles;
var coord = new TileCoord(actualZ, wx, y, Math.floor(x / tiles));
wx = (x % tiles + tiles) % tiles;
coord = new TileCoord(actualZ, wx, y, Math.floor(x / tiles));
t[coord.id] = coord;

@@ -145,0 +155,0 @@ }

@@ -332,3 +332,3 @@ 'use strict';

var pos = tile.positionAt(coord, this.maxzoom);
if (pos && pos.x >= 0 && pos.x < 4096 && pos.y >= 0 && pos.y < 4096) {
if (pos && pos.x >= 0 && pos.x < tile.tileExtent && pos.y >= 0 && pos.y < tile.tileExtent) {
// The click is within the viewport. There is only ever one tile in

@@ -349,3 +349,3 @@ // a layer that has this property.

* cover the given bounds.
* @param {Array<Coordinate>} [minxminy, maxxmaxy] coordinates of the corners of bounding rectangle
* @param {Array<Coordinate>} bounds [minxminy, maxxmaxy] coordinates of the corners of bounding rectangle
* @returns {Array<Object>} result items have {tile, minX, maxX, minY, maxY}, where min/max bounding values are the given bounds transformed in into the coordinate space of this tile.

@@ -361,14 +361,14 @@ * @private

var tileSpaceBounds = [
tile.positionAt(bounds[0], this.maxzoom),
tile.positionAt(bounds[1], this.maxzoom)
tile.positionAt(bounds[0], this.maxzoom),
tile.positionAt(bounds[1], this.maxzoom)
];
if (tileSpaceBounds[0].x < 4096 && tileSpaceBounds[0].y < 4096
&& tileSpaceBounds[1].x >= 0 && tileSpaceBounds[1].y >= 0) {
result.push({
tile: tile,
minX: tileSpaceBounds[0].x,
maxX: tileSpaceBounds[1].x,
minY: tileSpaceBounds[0].y,
maxY: tileSpaceBounds[1].y
});
if (tileSpaceBounds[0].x < tile.tileExtent && tileSpaceBounds[0].y < tile.tileExtent &&
tileSpaceBounds[1].x >= 0 && tileSpaceBounds[1].y >= 0) {
result.push({
tile: tile,
minX: tileSpaceBounds[0].x,
maxX: tileSpaceBounds[1].x,
minY: tileSpaceBounds[0].y,
maxY: tileSpaceBounds[1].y
});
}

@@ -375,0 +375,0 @@ }

@@ -80,4 +80,4 @@ 'use strict';

return {
x: (coord.column - this.coord.x) * 4096,
y: (coord.row - this.coord.y) * 4096,
x: (coord.column - this.coord.x) * this.tileExtent,
y: (coord.row - this.coord.y) * this.tileExtent,
scale: this.scale

@@ -84,0 +84,0 @@ };

@@ -102,2 +102,3 @@ 'use strict';

this.fire('tile.load', {tile: tile});
this.fire('tile.stats', data.bucketStats);
},

@@ -104,0 +105,0 @@

@@ -187,2 +187,3 @@ 'use strict';

}
bucket.features = null;
}

@@ -229,3 +230,4 @@

buffers: buffers,
extent: extent
extent: extent,
bucketStats: typeof self !== 'undefined' ? self.bucketStats : null
}, transferables);

@@ -232,0 +234,0 @@ }

@@ -0,1 +1,2 @@

'use strict';
module.exports = require('mapbox-gl-style-spec/reference/latest');

@@ -126,6 +126,6 @@ 'use strict';

if (minzoom != null) {
layer.minzoom = minzoom;
layer.minzoom = minzoom;
}
if (maxzoom != null) {
layer.maxzoom = maxzoom;
layer.maxzoom = maxzoom;
}

@@ -162,3 +162,4 @@

.on('tile.error', this._style._forwardTileEvent)
.on('tile.remove', this._style._forwardTileEvent);
.on('tile.remove', this._style._forwardTileEvent)
.on('tile.stats', this._style._forwardTileEvent);

@@ -184,3 +185,4 @@ this._events.push(['source.add', {source: source}]);

.off('tile.error', this._style._forwardTileEvent)
.off('tile.remove', this._style._forwardTileEvent);
.off('tile.remove', this._style._forwardTileEvent)
.off('tile.stats', this._style._forwardTileEvent);

@@ -187,0 +189,0 @@ this._events.push(['source.remove', {source: source}]);

@@ -429,3 +429,5 @@ 'use strict';

/**
* Easing animation to a specified location/zoom/bearing
* Change any combination of center, zoom, bearing, and pitch, with a smooth animation
* between old and new values. The map will retain the current values for any options
* not included in `options`.
*

@@ -627,3 +629,3 @@ * @param {CameraOptions|AnimationOptions} options map view and animation options

if (this._abortFn) {
this._abortFn.call(this);
this._abortFn();
this._finishEase();

@@ -630,0 +632,0 @@ }

@@ -52,2 +52,4 @@ 'use strict';

this.active = true;
var pos = DOM.mousePos(this._el, e),

@@ -99,2 +101,4 @@ inertia = this._inertia,

});
this.active = false;
},

@@ -101,0 +105,0 @@

@@ -28,3 +28,2 @@ 'use strict';

this._map.stop();
this.active = true;
this._startPos = this._pos = DOM.mousePos(this._el, e);

@@ -49,2 +48,4 @@

this.active = true;
if (!map.rotating) {

@@ -51,0 +52,0 @@ map.fire('movestart');

@@ -52,2 +52,13 @@ 'use strict';

/**
* Context menu event.
*
* @event contextmenu
* @memberof Map
* @type {Object}
* @property {Point} point the pixel location of the event
* @property {LngLat} lngLat the geographic location of the event
* @property {Event} originalEvent the original DOM event
*/
/**
* Load event. This event is emitted immediately after all necessary resources have been downloaded

@@ -82,2 +93,3 @@ * and the first visually complete rendering has occurred.

el.addEventListener('mousedown', this._onMouseDown, false);
el.addEventListener('mouseup', this._onMouseUp, false);
el.addEventListener('touchstart', this._onTouchStart, false);

@@ -87,2 +99,3 @@ el.addEventListener('click', this._onClick, false);

el.addEventListener('dblclick', this._onDblClick, false);
el.addEventListener('contextmenu', this._onContextMenu, false);
},

@@ -99,2 +112,3 @@

el.removeEventListener('mousedown', this._onMouseDown);
el.removeEventListener('mouseup', this._onMouseUp);
el.removeEventListener('touchstart', this._onTouchStart);

@@ -104,2 +118,3 @@ el.removeEventListener('click', this._onClick);

el.removeEventListener('dblclick', this._onDblClick);
el.removeEventListener('contextmenu', this._onContextMenu);
},

@@ -111,2 +126,9 @@

_onMouseUp: function (e) {
if (this._contextMenuFired && !this._map.dragRotate.active && !this._map.dragPan.active)
this._fireEvent('contextmenu', e);
this._contextMenuFired = null;
},
_onTouchStart: function (e) {

@@ -155,2 +177,6 @@ if (!e.touches || e.touches.length > 1) return;

_onContextMenu: function () {
this._contextMenuFired = true;
},
_fireEvent: function (type, e) {

@@ -157,0 +183,0 @@ var pos = DOM.mousePos(this._el, e);

@@ -350,17 +350,17 @@ 'use strict';

if (typeof callback === 'undefined') {
callback = params;
params = bounds;
callback = params;
params = bounds;
// bounds was omitted: use full viewport
bounds = [
Point.convert([0, 0]),
Point.convert([this.transform.width, this.transform.height])
];
bounds = [
Point.convert([0, 0]),
Point.convert([this.transform.width, this.transform.height])
];
}
bounds = bounds.map(Point.convert.bind(Point));
bounds = [
new Point(
new Point(
Math.min(bounds[0].x, bounds[1].x),
Math.min(bounds[0].y, bounds[1].y)
),
new Point(
new Point(
Math.max(bounds[0].x, bounds[1].x),

@@ -377,2 +377,5 @@ Math.max(bounds[0].y, bounds[1].y)

*
* @param {function} work Function which accepts the StyleBatch interface
*
* @example
* map.batch(function (batch) {

@@ -385,3 +388,2 @@ * batch.addLayer(layer1);

*
* @param {function} work Function which accepts the StyleBatch interface
*/

@@ -418,2 +420,3 @@ batch: function(work) {

.off('tile.error', this._forwardTileEvent)
.off('tile.stats', this._forwardTileEvent)
._remove();

@@ -448,3 +451,4 @@

.on('tile.load', this.update)
.on('tile.error', this._forwardTileEvent);
.on('tile.error', this._forwardTileEvent)
.on('tile.stats', this._forwardTileEvent);

@@ -705,5 +709,6 @@ this.on('rotate', this.style._redoPlacement);

/**
* Update this map's style and re-render the map.
* Update this map's style and sources, and re-render the map.
*
* @param {Object} updateStyle new style
* @param {boolean} updateStyle mark the map's style for reprocessing as
* well as its sources
* @returns {Map} this

@@ -886,6 +891,3 @@ */

this._collisionDebug = value;
for (var i in this.style.sources) {
this.style.sources[i].reload();
}
this.update();
this.style._redoPlacement();
},

@@ -892,0 +894,0 @@

@@ -82,6 +82,6 @@ 'use strict';

/*
* constrain n to the given range via modular arithmetic
* @param {number} n
* @param {number} min
* @param {number} max
* constrain n to the given range, excluding the minimum, via modular arithmetic
* @param {number} n value
* @param {number} min the minimum value to be returned, exclusive
* @param {number} max the maximum value to be returned, inclusive
* @returns {number} constrained number

@@ -92,3 +92,4 @@ * @private

var d = max - min;
return n === max ? n : ((n - min) % d + d) % d + min;
var w = ((n - min) % d + d) % d + min;
return (w === min) ? max : w;
};

@@ -143,7 +144,7 @@

array.forEach(function (item, i) {
fn(item, function (err, result) {
if (err) error = err;
results[i] = result;
if (--remaining === 0) callback(error, results);
});
fn(item, function (err, result) {
if (err) error = err;
results[i] = result;
if (--remaining === 0) callback(error, results);
});
});

@@ -347,2 +348,9 @@ };

/**
* Given a class, bind all of the methods that look like handlers: that
* begin with _on, and bind them to the class.
*
* @param {Object} context an object with methods
* @private
*/
exports.bindHandlers = function(context) {

@@ -349,0 +357,0 @@ for (var i in context) {

{
"name": "mapbox-gl",
"description": "A WebGL interactive maps library",
"version": "0.11.0",
"version": "0.11.1",
"main": "js/mapbox-gl.js",

@@ -28,2 +28,3 @@ "license": "BSD-3-Clause",

"resolve-url": "^0.2.1",
"unassertify": "^2.0.0",
"unitbezier": "^0.0.0",

@@ -39,7 +40,9 @@ "vector-tile": "^1.1.3",

"documentation": "git+https://github.com/documentationjs/documentation#d341019b32a8a257a93bd55586e7f09f42e29341",
"eslint": "^0.22.1",
"eslint": "^1.5.0",
"eslint-config-mourner": "^1.0.0",
"istanbul": "^0.3.15",
"mapbox-gl-test-suite": "git+https://github.com/mapbox/mapbox-gl-test-suite.git#2004426964b2ff74c231eae00c69c1e7fc73a329",
"mapbox-gl-test-suite": "git+https://github.com/mapbox/mapbox-gl-test-suite.git#5f81ae5c329540e0e3b341a64680fc03994a9c00",
"prova": "^2.1.2",
"sinon": "^1.15.4",
"st": "^0.5.5",
"through": "^2.3.7",

@@ -69,47 +72,9 @@ "watchify": "^3.2.2"

"test": "npm run lint && prova test/js/*/*.js",
"test-suite": "node test/render.test.js || true",
"test-suite": "node test/render.test.js && node test/query.test.js",
"build": "browserify -d js/mapbox-gl.js --standalone mapboxgl > dist/mapbox-gl-dev.js && npm run docs",
"production": "browserify js/mapbox-gl.js -d -p [minifyify --map mapbox-gl.js.map --output dist/mapbox-gl.js.map] --standalone mapboxgl > dist/mapbox-gl.js",
"production": "browserify js/mapbox-gl.js -d -t unassertify -p [minifyify --map mapbox-gl.js.map --output dist/mapbox-gl.js.map] --standalone mapboxgl > dist/mapbox-gl.js",
"prepublish": "npm run build && npm run production",
"cov": "istanbul cover prova test/js/*/*.js test/render.test.js -x js/lib/debugtext.js",
"docs": "node docs/_generate/generate.js"
},
"eslintConfig": {
"rules": {
"no-use-before-define": [
2,
"nofunc"
],
"camelcase": 2,
"space-after-function-name": 2,
"space-in-parens": 2,
"space-before-blocks": 2,
"space-after-keywords": 2,
"comma-style": 2,
"no-lonely-if": 2,
"no-else-return": 0,
"new-cap": 0,
"no-empty": 2,
"no-new": 2,
"no-multi-spaces": 0,
"space-in-brackets": 0,
"brace-style": 0,
"quotes": 0,
"no-underscore-dangle": 0,
"curly": 0,
"no-constant-condition": 0,
"no-native-reassign": 0,
"no-shadow": 0,
"key-spacing": 0
},
"env": {
"node": true,
"browser": true
},
"globals": {
"Map": true,
"Buffer": true,
"Worker": true
}
}
}

@@ -10,4 +10,4 @@ [![Build Status](https://circleci.com/gh/mapbox/mapbox-gl-js.svg?style=svg)](https://circleci.com/gh/mapbox/mapbox-gl-js)

```html
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.11.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.11.0/mapbox-gl.css' rel='stylesheet' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.11.1/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.11.1/mapbox-gl.css' rel='stylesheet' />
```

@@ -76,11 +76,6 @@

## [API Documentation](https://www.mapbox.com/mapbox-gl-js/)
## Writing Documentation
API documentation is written as [JSDoc comments](http://usejsdoc.org/) and processed with
[documentationjs](http://documentation.js.org/). We aim to document all classes and methods,
public and private. Mark private classes and methods with `@private`.
See [docs/README.md](https://github.com/mapbox/mapbox-gl-js/blob/master/docs/README.md).
To generate the HTML documentation from JSDoc, run `npm run docs`. To view the result, run
`jekyll serve` (requires [Jekyll](http://jekyllrb.com/)).
## Releasing

@@ -87,0 +82,0 @@

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 not supported yet

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

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