I am trying to create a dojo class which contains functions which in turn call other functions within this class, as follows:
dojo.provide("my.drawing");
dojo.declare("my.drawing", null, {
constructor: function(/* Object */args){
dojo.safeMixin(this, args);
this.container = args[0];
},
addPoint: function(event){
//calculate the x and y values by offsetting correctly
var pos = dojo.coords(container);
var x = event.clientX - pos.x;
var y = event.clientY - pos.y;
this.addAbsPoint(x,y);
},
addAbsPoint: function(x,y){
//do something here with the absolute x and y values
}
});
The above (trimmed) code is to add a point onto a dojo.gfx surface. When I try and run it I get the following console error:
Uncaught TypeError: Object #<an HTMLDivElement> has no method 'addAbsPoint'
The function addPoint(event) is being called correctly, but it fails when it trys to reference the function addAbsPoint(x,y) in the same object. Is this possible in dojo? Can anyone suggest a way to accomplish it?