Some fixes in the arrows with interfaces.

This commit is contained in:
mdtrooper 2016-05-17 15:05:50 +02:00
parent 8a4d627ca6
commit 37fe7a6601
2 changed files with 23 additions and 9 deletions

View File

@ -3284,8 +3284,16 @@ function get_size_element(element) {
* This function returns the element radius * This function returns the element radius
*/ */
function get_radius_element(element) { function get_radius_element(element) {
var size = get_size_element(element); // Hack for the circle items
if (!d3.select(element + " .layout_size_node circle").empty()) {
return Math.sqrt( return parseFloat(
Math.pow(size[0] / 2, 2) + Math.pow(size[1] / 2, 2)); d3.select(element + " .layout_size_node circle").attr("r"));
}
else {
//~ var size = get_size_element(element);
var size = get_size_element(element + " .layout_size_node");
return Math.sqrt(
Math.pow(size[0] / 2, 2) + Math.pow(size[1] / 2, 2));
}
} }

View File

@ -904,9 +904,15 @@ NetworkmapController.prototype.paint_node = function(g_node, node) {
.attr("data-status", node['status']) .attr("data-status", node['status'])
.attr("data-status_color", node['color']); .attr("data-status_color", node['color']);
var d3_node_icon = d3_node.append("g")
.attr("class", "icon")
.attr("class", "layout_size_node");
var d3_node_title_layout = d3_node.append("g")
.attr("class", "title");
switch (node['shape']) { switch (node['shape']) {
case 'square': case 'square':
d3_node.append("rect") d3_node_icon.append("rect")
.attr("height", node['height']) .attr("height", node['height'])
.attr("width", node['width']) .attr("width", node['width'])
.attr("x", 0) .attr("x", 0)
@ -915,7 +921,7 @@ NetworkmapController.prototype.paint_node = function(g_node, node) {
.style("stroke-width", 1); .style("stroke-width", 1);
break; break;
case 'circle': case 'circle':
d3_node.append("circle") d3_node_icon.append("circle")
.attr("r", node['width'] / 2) .attr("r", node['width'] / 2)
.attr("transform", "translate(" + .attr("transform", "translate(" +
node['width'] / 2 + " " + node['width'] / 2 + " " +
@ -924,7 +930,7 @@ NetworkmapController.prototype.paint_node = function(g_node, node) {
.style("stroke-width", 1); .style("stroke-width", 1);
break; break;
case 'rhombus': case 'rhombus':
d3_node.append("rect") d3_node_icon.append("rect")
.attr("transform", .attr("transform",
"rotate(45 " + (node['width'] / 2) + " " + (node['height'] / 2) + " )") "rotate(45 " + (node['width'] / 2) + " " + (node['height'] / 2) + " )")
.attr("height", node['height']) .attr("height", node['height'])
@ -937,7 +943,7 @@ NetworkmapController.prototype.paint_node = function(g_node, node) {
} }
// Title // Title
var d3_node_title = d3_node.append("text"); var d3_node_title = d3_node_title_layout.append("text");
d3_node_title d3_node_title
.text(node['title']) .text(node['title'])
@ -962,7 +968,7 @@ NetworkmapController.prototype.paint_node = function(g_node, node) {
d3_node d3_node
.style("fill", node['color']); .style("fill", node['color']);
d3_node d3_node_icon
.append("image") .append("image")
.attr("xlink:href", node['image']) .attr("xlink:href", node['image'])
.attr("x", NODE_IMAGE_PADDING) .attr("x", NODE_IMAGE_PADDING)