KineticJS - error when I release mouse above shape
I'm having some trouble with Kineticjs when creating a rectangle by
clicking and draggning.
$('#my-canvas').mousedown(function() {
// Create rectangle
// Add rectangle to layer
// Draw layer
});
// Dragging
$('#my-canvas').mousemove(function() {
// Update rectangles size/position so that it matches the current
mouse position
// Draw layer
});
Then when I release (mouseup), I get the following error:
Uncaught TypeError: Cannot read property '_id' of undefined
Kinetic.Util.addMethods._mouseup
(anonymous function)
If I make sure the mouse is not on the rectangle when releasing it I don't
get the error. But since I'm using the mouse to drag out the rectangle the
mouse position is going to be at rectangles end position.
I've searched and searched with no result.
Thanks in advance.
No comments:
Post a Comment