* 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
+10
View File
@@ -242,6 +242,9 @@ 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);