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
};
}]);
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2KeyCommands.js b/web/gui/src/main/webapp/app/view/topo2/topo2KeyCommands.js
index 911ec18..544dca2 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2KeyCommands.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2KeyCommands.js
@@ -29,7 +29,7 @@
R: [resetZoom, 'Reset pan / zoom'],
P: [togglePorts, 'Toggle Port Highlighting'],
E: [equalizeMasters, 'Equalize mastership roles'],
- X: [resetAllNodeLocations, 'Reset Node Location'],
+ X: [resetNodeLocation, 'Reset Node Location'],
U: [unpinNode, 'Unpin node (mouse over)'],
esc: handleEscape
@@ -129,8 +129,8 @@
flash.flash('Equalizing master roles');
}
- function resetAllNodeLocations() {
- t2fs.resetAllLocations();
+ function resetNodeLocation() {
+ t2fs.resetNodeLocation();
flash.flash('Reset node locations');
}