* check if Canvas still exists before resizing and dettaching events
This commit is contained in:
+11
-1
@@ -241,7 +241,10 @@ clear: function () {
|
|||||||
|
|
||||||
resize: function (width, height, true_color) {
|
resize: function (width, height, true_color) {
|
||||||
var c = $(Canvas.id);
|
var c = $(Canvas.id);
|
||||||
|
|
||||||
|
if (!c)
|
||||||
|
return
|
||||||
|
|
||||||
if (typeof true_color !== "undefined") {
|
if (typeof true_color !== "undefined") {
|
||||||
Canvas.true_color = true_color;
|
Canvas.true_color = true_color;
|
||||||
}
|
}
|
||||||
@@ -262,6 +265,9 @@ rescale: function (factor) {
|
|||||||
|
|
||||||
c = $(Canvas.id);
|
c = $(Canvas.id);
|
||||||
|
|
||||||
|
if (!c)
|
||||||
|
return
|
||||||
|
|
||||||
x = c.width - c.width * factor;
|
x = c.width - c.width * factor;
|
||||||
y = c.height - c.height * factor;
|
y = c.height - c.height * factor;
|
||||||
Canvas.scale = factor;
|
Canvas.scale = factor;
|
||||||
@@ -298,6 +304,10 @@ rescale: function (factor) {
|
|||||||
|
|
||||||
stop: function () {
|
stop: function () {
|
||||||
var c = $(Canvas.id);
|
var c = $(Canvas.id);
|
||||||
|
|
||||||
|
if (!c)
|
||||||
|
return
|
||||||
|
|
||||||
Util.removeEvent(document, 'keydown', Canvas.onKeyDown);
|
Util.removeEvent(document, 'keydown', Canvas.onKeyDown);
|
||||||
Util.removeEvent(document, 'keyup', Canvas.onKeyUp);
|
Util.removeEvent(document, 'keyup', Canvas.onKeyUp);
|
||||||
Util.removeEvent(c, 'mousedown', Canvas.onMouseDown);
|
Util.removeEvent(c, 'mousedown', Canvas.onMouseDown);
|
||||||
|
|||||||
Reference in New Issue
Block a user