I'm dragging and dropping an image from a toolbar onto a canvas.The user can drag&drop that same image from the toolbar multiple times.The user can also remove a particular object on double click as shown in the link below..
I want to record the position of these objects on page load and also after moving them around in the canvas.For this i'm adding an event listener and a function which will show the positions of all the objects on button click
myButton.addEventListener('click', position);
The JS function used to calculate position of the objects..
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.isDragging = props.isDragging;
this.draw = function() {
ctx.fillStyle = this.fill;
ctx.fillRect(this.posX, this.posY, this.width, this.height);
}
}
Even though I'm adding the above JS function I'm not getting the output on button click..I don't know where i'm going wrong...Is there a simpler way of doing this in jQuery??
The link containing the above JS function