{"action":"created","issue":{"url":"https://api.github.com/repos/codef0rmer/angular-dragdrop/issues/213","labels_url":"https://api.github.com/repos/codef0rmer/angular-dragdrop/issues/213/labels{/name}","comments_url":"https://api.github.com/repos/codef0rmer/angular-dragdrop/issues/213/comments","events_url":"https://api.github.com/repos/codef0rmer/angular-dragdrop/issues/213/events","html_url":"https://github.com/codef0rmer/angular-dragdrop/issues/213","id":106986982,"number":213,"title":"Prevent collision","user":{"login":"meivin123","id":6137407,"avatar_url":"https://avatars.githubusercontent.com/u/6137407?v=3","gravatar_id":"","url":"https://api.github.com/users/meivin123","html_url":"https://github.com/meivin123","followers_url":"https://api.github.com/users/meivin123/followers","following_url":"https://api.github.com/users/meivin123/following{/other_user}","gists_url":"https://api.github.com/users/meivin123/gists{/gist_id}","starred_url":"https://api.github.com/users/meivin123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meivin123/subscriptions","organizations_url":"https://api.github.com/users/meivin123/orgs","repos_url":"https://api.github.com/users/meivin123/repos","events_url":"https://api.github.com/users/meivin123/events{/privacy}","received_events_url":"https://api.github.com/users/meivin123/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-17T13:37:49Z","updated_at":"2015-09-17T14:54:57Z","closed_at":null,"body":"Hi,\r\nis there any way to prevent colision?\r\nI found [this](http://stackoverflow.com/questions/6071409/draggable-revert-if-outside-this-div-and-inside-of-other-draggables-using-both/6087928#6087928) solution on stack overflow but it isnt working.\r\n\r\n```code\r\nError: cannot call methods on draggable prior to initialization; attempted to call method 'option'\r\n```\r\n\r\nI have a sidebar where all draggables are listed (draggables must be cloned). Left to the sidebar is a droppable container (which will be draggable in the future) where all draggables should be dropped. OnDrop I am assigning the position to the model.\r\nI am trying to prevent the dragend over an already dropped element in my dropable so if I drop my clone draggable over an dropped element it should go back to the previous position (if it was in droppable) or go back completely into the sidebar.\r\n\r\nSo how can I accomplish this?\r\n\r\nMy droppable is the following:\r\n```html\r\n<div id=\"floor\" class=\"floor draggable\" ng-model=\"ctrl.floorTables\" data-drop=\"true\" \r\n       data-jqyuoi-options=\"\" \r\n       jqyoui-droppable=\"{multiple: true, stack: false, onDrop: 'ctrl.onDropHandler'}\">\r\n    <div class=\"table {{table.type}} dropped\" \r\n           ng-repeat=\"table in ctrl.floorTables track by $index\"\r\n           ng-style=\"{top: table.top, left: table.left}\">\r\n        Top: {{table.top}}, Left: {{table.left}}\r\n    </div>\r\n</div>\r\n```\r\nAnd my draggables are:\r\n```html\r\n<li ng-repeat=\"table in ctrl.tableTypes\">\r\n    <div class=\"table {{table.type}}\" ng-model=\"ctrl.tableTypes\" data-drag=\"true\" \r\n           data-jqyoui-options=\"{helper: 'clone', revert: 'invalid', appendTo: '#floor'}\" \r\n           jqyoui-draggable=\"{index: {{$index}}, placeholder: 'keep', deepCopy: true}\">\r\n    </div>\r\n</li>\r\n```\r\n\r\nOnDrop handler:\r\n```javascript\r\nself.onDropHandler = function(event, ui){\r\n        var offset = ui.offset;\r\n        var dropped = self.floorTables[self.floorTables.length - 1];\r\n        dropped.top = ui.position.top;\r\n        dropped.left = ui.position.left;\r\n};\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/codef0rmer/angular-dragdrop/issues/comments/141112609","html_url":"https://github.com/codef0rmer/angular-dragdrop/issues/213#issuecomment-141112609","issue_url":"https://api.github.com/repos/codef0rmer/angular-dragdrop/issues/213","id":141112609,"user":{"login":"meivin123","id":6137407,"avatar_url":"https://avatars.githubusercontent.com/u/6137407?v=3","gravatar_id":"","url":"https://api.github.com/users/meivin123","html_url":"https://github.com/meivin123","followers_url":"https://api.github.com/users/meivin123/followers","following_url":"https://api.github.com/users/meivin123/following{/other_user}","gists_url":"https://api.github.com/users/meivin123/gists{/gist_id}","starred_url":"https://api.github.com/users/meivin123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meivin123/subscriptions","organizations_url":"https://api.github.com/users/meivin123/orgs","repos_url":"https://api.github.com/users/meivin123/repos","events_url":"https://api.github.com/users/meivin123/events{/privacy}","received_events_url":"https://api.github.com/users/meivin123/received_events","type":"User","site_admin":false},"created_at":"2015-09-17T14:54:57Z","updated_at":"2015-09-17T14:54:57Z","body":"I've added a onDrop handler to the already dropped elements in which I set an indicator to true.\r\nThen the event bubbles up to the parent dragarea and triggers the onDrop handler (although I've set greedy to true).\r\nIn the parents onDrop handler the element is removed from the model if a colision occured.\r\nBut it seems that tolerance is always set to intersect. I cant alter it.\r\n\r\n[CodePen.io](http://codepen.io/TheM/pen/BoKRvq)"}}