Fixed a position of interface in the arrow

This commit is contained in:
mdtrooper 2016-03-23 13:14:16 +01:00
parent 58a0f51f01
commit bb01f00e8a
1 changed files with 23 additions and 7 deletions

View File

@ -571,6 +571,16 @@ NetworkmapController.prototype.arrow_by_pieces_AMMA = function (target, arrow_da
var transform = d3.transform(); var transform = d3.transform();
var arrow_head = arrow_layout.select(".head");
var arrow_head_b = arrow_head.node().getBBox();
var arrow_head_height = (arrow_head_b['height'] + arrow_head_b['y']);
var arrow_head_width = (arrow_head_b['width'] + arrow_head_b['x']);
var arrow_tail = arrow_layout.select(".tail");
var arrow_tail_b = arrow_tail.node().getBBox();
var arrow_tail_height = (arrow_tail_b['height'] + arrow_tail_b['y']);
var arrow_tail_width = (arrow_tail_b['width'] + arrow_tail_b['x']);
/*---------------------------------------------*/ /*---------------------------------------------*/
/*--- Position of layer arrow (body + head) ---*/ /*--- Position of layer arrow (body + head) ---*/
/*---------------------------------------------*/ /*---------------------------------------------*/
@ -586,7 +596,7 @@ NetworkmapController.prototype.arrow_by_pieces_AMMA = function (target, arrow_da
arrow_layout.select(".arrow_position_rotation") arrow_layout.select(".arrow_position_rotation")
.attr("transform", transform.toString()); .attr("transform", transform.toString());
transform = d3.transform(); transform = d3.transform();
transform.translate[0] = radius_from; transform.translate[0] = radius_from + arrow_tail_width;
transform.translate[1] = - (arrow_body_height / 2); transform.translate[1] = - (arrow_body_height / 2);
arrow_layout.select(".arrow_translation") arrow_layout.select(".arrow_translation")
.attr("transform", transform.toString()); .attr("transform", transform.toString());
@ -594,12 +604,7 @@ NetworkmapController.prototype.arrow_by_pieces_AMMA = function (target, arrow_da
/*---------------------------------------------*/ /*---------------------------------------------*/
/*-------- Resize the body arrow width --------*/ /*-------- Resize the body arrow width --------*/
/*---------------------------------------------*/ /*---------------------------------------------*/
var arrow_head = arrow_layout.select(".head"); var body_width = distance - arrow_head_width - arrow_tail_width - radius_to - radius_from;
var arrow_head_b = arrow_head.node().getBBox();
var arrow_head_height = (arrow_head_b['height'] + arrow_head_b['y']);
var arrow_head_width = (arrow_head_b['width'] + arrow_head_b['x']);
var body_width = distance - arrow_head_width - radius_to - radius_from;
transform = d3.transform(); transform = d3.transform();
transform.scale[0] = body_width / arrow_body_width; transform.scale[0] = body_width / arrow_body_width;
@ -622,6 +627,17 @@ NetworkmapController.prototype.arrow_by_pieces_AMMA = function (target, arrow_da
arrow_head.attr("transform", transform.toString()); arrow_head.attr("transform", transform.toString());
transform = d3.transform();
x = 0 - arrow_tail_width;
y = 0 + (arrow_body_height / 2 - arrow_tail_height / 2);
transform.translate[0] = x;
transform.translate[1] = y;
arrow_tail.attr("transform", transform.toString());
/*---------------------------------------------*/ /*---------------------------------------------*/
/*------- Show the result in one time ---------*/ /*------- Show the result in one time ---------*/
/*---------------------------------------------*/ /*---------------------------------------------*/