From 17c5f08da899b797e9e14ce53b5afe84a4eae6aa Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Tue, 15 Nov 2016 09:18:43 -0800 Subject: [PATCH] Improved file load, lessened threshold. --- scripts/ronin.file.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/ronin.file.js b/scripts/ronin.file.js index 8e7c5b2..b59ecbd 100644 --- a/scripts/ronin.file.js +++ b/scripts/ronin.file.js @@ -10,8 +10,6 @@ function File() ronin.overlay.clear(); - if(!cmd.position()){ return; } - if(!cmd.rect()){ return; } if(!cmd.path() && !cmd.value()){ return; } var position = cmd.position() ? cmd.position() : new Position(); @@ -19,8 +17,14 @@ function File() base_image = new Image(); base_image.src = cmd.value() && this.storage[cmd.value()] ? this.storage[cmd.value()] : cmd.path(); base_image.onload = function(){ - position.normalize(cmd.rect()); - ronin.canvas.context().drawImage(base_image, position.x, position.y, cmd.rect().width, cmd.rect().height); + var width = base_image.naturalWidth; + var height = base_image.naturalHeight; + if(cmd.rect()){ + width = cmd.rect().width; + height = cmd.rect().height; + position.normalize(cmd.rect()); + } + ronin.canvas.context().drawImage(base_image, position.x, position.y, width, height); } }