GUI2 Bug fixes to Topo view
Change-Id: Ib40279fec94ffecb1d6c771aa376ad1cded03c02
diff --git a/web/gui2-topo-lib/projects/gui2-topo-lib/src/lib/topology/topology.component.html b/web/gui2-topo-lib/projects/gui2-topo-lib/src/lib/topology/topology.component.html
index 1f6c07e..e7425d1 100644
--- a/web/gui2-topo-lib/projects/gui2-topo-lib/src/lib/topology/topology.component.html
+++ b/web/gui2-topo-lib/projects/gui2-topo-lib/src/lib/topology/topology.component.html
@@ -56,7 +56,7 @@
are driven by the d3.force engine
-->
<svg:svg #svgZoom xmlns:svg="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000" id="topo2"
- preserveAspectRatio="xMaxYMax meet">
+ preserveAspectRatio="xMaxYMax meet" (click)="backgroundClicked($event)">
<svg:desc>The main SVG canvas of the Topology View</svg:desc>
<svg:g *ngIf="force.regionData?.devices[0].length +
force.regionData?.devices[1].length +
diff --git a/web/gui2-topo-lib/projects/gui2-topo-lib/src/lib/topology/topology.component.ts b/web/gui2-topo-lib/projects/gui2-topo-lib/src/lib/topology/topology.component.ts
index 601159d..8ce1a6e 100644
--- a/web/gui2-topo-lib/projects/gui2-topo-lib/src/lib/topology/topology.component.ts
+++ b/web/gui2-topo-lib/projects/gui2-topo-lib/src/lib/topology/topology.component.ts
@@ -69,6 +69,7 @@
import {ZoomableDirective} from '../layer/zoomable.directive';
import {MapObject} from '../layer/maputils';
import {LayoutService, LayoutType} from '../layout.service';
+import {SelectedEvent} from '../layer/forcesvg/visuals/nodevisual';
const TOPO2_PREFS = 'topo2_prefs';
const TOPO_MAPID_PREFS = 'topo_mapid';
@@ -86,6 +87,11 @@
const PREF_TOOLBAR = 'toolbar';
const PREF_PINNED = 'pinned';
+const BACKGROUND_ELEMENTS = [
+ 'svg topo2',
+ 'path bgmap'
+];
+
/**
* Model of the topo2_prefs object - this is a subset of the overall Prefs returned
* by the server
@@ -599,7 +605,7 @@
}
protected equalizeMasters() {
- this.wss.sendEvent('equalizeMasters', null);
+ this.wss.sendEvent('equalizeMasters', {});
this.flashMsg = this.lionFn('fl_eq_masters');
this.log.debug('equalizing masters');
}
@@ -700,6 +706,18 @@
this.log.debug('Map zoom prefs updated', zoomMapExtents);
}
+ backgroundClicked(event: MouseEvent) {
+ const elemTagName = event.target['tagName'] + ' ' + event.target['id'];
+ if (BACKGROUND_ELEMENTS.includes(elemTagName)) {
+ this.force.updateSelected(
+ <SelectedEvent>{
+ uiElement: undefined,
+ deselecting: true
+ }
+ );
+ }
+ }
+
/**
* Read the LION bundle for Toolbar and set up the lionFn
*/