From 1b7c1efe4b6e94b743dd0389ac88ad5faf86799c Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Tue, 29 Mar 2016 09:30:20 +0200 Subject: [PATCH] Select box runs fine with any zoom level and or panning. --- .../include/javascript/map/MapController.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pandora_console/include/javascript/map/MapController.js b/pandora_console/include/javascript/map/MapController.js index 403d362e44..ee747b4a9f 100644 --- a/pandora_console/include/javascript/map/MapController.js +++ b/pandora_console/include/javascript/map/MapController.js @@ -1608,15 +1608,17 @@ MapController.prototype.multiple_selection_select_nodes = function() { var zoom = d3.transform( d3.select(self._target + " .viewport").attr("transform")); - selection_box_dimensions["x"] = (selection_box_dimensions["x"] - - zoom.translate[0]); // / zoom.scale[0]; - selection_box_dimensions["y"] = (selection_box_dimensions["y"] - - zoom.translate[1]); // / zoom.scale[1]; + console.log("zoom", zoom); + + selection_box_dimensions["x"] = (selection_box_dimensions["x"] / zoom.scale[0] + - zoom.translate[0] / zoom.scale[0]); + selection_box_dimensions["y"] = (selection_box_dimensions["y"] / zoom.scale[1] + - zoom.translate[1] / zoom.scale[1]); selection_box_dimensions["width"] = - selection_box_dimensions["width"] * zoom.scale[0]; + selection_box_dimensions["width"] / zoom.scale[0]; selection_box_dimensions["height"] = - selection_box_dimensions["height"] * zoom.scale[1]; + selection_box_dimensions["height"] / zoom.scale[1]; $.each(nodes, function(i, node) { if (node.type != ITEM_TYPE_AGENT_NETWORKMAP)