From c3129b86516ca87a70deff60b5b4eabf46c27c83 Mon Sep 17 00:00:00 2001 From: liabru Date: Sat, 5 Dec 2015 17:19:50 +0000 Subject: [PATCH] use actual canvas size for default render bounds --- src/render/Render.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/render/Render.js b/src/render/Render.js index 7a383ab..b8457a3 100644 --- a/src/render/Render.js +++ b/src/render/Render.js @@ -67,10 +67,11 @@ var Vector = require('../geometry/Vector'); var render = Common.extend(defaults, options); - if(render.canvas) { + if (render.canvas) { render.canvas.width = render.options.width || render.canvas.width; render.canvas.height = render.options.height || render.canvas.height; } + render.canvas = render.canvas || _createCanvas(render.options.width, render.options.height); render.context = render.canvas.getContext('2d'); render.textures = {}; @@ -81,8 +82,8 @@ var Vector = require('../geometry/Vector'); y: 0 }, max: { - x: render.options.width, - y: render.options.height + x: render.canvas.width, + y: render.canvas.height } };