fix canvas
@@ -33,7 +33,7 @@ class Scene
33
33
body.insertAdjacentHTML('beforeend', '<canvas id="' + this.id + '" style="position: absolute; left: ' + x + 'px; top: ' + y + 'px;" width="' + width + '" height="' + height + '"></canvas>');
34
34
35
35
this.cv_canvas = document.getElementById(this.id);
36
this.cv_canvasContext = this.cv_canvas.getContext('2d');
36
this.cv_context = this.cv_canvas.getContext('2d');
37
37
}
38
38
39
39
destroy()
@@ -54,12 +54,12 @@ class Scene
54
54
55
55
get canvas()
56
56
{
57
return this.canvas;
57
return this.cv_canvas;
58
58
}
59
59
60
60
get context()
61
61
{
62
return this.canvasContext;
62
return this.cv_context;
63
63
}
64
64
65
65
addObject(obj)
@@ -103,13 +103,13 @@ class Scene
103
103
104
104
this.canvas.style = 'position: absolute; left: ' + this.position.x + 'px; top: ' + this.position.y + 'px;'; //todo: only call when changed?
105
105
106
this.canvasContext.fillStyle = "rgb(" + this.backgroundColor.r + "," + this.backgroundColor.g + "," + this.backgroundColor.b + ")"; // sets the color to fill in the rectangle with
107
this.canvasContext.fillRect(0, 0, this.size.width, this.size.height);
106
this.context.fillStyle = "rgb(" + this.backgroundColor.r + "," + this.backgroundColor.g + "," + this.backgroundColor.b + ")"; // sets the color to fill in the rectangle with
107
this.context.fillRect(0, 0, this.size.width, this.size.height);
108
108
109
109
for(var i = 0; i < this.activeObjects.length; i++)
110
110
{
111
111
if(this.activeObjects[i].active && this.activeObjects[i].renderer.visible)
112
this.activeObjects[i].g_draw(this.canvasContext);
112
this.activeObjects[i].g_draw(this.context);
113
113
}
114
114
}
115
115
}
@@ -33,7 +33,7 @@ class Scene33
body.insertAdjacentHTML('beforeend', '<canvas id="' + this.id + '" style="position: absolute; left: ' + x + 'px; top: ' + y + 'px;" width="' + width + '" height="' + height + '"></canvas>');33
body.insertAdjacentHTML('beforeend', '<canvas id="' + this.id + '" style="position: absolute; left: ' + x + 'px; top: ' + y + 'px;" width="' + width + '" height="' + height + '"></canvas>');34
34
35
this.cv_canvas = document.getElementById(this.id);35
this.cv_canvas = document.getElementById(this.id);36
this.cv_canvasContext = this.cv_canvas.getContext('2d');36
this.cv_context = this.cv_canvas.getContext('2d');37
}37
}38
38
39
destroy()39
destroy()@@ -54,12 +54,12 @@ class Scene54
54
55
get canvas()55
get canvas()56
{56
{57
return this.canvas;57
return this.cv_canvas;58
}58
}59
59
60
get context()60
get context()61
{61
{62
return this.canvasContext;62
return this.cv_context;63
}63
}64
64
65
addObject(obj)65
addObject(obj)@@ -103,13 +103,13 @@ class Scene103
103
104
this.canvas.style = 'position: absolute; left: ' + this.position.x + 'px; top: ' + this.position.y + 'px;'; //todo: only call when changed?104
this.canvas.style = 'position: absolute; left: ' + this.position.x + 'px; top: ' + this.position.y + 'px;'; //todo: only call when changed?105
105
106
this.canvasContext.fillStyle = "rgb(" + this.backgroundColor.r + "," + this.backgroundColor.g + "," + this.backgroundColor.b + ")"; // sets the color to fill in the rectangle with106
this.context.fillStyle = "rgb(" + this.backgroundColor.r + "," + this.backgroundColor.g + "," + this.backgroundColor.b + ")"; // sets the color to fill in the rectangle with107
this.canvasContext.fillRect(0, 0, this.size.width, this.size.height);107
this.context.fillRect(0, 0, this.size.width, this.size.height);108
108
109
for(var i = 0; i < this.activeObjects.length; i++)109
for(var i = 0; i < this.activeObjects.length; i++)110
{110
{111
if(this.activeObjects[i].active && this.activeObjects[i].renderer.visible)111
if(this.activeObjects[i].active && this.activeObjects[i].renderer.visible)112
this.activeObjects[i].g_draw(this.canvasContext);112
this.activeObjects[i].g_draw(this.context);113
}113
}114
}114
}115
}115
}