From 642f1c2a1d6e9ae3156c38c822004a64436019c0 Mon Sep 17 00:00:00 2001 From: Francisco Dans Date: Mon, 5 Oct 2015 12:39:16 +0200 Subject: [PATCH] fills grid with nulls instead of zeroes --- Makefile | 13 ------------- lib/torque/leaflet/torque.js | 4 ++-- lib/torque/renderer/iso.js | 4 ++-- 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index 37f73b0..3860844 100644 --- a/Makefile +++ b/Makefile @@ -9,20 +9,10 @@ JS_CLIENT_FILES= lib/torque/*.js \ lib/torque/leaflet/canvas_layer.js \ lib/torque/leaflet/torque.js -all: dist/torque.js dist/torque.full.js add-header dist/torque.full.uncompressed.js: dist_folder dist/torque.uncompressed.js $(BROWSERIFY) lib/torque/index.js --standalone torque > dist/torque.full.uncompressed.js -dist/torque.full.js: dist_folder dist/torque.full.uncompressed.js - $(UGLIFYJS) dist/torque.full.uncompressed.js > dist/torque.full.js - -dist/torque.uncompressed.js: dist_folder $(JS_CLIENT_FILES) - $(BROWSERIFY) lib/torque/index.js --no-bundle-external --standalone torque > dist/torque.uncompressed.js - -dist/torque.js: dist_folder dist/torque.uncompressed.js - $(UGLIFYJS) dist/torque.uncompressed.js > dist/torque.js - dist_folder: mkdir -p dist @@ -31,9 +21,6 @@ dist: dist_folder dist/torque.js clean-results: -@rm test/results/*.png -add-header: - node lib/header.js - prepare-test-suite: browserify test/suite.js > test/suite-bundle.js diff --git a/lib/torque/leaflet/torque.js b/lib/torque/leaflet/torque.js index c7ac7d2..cdeedcb 100644 --- a/lib/torque/leaflet/torque.js +++ b/lib/torque/leaflet/torque.js @@ -233,9 +233,9 @@ L.TorqueLayer = L.CanvasLayer.extend({ this.renderer.firstTileCoords = {coord: this._tiles[min.k].coord, pos:this.getTilePos(this._tiles[min.k].coord)}; var valsPerTile = 256/this.options.resolution; - this.renderer.globalGrid = Array.apply(null, Array(this.renderer.tileDimensions.h * valsPerTile)).map(Number.prototype.valueOf,0); + this.renderer.globalGrid = new Array(this.renderer.tileDimensions.h * valsPerTile).fill(null); for (var i = 0; i < this.renderer.globalGrid.length; i++){ - this.renderer.globalGrid[i] = Array.apply(null, Array(this.renderer.tileDimensions.w * valsPerTile)).map(Number.prototype.valueOf,0); + this.renderer.globalGrid[i] = new Array(this.renderer.tileDimensions.w * valsPerTile).fill(null); } } for(t in this._tiles) { diff --git a/lib/torque/renderer/iso.js b/lib/torque/renderer/iso.js index 166e5ec..de98db6 100644 --- a/lib/torque/renderer/iso.js +++ b/lib/torque/renderer/iso.js @@ -483,11 +483,11 @@ torque.extend(IsoRenderer.prototype, torque.Event, { var contourValues = this.contourValues; for (var c = 0; c < this.lines.length; c++){ var thisContour = this.lines[c]; - if(style["-isoline-line-decay"]){ + if (style["-isoline-line-decay"]){ var max = contourValues[contourValues.length - 1]; ctx.globalAlpha = (contourValues[c]/max)*(style["-isoline-line-opacity"] || 0.8); } - if(grad){ + if (grad){ ctx.strokeStyle = "rgb("+grad[4*contourValues[c]]+","+grad[4*contourValues[c]+1]+","+grad[4*contourValues[c]+2]+")"; ctx.fillStyle = "rgb("+grad[4*contourValues[c]]+","+grad[4*contourValues[c]+1]+","+grad[4*contourValues[c]+2]+")"; }