Merge pull request #305 from CartoDB/upgrade-canvas

Upgrade canvas version to 2.4.1
This commit is contained in:
Daniel G. Aubert 2019-04-02 10:25:19 +02:00 committed by GitHub
commit a44bf1866c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 39 additions and 19 deletions

4
NEWS
View File

@ -1,5 +1,5 @@
3.0.1 (2019-mm-dd)
3.1.0 (2019-mm-dd)
- Upgrade canvas to version 2.4.1
3.0.0 (2019-03-29)
- Drop support for Node.js 6 and 8

35
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "torque.js",
"version": "3.0.1",
"version": "3.1.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -530,12 +530,13 @@
"dev": true
},
"canvas": {
"version": "1.6.9",
"resolved": "https://registry.npmjs.org/canvas/-/canvas-1.6.9.tgz",
"integrity": "sha1-4/lc7HsWvy1vP8clwC2UDTJY9ps=",
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/canvas/-/canvas-2.4.1.tgz",
"integrity": "sha512-SaFomFqDuuuSTScTHQ7nXc5ea71Ieb8ctvwXjR7vzLsBMfp3euTv2xsTY70zIoC5r4sSQZYXv6tiHiORJ4y1vg==",
"dev": true,
"requires": {
"nan": "^2.4.0"
"nan": "^2.12.1",
"node-pre-gyp": "^0.11.0"
}
},
"carto": {
@ -1922,9 +1923,9 @@
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg=="
},
"nan": {
"version": "2.11.1",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.11.1.tgz",
"integrity": "sha512-iji6k87OSXa0CcrLl9z+ZiYSuR2o+c0bGuNmXdrhTQTakxytAFsC56SArGYoiHlJlFoHSnvmhpceZJaXkVuOtA==",
"version": "2.13.2",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.13.2.tgz",
"integrity": "sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw==",
"dev": true
},
"needle": {
@ -1938,6 +1939,24 @@
"sax": "^1.2.4"
}
},
"node-pre-gyp": {
"version": "0.11.0",
"resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.11.0.tgz",
"integrity": "sha512-TwWAOZb0j7e9eGaf9esRx3ZcLaE5tQ2lvYy1pb5IAaG1a2e2Kv5Lms1Y4hpj+ciXJRofIxxlt5haeQ/2ANeE0Q==",
"dev": true,
"requires": {
"detect-libc": "^1.0.2",
"mkdirp": "^0.5.1",
"needle": "^2.2.1",
"nopt": "^4.0.1",
"npm-packlist": "^1.1.6",
"npmlog": "^4.0.2",
"rc": "^1.2.7",
"rimraf": "^2.6.1",
"semver": "^5.3.0",
"tar": "^4"
}
},
"node-qunit-phantomjs": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/node-qunit-phantomjs/-/node-qunit-phantomjs-1.6.0.tgz",

View File

@ -1,6 +1,6 @@
{
"name": "torque.js",
"version": "3.0.1",
"version": "3.1.0",
"description": "Temporal mapping for CARTO",
"repository": {
"type": "git",
@ -21,7 +21,8 @@
"Nicklas Gummesson <nicklas@cartodb.com>",
"Francisco Dans <francisco@cartodb.com>",
"Carlos Matallín <matallo@carto.com>",
"Rubén Moya <ruben@carto.com"
"Rubén Moya <ruben@carto.com>",
"Daniel García Aubert <dgaubert@carto.com>"
],
"license": "BSD-3-Clause",
"dependencies": {
@ -33,7 +34,7 @@
"devDependencies": {
"@carto/mapnik": "^3.6.2-carto.11",
"browserify": "^16.2.3",
"canvas": "^1.6.9",
"canvas": "^2.4.1",
"leaflet": "1.0.3",
"node-qunit-phantomjs": "1.6.0",
"phantomjs-polyfill": "0.0.2",

View File

@ -1,12 +1,12 @@
var Canvas = require('canvas');
var image = require('../support/image');
const { createCanvas }= require('canvas');
const image = require('../support/image');
QUnit.module('example');
test('reference test with canvas', function() {
var circleRadius = 20;
var canvasSize = circleRadius * 2 + 2;
var canvas = new Canvas(canvasSize, canvasSize);
var canvas = createCanvas(canvasSize, canvasSize);
var ctx = canvas.getContext('2d');

View File

@ -1,4 +1,4 @@
var Canvas = require('canvas');
const { createCanvas, Canvas, Image }= require('canvas');
var request = require('request');
var _ = require('underscore');
var fs = require('fs');
@ -14,7 +14,7 @@ function getTile(jsonRelPath, cartocss, z, x, y, step, callback) {
var provider = new torque.providers.windshaft(_.extend({ no_fetch_map: true }, cartoCssOptions));
var rendererOptions = _.extend({cartocss: cartocss}, cartoCssOptions, {
canvasClass: Canvas,
imageClass: Canvas.Image,
imageClass: Image,
setImageSrc: function(img, url, callback) {
var requestOpts = {
url: url,
@ -45,7 +45,7 @@ function getTile(jsonRelPath, cartocss, z, x, y, step, callback) {
var rows = JSON.parse(fs.readFileSync(__dirname + '/../fixtures/json/' + jsonRelPath));
var canvas = new Canvas(256, 256);
var canvas = createCanvas(256, 256);
var pointRenderer = new torque.renderer.Point(canvas, rendererOptions);
pointRenderer.renderTile(provider.proccessTile(rows, {x: x, y: y}, z), step, function(err) {