X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/36d06d92f91870d431dc4d203334def8fc891ee4..2e65999ad3791878b245ead3d0fa8442d74fd1b2:/src/editor/modules/documentCanvas/canvas/genericElement.js diff --git a/src/editor/modules/documentCanvas/canvas/genericElement.js b/src/editor/modules/documentCanvas/canvas/genericElement.js index a2601f8..44615f5 100644 --- a/src/editor/modules/documentCanvas/canvas/genericElement.js +++ b/src/editor/modules/documentCanvas/canvas/genericElement.js @@ -103,20 +103,19 @@ $.extend(generic, { referenceAction = 'after'; } - if(event.type === 'nodeMoved') { - actionArg = utils.getElementForNode(event.meta.node, event.meta.parent); - if(actionArg.sameNode(referenceElement)) { + if(event.meta.move) { + /* Let's check if this node had its own canvas element and it's accessible. */ + actionArg = utils.getElementForElementRootNode(event.meta.node); + if(actionArg && actionArg.sameNode(referenceElement)) { referenceElement = this.children()[nodeIndex]; } - } else { + } + if(!actionArg) { actionArg = event.meta.node; } referenceElement[referenceAction](actionArg); }, - onNodeMoved: function(event) { - return this.onNodeAdded.call(this, event); - }, onNodeDetached: function(event) { if(event.meta.node.sameNode(this)) { this.detach();