get position of canvas element code example
Example: get item position in canvas
function Rectangle(props){
var posX = this.posX = props.x;
var posY = this.posY = props.y;
this.width = props.width;
this.height = props.height;
this.fill = props.fill;
this.draw = function(){
ctx.fillStyle = this.fill;
ctx.fillRect(this.posX, this.posY, this.width, this.height);
}
}