From c75929d8407df5fe9e9423b168f0826c5c7881b7 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Mon, 7 Mar 2016 10:48:03 +0100 Subject: [PATCH] New maps in progress... (Fixing arrow position) --- pandora_console/include/class/Map.class.php | 5 +++-- .../include/javascript/map/MapController.js | 19 ++++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/pandora_console/include/class/Map.class.php b/pandora_console/include/class/Map.class.php index 9a441629b0..522237f957 100644 --- a/pandora_console/include/class/Map.class.php +++ b/pandora_console/include/class/Map.class.php @@ -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); diff --git a/pandora_console/include/javascript/map/MapController.js b/pandora_console/include/javascript/map/MapController.js index 251c74005a..a2e9c36021 100644 --- a/pandora_console/include/javascript/map/MapController.js +++ b/pandora_console/include/javascript/map/MapController.js @@ -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); }