{"action":"created","issue":{"url":"https://api.github.com/repos/sporritt/jsPlumb/issues/311","labels_url":"https://api.github.com/repos/sporritt/jsPlumb/issues/311/labels{/name}","comments_url":"https://api.github.com/repos/sporritt/jsPlumb/issues/311/comments","events_url":"https://api.github.com/repos/sporritt/jsPlumb/issues/311/events","html_url":"https://github.com/sporritt/jsPlumb/issues/311","id":53773973,"number":311,"title":"Reopen of 288 - addType resets overlays","user":{"login":"Deklin","id":3372511,"avatar_url":"https://avatars.githubusercontent.com/u/3372511?v=3","gravatar_id":"","url":"https://api.github.com/users/Deklin","html_url":"https://github.com/Deklin","followers_url":"https://api.github.com/users/Deklin/followers","following_url":"https://api.github.com/users/Deklin/following{/other_user}","gists_url":"https://api.github.com/users/Deklin/gists{/gist_id}","starred_url":"https://api.github.com/users/Deklin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Deklin/subscriptions","organizations_url":"https://api.github.com/users/Deklin/orgs","repos_url":"https://api.github.com/users/Deklin/repos","events_url":"https://api.github.com/users/Deklin/events{/privacy}","received_events_url":"https://api.github.com/users/Deklin/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-08T17:02:14Z","updated_at":"2015-01-08T23:50:11Z","closed_at":"2015-01-08T23:48:34Z","body":"I tested the patch on both 1.7.3. alpha as well as pulled the change for 288 and unfortunately the issue still exists.\r\n\r\nWhat is happening is when you use addType on a connection, the overlay is reset back to default. \r\n\r\nIf its a custom overlay, its reset, if its a label overlay the label value is blown away.\r\n\r\nA simple way to test this is \r\nFollowing the unit test here;\r\nhttps://github.com/sporritt/jsPlumb/commit/bc1a450b430dba6b7bab9bfb556239cccb209100\r\n\r\n        ok(e.getOverlay(\"myLabel1\") != null, \"label overlay was retrieved\");\r\n+\r\n+        e.addType(\"selected\");\r\n+        ok(e.getOverlay(\"myLabel1\") != null, \"label overlay was not blown away\");\r\n+        e.removeType(\"selected\");\r\n+        ok(e.getOverlay(\"myLabel1\") != null, \"label overlay was not blown away\");\r\n\r\nThis is not in fact destroying the label, instead do this\r\n\r\nvar labelOverlay;\r\nlabelOverlay = e.getOverlay(\"myLabel1\");\r\nlabelOverlay.setLabel(\"foo\");\r\nok(labelOverlay.getLabel() === \"foo\");\r\ne.addType(\"selected\");\r\nlabelOverlay = e.getOverlay(\"myLabel1\");\r\nok(labelOverlay.getLabel() === \"foo\"); // This will fail as label was reset\r\n\r\nIf you perform the same test with a custom overlay, the entire overlay is also reset back to its initial 'create' state.\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/sporritt/jsPlumb/issues/comments/69271722","html_url":"https://github.com/sporritt/jsPlumb/issues/311#issuecomment-69271722","issue_url":"https://api.github.com/repos/sporritt/jsPlumb/issues/311","id":69271722,"user":{"login":"sporritt","id":262720,"avatar_url":"https://avatars.githubusercontent.com/u/262720?v=3","gravatar_id":"","url":"https://api.github.com/users/sporritt","html_url":"https://github.com/sporritt","followers_url":"https://api.github.com/users/sporritt/followers","following_url":"https://api.github.com/users/sporritt/following{/other_user}","gists_url":"https://api.github.com/users/sporritt/gists{/gist_id}","starred_url":"https://api.github.com/users/sporritt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sporritt/subscriptions","organizations_url":"https://api.github.com/users/sporritt/orgs","repos_url":"https://api.github.com/users/sporritt/repos","events_url":"https://api.github.com/users/sporritt/events{/privacy}","received_events_url":"https://api.github.com/users/sporritt/received_events","type":"User","site_admin":false},"created_at":"2015-01-08T23:50:10Z","updated_at":"2015-01-08T23:50:10Z","body":"tracking this in the [original issue](https://github.com/sporritt/jsPlumb/issues/288)"}}