I have a class prototype called "viewport", goes like this (its really long so just snippets)
function Viewport(Container) {
this.x = 0;
this.y = 0;
this.w = 0;
this.h = 0;
...
Then at some point I have this
this.Draw = function() {
this.Canvas.width = this.w;
this.Canvas.height = this.h;
cDrawGrid(this.ctx, this.x, this.y, this.w, this.h, this.scale);
//add other draw calls later
}
And even further down the line I got this
this.onMouseMove = function(e) {
if (!this.bMoving) return;
e = getEvent(e);
this.x += e.clientX - this.LastMouseX;
this.y += e.clientY - this.LastMouseY;
this.LastMouseX = e.clientX;
this.LastMouseY = e.clientY;
this.Draw();
}
It doesn't work however, opera error console says "Type error: this.Draw() is not a function"
Why is this happening?