Fix spaces

This commit is contained in:
neveldo
2015-01-04 11:29:47 +01:00
parent af6dac12c9
commit 5c19e18823

View File

@ -18,7 +18,7 @@
// Extend legend default options with user options
options = $.extend(true, {}, $.fn.mapael.defaultOptions, options);
for (var type in options.legend) {
for (var type in options.legend) {
if ($.isArray(options.legend[type])) {
for (var i = 0; i < options.legend[type].length; ++i)
options.legend[type][i] = $.extend(true, {}, $.fn.mapael.legendDefaultOptions[type], options.legend[type][i]);
@ -72,16 +72,16 @@
plots[id] = $.fn.mapael.drawPlot(id, options, mapConf, paper, $tooltip);
}
/**
* Zoom on the map at a specific level focused on specific coordinates
* If no coordinates are specified, the zoom will be focused on the center of the map
* options :
* "level" : level of the zoom between 0 and maxLevel
* "x" or "latitude" : x coordinate or latitude of the point to focus on
* "y" or "longitude" : y coordinate or longitude of the point to focus on
* "fixedCenter" : set to true in order to preserve the position of x,y in the canvas when zoomed
*/
$self.on("zoom", function(e, zoomOptions) {
/**
* Zoom on the map at a specific level focused on specific coordinates
* If no coordinates are specified, the zoom will be focused on the center of the map
* options :
* "level" : level of the zoom between 0 and maxLevel
* "x" or "latitude" : x coordinate or latitude of the point to focus on
* "y" or "longitude" : y coordinate or longitude of the point to focus on
* "fixedCenter" : set to true in order to preserve the position of x,y in the canvas when zoomed
*/
$self.on("zoom", function(e, zoomOptions) {
var newLevel = Math.min(Math.max(zoomOptions.level, 0), options.map.zoom.maxLevel)
, panX = 0
, panY = 0
@ -113,8 +113,8 @@
offsetX = $self.data("panX") + ((zoomOptions.x - $self.data("panX")) * (zoomLevel - previousZoomLevel)) / zoomLevel;
offsetY = $self.data("panY") + ((zoomOptions.y - $self.data("panY")) * (zoomLevel - previousZoomLevel)) / zoomLevel;
panX = Math.min(Math.max(0, offsetX), (mapConf.width - (mapConf.width / zoomLevel)));
panY = Math.min(Math.max(0, offsetY), (mapConf.height - (mapConf.height / zoomLevel)));
panX = Math.min(Math.max(0, offsetX), (mapConf.width - (mapConf.width / zoomLevel)));
panY = Math.min(Math.max(0, offsetY), (mapConf.height - (mapConf.height / zoomLevel)));
} else {
panX = Math.min(Math.max(0, zoomOptions.x - (mapConf.width / zoomLevel)/2), (mapConf.width - (mapConf.width / zoomLevel)));
panY = Math.min(Math.max(0, zoomOptions.y - (mapConf.height / zoomLevel)/2), (mapConf.height - (mapConf.height / zoomLevel)));
@ -409,7 +409,7 @@
, acd = - 1 / ((yb - ya) / (xb - xa))
, bcd = yc - acd * xc
// dist(c,d) = dist(a,b) (=abDist)
// dist(c,d) = dist(a,b) (=abDist)
, abDist = Math.sqrt((xb-xa)*(xb-xa) + (yb-ya)*(yb-ya))
// Solution for equation dist(cd) = sqrt((xd - xc)² + (yd - yc)²)
@ -620,7 +620,7 @@
var $parentContainer = $container.parent()
, $zoomIn = $("<div>").addClass(options.zoomInCssClass).html("+")
, $zoomOut = $("<div>").addClass(options.zoomOutCssClass).html("&#x2212;")
, mousedown = false
, mousedown = false
, previousX = 0
, previousY = 0;
@ -633,18 +633,18 @@
// Panning
$("body").on("mouseup", function(e) {
mousedown = false;
mousedown = false;
setTimeout(function () {$.fn.mapael.panning = false;}, 50);
});
$container.on("mousedown", function(e) {
mousedown = true;
mousedown = true;
previousX = e.pageX;
previousY = e.pageY;
return false;
}).on("mousemove", function(e) {
var currentLevel = $parentContainer.data("zoomLevel");
if (mousedown && currentLevel != 0) {
if (mousedown && currentLevel != 0) {
var offsetX = (previousX - e.pageX) / (1 + (currentLevel * options.step)) * (mapWidth / paper.width)
, offsetY = (previousY - e.pageY) / (1 + (currentLevel * options.step)) * (mapHeight / paper.height)
, panX = Math.min(Math.max(0, paper._viewBox[0] + offsetX), (mapWidth - paper._viewBox[2]))