ONOS-5403: cleaned up code change to match coding style.

Change-Id: If1ba37d8f4b6d3296a057bbf2dfa042ed2051eab
This commit is contained in:
Simon Hunt 2016-11-19 09:06:17 -08:00
parent 0cf084b162
commit f9761458ec
2 changed files with 25 additions and 33 deletions

View File

@ -117,23 +117,24 @@
minDist = proximity * 2; minDist = proximity * 2;
network.links.forEach(function (d) { network.links.forEach(function (d) {
var line = d.position,
point,
hit,
dist;
if (!api.showHosts() && d.type() === 'hostLink') { if (!api.showHosts() && d.type() === 'hostLink') {
return; // skip hidden host links return; // skip hidden host links
} }
if(d.position != null) if (line) {
{ point = pdrop(line, mouse);
var line = d.position, hit = lineHit(line, point, mouse);
point = pdrop(line, mouse), if (hit) {
hit = lineHit(line, point, mouse), dist = mdist(point, mouse);
dist; if (dist < minDist) {
} minDist = dist;
nearest = d;
if (hit) { }
dist = mdist(point, mouse);
if (dist < minDist) {
minDist = dist;
nearest = d;
} }
} }
}); });
@ -225,17 +226,11 @@
tss.deselectAll(); tss.deselectAll();
if(ldata != null) if (ldata) {
{
if (!ldata.el.classed('selected')) {
selLink(ldata);
return;
}
if (ldata.el.classed('selected')) { if (ldata.el.classed('selected')) {
unselLink(ldata); unselLink(ldata);
return; } else {
selLink(ldata);
} }
} }
} }

View File

@ -107,18 +107,15 @@
}); });
} }
if (obj !=null) if (obj && obj.class === 'link') {
{ if (selections[obj.key]) {
if (obj.class === 'link') { deselectObject(obj.key);
if (selections[obj.key]) { } else {
deselectObject(obj.key); selections[obj.key] = { obj: obj, el: el };
} else { selectOrder.push(obj.key);
selections[obj.key] = { obj: obj, el: el };
selectOrder.push(obj.key);
}
updateDetail();
return;
} }
updateDetail();
return;
} }
if (!n) { if (!n) {