* check if Canvas still exists before resizing and dettaching events

This commit is contained in:
primalmotion 2010-07-22 12:46:54 +02:00
parent 33ebb52b56
commit 212733afbf
1 changed files with 11 additions and 1 deletions

View File

@ -241,7 +241,10 @@ clear: function () {
resize: function (width, height, true_color) {
var c = $(Canvas.id);
if (!c)
return
if (typeof true_color !== "undefined") {
Canvas.true_color = true_color;
}
@ -262,6 +265,9 @@ rescale: function (factor) {
c = $(Canvas.id);
if (!c)
return
x = c.width - c.width * factor;
y = c.height - c.height * factor;
Canvas.scale = factor;
@ -298,6 +304,10 @@ rescale: function (factor) {
stop: function () {
var c = $(Canvas.id);
if (!c)
return
Util.removeEvent(document, 'keydown', Canvas.onKeyDown);
Util.removeEvent(document, 'keyup', Canvas.onKeyUp);
Util.removeEvent(c, 'mousedown', Canvas.onMouseDown);