mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 00:04:37 +02:00
Link the tooltipster to d3 event.
This commit is contained in:
parent
799730c48d
commit
dce72cbca2
@ -218,6 +218,12 @@ MapController.prototype.init_events = function(principalObject) {
|
|||||||
d3.select("#node_" + d['graph_id'])
|
d3.select("#node_" + d['graph_id'])
|
||||||
.select("circle")
|
.select("circle")
|
||||||
.attr("style", "fill: rgb(50, 50, 128);");
|
.attr("style", "fill: rgb(50, 50, 128);");
|
||||||
|
})
|
||||||
|
.on("click", function(d) {
|
||||||
|
if (d3.event.defaultPrevented) return;
|
||||||
|
|
||||||
|
|
||||||
|
self.tooltip_map_create(self, this);
|
||||||
});
|
});
|
||||||
|
|
||||||
var drag = d3.behavior.drag()
|
var drag = d3.behavior.drag()
|
||||||
@ -252,40 +258,17 @@ MapController.prototype.init_events = function(principalObject) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
Function click_event
|
|
||||||
Return void
|
|
||||||
This function manages mouse clicks and run events in consecuence
|
|
||||||
*/
|
|
||||||
MapController.prototype.click_event = function(event) {
|
|
||||||
var self = event.data.map;
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
switch (event.which) {
|
|
||||||
case 1:
|
|
||||||
if ($(event.currentTarget).parent().hasClass("node")) {
|
|
||||||
self.tooltip_map_create(self, event);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Function tooltip_map_create
|
Function tooltip_map_create
|
||||||
Return void
|
Return void
|
||||||
This function manages nodes tooltips
|
This function manages nodes tooltips
|
||||||
*/
|
*/
|
||||||
MapController.prototype.tooltip_map_create = function(self, event) {
|
MapController.prototype.tooltip_map_create = function(self, target) {
|
||||||
var nodeTarget = $(event.currentTarget).parent();
|
var nodeTarget = $(target);
|
||||||
var spinner = $('#spinner_tooltip').html();
|
var spinner = $('#spinner_tooltip').html();
|
||||||
|
|
||||||
var nodeR = parseInt($(event.currentTarget).attr("r"));
|
|
||||||
|
var nodeR = parseInt($("circle", nodeTarget).attr("r"));
|
||||||
nodeR = nodeR * self._zoomManager.scale(); // Apply zoom
|
nodeR = nodeR * self._zoomManager.scale(); // Apply zoom
|
||||||
var node_id = nodeTarget.attr("id");
|
var node_id = nodeTarget.attr("id");
|
||||||
|
|
||||||
@ -308,6 +291,7 @@ MapController.prototype.tooltip_map_create = function(self, event) {
|
|||||||
offsetX: nodeR,
|
offsetX: nodeR,
|
||||||
theme: 'tooltipster-noir',
|
theme: 'tooltipster-noir',
|
||||||
multiple: true,
|
multiple: true,
|
||||||
|
interactive: true,
|
||||||
content: spinner,
|
content: spinner,
|
||||||
functionBefore: function(origin, continueTooltip) {
|
functionBefore: function(origin, continueTooltip) {
|
||||||
continueTooltip();
|
continueTooltip();
|
||||||
@ -316,7 +300,7 @@ MapController.prototype.tooltip_map_create = function(self, event) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this._tooltipsID.push(node_id);
|
this._tooltipsID.push(node_id);
|
||||||
|
|
||||||
nodeTarget.tooltipster("show");
|
nodeTarget.tooltipster("show");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user