From abb2317af53fe78145cc886328499d89ca21deb7 Mon Sep 17 00:00:00 2001 From: Harrison <30683570+grantfayvor@users.noreply.github.com> Date: Sat, 22 Jun 2019 20:49:16 +0100 Subject: [PATCH] Fix Canvas is not a constructor error bug the top level import in node-canvas no longer was a constructor function instead has a .Canvas property --- lib/graphics-canvas.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/graphics-canvas.js b/lib/graphics-canvas.js index 2cf243b..ee789ff 100644 --- a/lib/graphics-canvas.js +++ b/lib/graphics-canvas.js @@ -44,7 +44,7 @@ var Graphics = function(width, height, border, padding, font, fontsize){ , top: this.border_size , left: this.padding_width + this.quiet }; - this.canvas = new Canvas(width, height); + this.canvas = new Canvas.Canvas(width, height); this.ctx = this.canvas.getContext('2d'); this.fg = "#000"; this.bg = "#fff"; @@ -94,7 +94,7 @@ Graphics.prototype.rotate = function(angle){ var bounds = geo.getRotatedBounds(this.width, this.height, rad); var img = new Image(); img.src = this.canvas.toBuffer(); - var canvas = new Canvas(bounds.width, bounds.height); + var canvas = new Canvas.Canvas(bounds.width, bounds.height); var ctx = canvas.getContext('2d'); ctx.translate(bounds.width * 0.5, bounds.height * 0.5); ctx.rotate(rad);