Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

Commit

Permalink
Added link (edge) details on 'mouseover' and selection on 'click'
Browse files Browse the repository at this point in the history
Signed-off-by: Liviu Popa <[email protected]>
  • Loading branch information
lcpopa committed May 9, 2022
1 parent 7d6da8a commit 91b71d7
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions happi-graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ class HappiGraph extends PolymerElement {
mousePosition: {
type: Object,
value: null
},
mousePositionEventListener: {
type: Object,
value: null
}
};
}
Expand Down Expand Up @@ -362,11 +366,21 @@ class HappiGraph extends PolymerElement {
this.allGroup ? this.allGroup.remove() : (this.debug ? console.log('ALL_GROUP_EMPTY') : 0);
}

createMousePositionEventListener(){
this.mousePositionEventListener = function (event) {
this.mousePosition = {x: event.x, y: event.y};
};
}

disconnectedCallback() {
this.removeEventListener(this, this.mousePositionEventListener);
}

initGraph() {
this.svg = d3.select(this.$.svg);
this.addEventListener('mousemove', function (event) {
this.mousePosition = {x: event.x, y: event.y};
})

this.createMousePositionEventListener();
this.addEventListener('mousemove', this.mousePositionEventListener);

this.allGroup =
this.svg
Expand Down

0 comments on commit 91b71d7

Please sign in to comment.