kosmtik-map-compare
Advanced tools
Comparing version 0.0.10 to 0.0.11
36
front.js
@@ -23,2 +23,35 @@ var TILELAYERS = [ | ||
L.K.MapCompare = L.Evented.extend({ | ||
initialize: function () { | ||
this._maps = []; | ||
for (var i = 0; i < arguments.length; i++) { | ||
this.register(arguments[i]); | ||
} | ||
}, | ||
register: function (map) { | ||
if (this._maps.indexOf(map) !== -1) return; | ||
this._maps.push(map); | ||
map.on('moveend', this.moveend, this); | ||
}, | ||
moveend: function (e) { | ||
if (!this._master) { | ||
this._master = e.target; | ||
this.propagate(); | ||
this._master = null; | ||
} | ||
}, | ||
propagate: function () { | ||
for (var map of this._maps) { | ||
if (map === this._master) continue; | ||
map.setView(this._master.getCenter(), this._master.getZoom(), {animate: false}); | ||
} | ||
} | ||
}); | ||
L.K.Map.addInitHook(function () { | ||
@@ -28,2 +61,3 @@ this.whenReady(function () { | ||
title = L.DomUtil.create('h3', '', container), | ||
self = this, | ||
params = { | ||
@@ -44,3 +78,3 @@ tms: false, | ||
tilelayer = L.tileLayer(L.K.Config.project.compareUrl, params).addTo(otherMap); | ||
new L.Hash(otherMap); | ||
new L.K.MapCompare(self, otherMap); | ||
}; | ||
@@ -47,0 +81,0 @@ var builder = new L.K.FormBuilder(params, [ |
{ | ||
"name": "kosmtik-map-compare", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"description": "Add a map to compare side-by-side with your work", | ||
@@ -25,3 +25,3 @@ "main": "index.js", | ||
"homepage": "https://github.com/kosmtik/kosmtik-map-compare", | ||
"kosmtik": "~0.0.11" | ||
"kosmtik": "~0.0.13" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
82220
151