this.getParent() is undefined
The latest build is throwing the following JS Error:
TypeError: this.getParent() is undefined
/**
- get layer ancestor
- @name getLayer
- @methodOf Kinetic.Node.prototype */ getLayer: function() { return this.getParent().getLayer(); },
The steps to reproduce this on, create a draggable layer where on endDrag you are clearing out the contents and redrawing. After dragging far enough in any direction, these errors start to blow up.
Follow up to this one, the error is actually triggered on the mouseout event, after meeting the above conditions:
element.on('mouseout', function(){ //do something here this.getLayer().draw(); });
this.getLayer() throws the error
I am getting a similar issue.
Fix would be great, thanks.
hi I need more info. Can you post a jsfiddle demonstrating the behavior? Thanks!
Here is a js fiddle of the error http://jsfiddle.net/m2sUr/3/
Unfortunately, inside js fiddle, the click event does not fire (not sure why) so please view it here --> http://jsfiddle.net/m2sUr/3/embedded/result/
I'll try and get more info on why this is happening a bit later
As an aside, if I get into the nextTick by wrapping a setTimeout around the remove, things are fine.
setTimeout(function () {
square.remove();
}, 0);
yea, looks like a context problem inside the on() method. I'll add this to my todo list. Thanks!!
Unfortunatelly got the same issue, when object "looses" its parent inside .transitionTo method. Had to rollback to v4.0.5
P.S. Happens only on "concurrent" runs. I.e. if I run another transitionTo before previous has been done.
fixed! The problem was that the drag and drop module still had a reference to the node that was removed which caused things to blow (in other words, this problem only occurred if your shape was draggable:true). Here's the change:
https://github.com/ericdrowell/KineticJS/commit/5e16b3d7d0538dce04d35a91acebc288918be51c
Proposed fix did not solve the issue, same error as before.
it fixed the jsfiddle mentioned in the issue:
http://jsfiddle.net/9YfSc/
if there are other conditions where the problem occurs, can you create a new ticket?
I am getting the exact issue @mrgoodcat has described "if I run another transitionTo before previous has been done." with v4.2.0
I am getting the this.getParent() undefined error message. I am deleting an array with groups(having shapes) and shapes(line, rect etc) as its elements. Individual shapes are getting deleted but the error occurs if there is any one group inside that array. Thanks !!!