[node-rbush] 01/04: Imported Upstream version 1.3.5
Sebastiaan Couwenberg
sebastic at moszumanska.debian.org
Fri Feb 27 08:12:55 UTC 2015
This is an automated email from the git hooks/post-receive script.
sebastic pushed a commit to branch master
in repository node-rbush.
commit d6ac4f42579f5ba834e9ce2055f9a4271a20b3cb
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date: Fri Feb 27 08:42:04 2015 +0100
Imported Upstream version 1.3.5
---
package.json | 54 +++++++++++++++++++++++++++++++++++++++---------------
rbush.js | 6 +++---
test/test.js | 6 +++++-
viz/viz.js | 21 ++++++++++++++-------
4 files changed, 61 insertions(+), 26 deletions(-)
diff --git a/package.json b/package.json
index 7dd10dd..41ed08a 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "rbush",
- "version": "1.3.4",
+ "version": "1.3.5",
"description": "High-performance 2D spatial index for rectangles (based on R*-tree with bulk loading and bulk insertion algorithms)",
"homepage": "https://github.com/mourner/rbush",
"keywords": [
@@ -19,27 +19,51 @@
"main": "rbush.js",
"devDependencies": {
"benchmark": "^1.0.0",
+ "eslint": "^0.13.0",
"faucet": "0.0.1",
- "istanbul": "~0.3.0",
- "jshint": "^2.5.5",
+ "istanbul": "~0.3.2",
"rtree": "~1.4.2",
- "tape": "^2.14.0"
+ "tape": "^3.0.3"
},
"scripts": {
- "test": "jshint rbush.js test/test.js && node test/test.js | faucet",
+ "test": "eslint rbush.js test/test.js && node test/test.js | faucet",
"perf": "node ./debug/perf.js",
"cov": "istanbul cover test/test.js -x test/test.js"
},
- "jshintConfig": {
- "unused": "true",
- "undef": true,
- "trailing": true,
- "eqeqeq": true,
- "es3": true,
- "indent": 4,
- "node": true,
- "browser": true,
- "worker": true,
+ "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": 2,
+ "no-empty": 2,
+ "no-new": 2,
+ "key-spacing": 2,
+ "no-multi-spaces": 2,
+ "space-in-brackets": 2,
+ "quotes": [
+ 2,
+ "single"
+ ],
+ "new-cap": 0,
+ "no-new-func": 0,
+ "curly": 0,
+ "no-underscore-dangle": 0,
+ "no-constant-condition": 0,
+ "no-shadow": 0
+ },
+ "env": {
+ "node": true,
+ "browser": true
+ },
"globals": {
"define": false
}
diff --git a/rbush.js b/rbush.js
index b151197..85513a0 100644
--- a/rbush.js
+++ b/rbush.js
@@ -485,7 +485,7 @@ function enlargedArea(a, b) {
(Math.max(b[3], a[3]) - Math.min(b[1], a[1]));
}
-function intersectionArea (a, b) {
+function intersectionArea(a, b) {
var minX = Math.max(a[0], b[0]),
minY = Math.max(a[1], b[1]),
maxX = Math.min(a[2], b[2]),
@@ -502,7 +502,7 @@ function contains(a, b) {
b[3] <= a[3];
}
-function intersects (a, b) {
+function intersects(a, b) {
return b[0] <= a[2] &&
b[1] <= a[3] &&
b[2] >= a[0] &&
@@ -579,7 +579,7 @@ function swap(arr, i, j) {
// export as AMD/CommonJS module or global variable
-if (typeof define === 'function' && define.amd) define(function() { return rbush; });
+if (typeof define === 'function' && define.amd) define('rbush', function() { return rbush; });
else if (typeof module !== 'undefined') module.exports = rbush;
else if (typeof self !== 'undefined') self.rbush = rbush;
else window.rbush = rbush;
diff --git a/test/test.js b/test/test.js
index 4739142..92491c4 100644
--- a/test/test.js
+++ b/test/test.js
@@ -1,3 +1,7 @@
+'use strict';
+
+/*eslint key-spacing: 0, comma-spacing: 0, quotes: 0*/
+
var rbush = require('../rbush.js'),
t = require('tape');
@@ -82,7 +86,7 @@ t('#toBBox, #compareMinX, #compareMinY can be overriden to allow custom data str
tree.load(data);
- function byLngLat (a, b) {
+ function byLngLat(a, b) {
return a.minLng - b.minLng || a.minLat - b.minLat;
}
diff --git a/viz/viz.js b/viz/viz.js
index e6d3714..0ab5982 100644
--- a/viz/viz.js
+++ b/viz/viz.js
@@ -2,6 +2,14 @@ var W = 700,
canvas = document.getElementById('canvas'),
ctx = canvas.getContext('2d');
+if (window.devicePixelRatio > 1) {
+ canvas.style.width = canvas.width + 'px';
+ canvas.style.height = canvas.height + 'px';
+ canvas.width = canvas.width * 2;
+ canvas.height = canvas.height * 2;
+ ctx.scale(2, 2);
+}
+
function randBox(size) {
var x = Math.random() * (W - size),
y = Math.random() * (W - size);
@@ -35,7 +43,7 @@ function randClusterBox(cluster, dist, size) {
];
}
-var colors = ['#f40', '#37f', '#0b0'],
+var colors = ['#f40', '#0b0', '#37f'],
rects;
function drawTree(node, level) {
@@ -43,11 +51,11 @@ function drawTree(node, level) {
var rect = [];
- rect.push(level ? colors[(level - 1) % colors.length] : 'grey');
- rect.push(level ? 1 / level : 1);
+ rect.push(level ? colors[(node.height - 1) % colors.length] : 'grey');
+ rect.push(level ? 1 / Math.pow(level, 1.2) : 0.2);
rect.push([
- Math.round(node.bbox[0]) + 0.5,
- Math.round(node.bbox[1]) + 0.5,
+ Math.round(node.bbox[0]),
+ Math.round(node.bbox[1]),
Math.round(node.bbox[2] - node.bbox[0]),
Math.round(node.bbox[3] - node.bbox[1])
]);
@@ -66,8 +74,7 @@ function draw() {
rects = [];
drawTree(tree.data, 0);
- ctx.fillStyle = 'white';
- ctx.fillRect(0, 0, W + 1, W + 1);
+ ctx.clearRect(0, 0, W + 1, W + 1);
for (var i = rects.length - 1; i >= 0; i--) {
ctx.strokeStyle = rects[i][0];
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/node-rbush.git
More information about the Pkg-grass-devel
mailing list