From 50899a79ef726e64c154197e5bf98440ae657ca1 Mon Sep 17 00:00:00 2001 From: Kienz Date: Sun, 12 Jan 2014 11:33:42 +0100 Subject: [PATCH] Fix fabric.Canvas initialization for width/height attributes. Closes #1086. --- src/static_canvas.class.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/static_canvas.class.js b/src/static_canvas.class.js index eb159d4c..94f05462 100644 --- a/src/static_canvas.class.js +++ b/src/static_canvas.class.js @@ -390,11 +390,14 @@ this[prop] = options[prop]; } - this.width = parseInt(this.lowerCanvasEl.width, 10) || 0; - this.height = parseInt(this.lowerCanvasEl.height, 10) || 0; + this.width = this.width || parseInt(this.lowerCanvasEl.width, 10) || 0; + this.height = this.height || parseInt(this.lowerCanvasEl.height, 10) || 0; if (!this.lowerCanvasEl.style) return; + this.lowerCanvasEl.width = this.width; + this.lowerCanvasEl.height = this.height; + this.lowerCanvasEl.style.width = this.width + 'px'; this.lowerCanvasEl.style.height = this.height + 'px'; },