New maps in progress... (Fixing arrow position)

This commit is contained in:
Arturo Gonzalez 2016-03-07 10:48:03 +01:00
parent b3e015740e
commit c75929d840
2 changed files with 13 additions and 11 deletions

View File

@ -274,8 +274,9 @@ $this->edges = json_decode(
$this->edges = json_decode(
'[
{"to":"218","from":"214","graph_id":400},
{"to":"217","from":"214","graph_id":401}
{"to":"217","from":"214","graph_id":401},
{"to":"216","from":"214","graph_id":402},
{"to":"215","from":"214","graph_id":403}
]', true);
//~ $this->edges = json_decode('[{"to":"165","from":"166","graph_id":208}]', true);

View File

@ -396,30 +396,31 @@ function arrow_by_pieces(target, id_arrow, id_node_to, id_node_from, wait) {
var arrow_body_b = arrow_body.node().getBBox();
var arrow_body_height = (arrow_body_b['height'] + arrow_body_b['y']);
var arrow_body_width = (arrow_body_b['width'] + arrow_body_b['x']);
console.log("---------------------------");
console.log("c_elem1 (FROM)", c_elem1);
console.log("c_elem2 (TO)", c_elem2);
if (c_elem1[0] < c_elem2[0]) {
console.log("---------------------------");
if ((c_elem1[0] < c_elem2[0]) && (c_elem1[1] == c_elem2[1])) {
transform.translate[0] = c_elem1[0] + radius_from;
transform.translate[1] = c_elem1[1] - (arrow_body_height/2);
transform.rotate = get_angle_of_line(c_elem1, c_elem2) +
" 0 " + (arrow_body_height / 2);
}
else if (c_elem1[0] > c_elem2[0]) {
else if ((c_elem1[0] > c_elem2[0]) && (c_elem1[1] == c_elem2[1])) {
transform.translate[0] = c_elem1[0] - radius_from;
transform.translate[1] = c_elem1[1] - (arrow_body_height/2);
transform.rotate = get_angle_of_line(c_elem1, c_elem2) +
" 0 " + (arrow_body_height / 2);
}
else if (c_elem1[1] < c_elem2[1]) {
transform.translate[0] = c_elem1[0] + radius_from;
transform.translate[1] = c_elem1[1] - (arrow_body_height/2);
else if ((c_elem1[1] < c_elem2[1]) && (c_elem1[0] == c_elem2[0])) {
transform.translate[0] = c_elem1[0];
transform.translate[1] = c_elem1[1] - (arrow_body_height/2) + radius_from;
transform.rotate = get_angle_of_line(c_elem1, c_elem2) +
" 0 " + (arrow_body_height / 2);
}
else if (c_elem1[1] > c_elem2[1]) {
transform.translate[0] = c_elem1[0] - radius_from;
transform.translate[1] = c_elem1[1] - (arrow_body_height/2);
else if ((c_elem1[1] > c_elem2[1]) && (c_elem1[0] == c_elem2[0])) {
transform.translate[0] = c_elem1[0];
transform.translate[1] = c_elem1[1] - (arrow_body_height/2) - radius_from;
transform.rotate = get_angle_of_line(c_elem1, c_elem2) +
" 0 " + (arrow_body_height / 2);
}