Topo2: Reset node position when hovered and 'R' is pressed
Change-Id: I4e2ce27bf255b7a94c089cef8f234f953c56d74c
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2Force.js b/web/gui/src/main/webapp/app/view/topo2/topo2Force.js
index 62e3c16..56ba42f 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2Force.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2Force.js
@@ -160,15 +160,15 @@
update(t2rs.regionLinks());
}
- function resetAllLocations() {
- var nodes = t2rs.regionNodes();
+ function resetNodeLocation() {
- angular.forEach(nodes, function (node) {
- node.resetPosition();
+ var hovered = t2rs.filterRegionNodes(function (model) {
+ return model.get('hovered');
});
- t2ls.update();
- t2ls.tick();
+ angular.forEach(hovered, function (model) {
+ model.resetPosition();
+ });
}
function unpin() {
@@ -231,7 +231,7 @@
updateNodes: updateNodes,
updateLinks: updateLinks,
- resetAllLocations: resetAllLocations,
+ resetNodeLocation: resetNodeLocation,
unpin: unpin
};
}]);