Commit 3f089bd5 authored by Fintan Mc Gee's avatar Fintan Mc Gee

add functionality so that clicking on a node maintains the opacity highlight

parent 6da0e3d1
......@@ -178,19 +178,23 @@ angular.module('blizaarModule.controllers')
}
}
$scope.highlightNeighbourSetInAll = function(nodeUid, layerName) {
$scope.highlightNeighbourSetInAll = function(nodeUid, layerName, clickSelect) {
// get the set of node Neighbours in Layer
var highlightNodeIds = multiLayerGraphService.getGraph().getLayerByName(layerName).getNeighboursByUid(nodeUid);
highlightNodeIds.push(nodeUid)
$scope.highlightNodeIds = angular.copy(highlightNodeIds);
$scope.$broadcast("highlightNodeSet",{ nodeUidArray: highlightNodeIds});
$scope.$broadcast("highlightNodeSet",{ nodeUidArray: highlightNodeIds, clickSelect:clickSelect});
}
$scope.clearHighlight = function() {
$scope.$broadcast("highlightNodeSet");
$scope.clearHighlight = function(clickSelect) {
if(!clickSelect) {
$scope.$broadcast("highlightNodeSet");
}else {
$scope.$broadcast("highlightNodeSet",{ clickSelect:clickSelect});
}
}
$scope.$watch('model.selectedLayerLocal', function(newData, oldData){
......
......@@ -168,6 +168,8 @@ angular.module('blizaarModule.directives')
visualHighlightType = "fadeOthers",
crossGraphMouseover = false; // options are "halo" and "fadeOthers"
var keepHighlight =false; // used to determine if a higlight should be removed
// noinspection JSUnresolvedVariable
if(params !== undefined && params.givenid !== undefined) {
// noinspection JSUnresolvedVariable
......@@ -438,14 +440,16 @@ angular.module('blizaarModule.directives')
mouseover = function (n) {
//tooltipService.showTooltipForNode(n);
tooltipService.showCustomTooltipForNode(n,graphData.name);
if(crossGraphMouseover) {
// keepHighlight = false;
if(crossGraphMouseover && !keepHighlight) {
scope.highlightNeighbourSetInAll(n.uid, graphData.name)
};
};
// Describe the mouse out methods
mouseout = function () {
tooltipService.hideTooltip();
if(crossGraphMouseover) {
if(crossGraphMouseover && !keepHighlight) {
scope.clearHighlight();
}
};
......@@ -530,13 +534,28 @@ angular.module('blizaarModule.directives')
.on("mouseover", mouseover)
.on("mouseout", mouseout)
.on("dblclick", dbclick)
.on("click", function(node){
.on("click", function(n){
if (d3.event.ctrlKey) {
scope.addOrRemoveNodeFromSelection(node, false, selectAcrossAllLayers);
scope.addOrRemoveNodeFromSelection(n, false, selectAcrossAllLayers);
} else {
// if ctrl is not select replace with current node
scope.clearSelection();
scope.addOrRemoveNodeFromSelection(node, false, selectAcrossAllLayers);
// scope.clearSelection();
// scope.addOrRemoveNodeFromSelection(node, false, selectAcrossAllLayers);
if(crossGraphMouseover) {
if(keepHighlight) {
keepHighlight = false;
scope.clearHighlight(keepHighlight);
} else {
keepHighlight = true;
scope.highlightNeighbourSetInAll(n.uid, graphData.name,keepHighlight)
}
// scope.clearHighlight();
// clear the existing highlight
};
}
})
.on("contextmenu", function (n) {
......@@ -791,19 +810,28 @@ angular.module('blizaarModule.directives')
scope.$on('highlightNodeSet', function(event, params){
// this message send a set of UIDs which are to be highlighted
if(!params) {
if(!params || !params.nodeUidArray ) {
node.attr("opacity", 1.0);
link.attr("opacity", 1.0);
keepHighlight = false;
visualHiglightList = null
} else {
visualHiglightList = {};
if( params.nodeUidArray) {
visualHiglightList = {};
params.nodeUidArray.forEach(function (item) {
visualHiglightList[item] = 0;
});
if (visualHighlightType === "fadeOthers") {
doHighlightFade();
if(params.clickSelect) {
keepHighlight = true;
node.attr("opacity", 1.0);
link.attr("opacity", 1.0);
}
if(params.nodeUidArray) {
doHighlightFade();
}
}else {
updateGraph(true);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment