mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 00:34:46 +02:00
An another changes.
This commit is contained in:
parent
9648affaaa
commit
3eddfb2c7f
@ -25,6 +25,7 @@ var MapController = function(target) {
|
|||||||
|
|
||||||
MapController.prototype._id = null;
|
MapController.prototype._id = null;
|
||||||
MapController.prototype._tooltipsID = null;
|
MapController.prototype._tooltipsID = null;
|
||||||
|
MapController.prototype._viewport = null;
|
||||||
|
|
||||||
/*--------------------Methods----------------------*/
|
/*--------------------Methods----------------------*/
|
||||||
/*
|
/*
|
||||||
@ -33,22 +34,27 @@ Return void
|
|||||||
This function init the map
|
This function init the map
|
||||||
*/
|
*/
|
||||||
MapController.prototype.init_map = function() {
|
MapController.prototype.init_map = function() {
|
||||||
var svg = d3.select(this._target + " svg");
|
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
var viewport = svg
|
var svg = d3.select(this._target + " svg");
|
||||||
|
|
||||||
|
|
||||||
|
self._viewport = svg
|
||||||
.call(d3.behavior.zoom().scaleExtent([1/100, 100]).on("zoom", zoom))
|
.call(d3.behavior.zoom().scaleExtent([1/100, 100]).on("zoom", zoom))
|
||||||
.append("g")
|
.append("g")
|
||||||
.attr("class", "viewport");
|
.attr("class", "viewport");
|
||||||
|
|
||||||
|
|
||||||
function zoom() {
|
function zoom() {
|
||||||
self.tooltip_map_close();
|
self.tooltip_map_close();
|
||||||
viewport
|
|
||||||
|
self._viewport
|
||||||
.attr("transform", "translate(" + d3.event.translate + ")scale(" + d3.event.scale + ")");
|
.attr("transform", "translate(" + d3.event.translate + ")scale(" + d3.event.scale + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.paint_nodes(viewport);
|
|
||||||
|
|
||||||
|
self.paint_nodes();
|
||||||
//~
|
//~
|
||||||
//~ viewport.append("g").append("circle")
|
//~ viewport.append("g").append("circle")
|
||||||
//~ .attr("id", "node_10")
|
//~ .attr("id", "node_10")
|
||||||
@ -120,10 +126,10 @@ MapController.prototype.init_map = function() {
|
|||||||
this.init_events();
|
this.init_events();
|
||||||
};
|
};
|
||||||
|
|
||||||
MapController.prototype.paint_nodes = function(viewport) {
|
MapController.prototype.paint_nodes = function() {
|
||||||
console.log(nodes);
|
|
||||||
|
|
||||||
viewport.selectAll(".node")
|
|
||||||
|
this._viewport.selectAll(".node")
|
||||||
.data(nodes)
|
.data(nodes)
|
||||||
.enter()
|
.enter()
|
||||||
.append("g").append("circle")
|
.append("g").append("circle")
|
||||||
@ -152,12 +158,15 @@ Return void
|
|||||||
This function manages mouse clicks and run events in consecuence
|
This function manages mouse clicks and run events in consecuence
|
||||||
*/
|
*/
|
||||||
MapController.prototype.click_event = function(event) {
|
MapController.prototype.click_event = function(event) {
|
||||||
|
|
||||||
var self = event.data.map;
|
var self = event.data.map;
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
switch (event.which) {
|
switch (event.which) {
|
||||||
case 1:
|
case 1:
|
||||||
|
|
||||||
if ($(event.currentTarget).hasClass("node")) {
|
if ($(event.currentTarget).hasClass("node")) {
|
||||||
|
|
||||||
self.tooltip_map_create(self, event);
|
self.tooltip_map_create(self, event);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user