Working in the selected nodes and zoom.

This commit is contained in:
mdtrooper 2016-03-29 12:35:08 +02:00
parent b10e11d2a9
commit 86b084b2e4
1 changed files with 16 additions and 3 deletions

View File

@ -41,6 +41,7 @@ MapController.prototype._start_multiple_selection = false;
MapController.prototype._flag_multiple_selection = false; MapController.prototype._flag_multiple_selection = false;
MapController.prototype._stop_dragging = false; MapController.prototype._stop_dragging = false;
MapController.prototype._cache_files = {}; MapController.prototype._cache_files = {};
MapController.prototype._last_event = null;
/*-----------------------------------------------*/ /*-----------------------------------------------*/
/*--------------------Methods--------------------*/ /*--------------------Methods--------------------*/
@ -78,6 +79,7 @@ MapController.prototype.init_map = function() {
self.remove_resize_square(); self.remove_resize_square();
if (!self._flag_multiple_selection) { if (!self._flag_multiple_selection) {
self.last_event = "zoom";
var zoom_level = d3.event.scale; var zoom_level = d3.event.scale;
@ -88,8 +90,12 @@ MapController.prototype.init_map = function() {
"translate(" + d3.event.translate + ") scale(" + d3.event.scale + ")"); "translate(" + d3.event.translate + ") scale(" + d3.event.scale + ")");
self.zoom_minimap(); self.zoom_minimap();
} }
else { else {
self.last_event = null;
// Reset the zoom and panning actual // Reset the zoom and panning actual
var viewport_transform = d3.transform( var viewport_transform = d3.transform(
d3.select(self._target + " .viewport").attr("transform")); d3.select(self._target + " .viewport").attr("transform"));
@ -1417,9 +1423,6 @@ MapController.prototype.init_events = function(principalObject) {
d3.event.offsetX, d3.event.offsetX,
d3.event.offsetY, true); d3.event.offsetY, true);
} }
else {
self.remove_selection_nodes();
}
}); });
d3.select(self._target + " svg").on("mousemove", d3.select(self._target + " svg").on("mousemove",
@ -1431,6 +1434,16 @@ MapController.prototype.init_events = function(principalObject) {
} }
}); });
d3.select(self._target + " svg").on("mouseup",
function() {
if (!self._flag_multiple_selection) {
if (self.last_event != "zoom")
self.remove_selection_nodes();
self.last_event = null;
}
});
/** /**
* Function dragstarted * Function dragstarted
* Return void * Return void