[Pkg-javascript-commits] [leaflet-markercluster] 04/479: Update leaflet from master + https://github.com/CloudMade/Leaflet/pull/795
Jonas Smedegaard
dr at jones.dk
Thu Oct 16 16:00:02 UTC 2014
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository leaflet-markercluster.
commit a1d4c8078b00000ff38918fb4139b0731a300782
Author: danzel <danzel at localhost.geek.nz>
Date: Wed Jul 11 16:25:53 2012 +1200
Update leaflet from master + https://github.com/CloudMade/Leaflet/pull/795
---
lib/leaflet-dist/leaflet-src.js | 102 ++++++++++++++++++++++++++++------------
lib/leaflet-dist/leaflet.js | 2 +-
2 files changed, 73 insertions(+), 31 deletions(-)
diff --git a/lib/leaflet-dist/leaflet-src.js b/lib/leaflet-dist/leaflet-src.js
index 2199ff8..f7fe011 100644
--- a/lib/leaflet-dist/leaflet-src.js
+++ b/lib/leaflet-dist/leaflet-src.js
@@ -1942,6 +1942,24 @@ L.TileLayer = L.Class.extend({
}
},
+ setUrl: function (url, noRedraw) {
+ this._url = url;
+
+ if (!noRedraw) {
+ this.redraw();
+ }
+
+ return this;
+ },
+
+ redraw: function () {
+ if (this._map) {
+ this._reset(true);
+ this._update();
+ }
+ return this;
+ },
+
_updateOpacity: function () {
L.DomUtil.setOpacity(this._container, this.options.opacity);
@@ -2150,18 +2168,19 @@ L.TileLayer = L.Class.extend({
// image-specific code (override to implement e.g. Canvas or SVG tile layer)
getTileUrl: function (tilePoint, zoom) {
- var subdomains = this.options.subdomains,
- index = (tilePoint.x + tilePoint.y) % subdomains.length,
- s = this.options.subdomains[index];
-
return L.Util.template(this._url, L.Util.extend({
- s: s,
+ s: this._getSubdomain(tilePoint),
z: this._getOffsetZoom(zoom),
x: tilePoint.x,
y: tilePoint.y
}, this.options));
},
+ _getSubdomain: function (tilePoint) {
+ var index = (tilePoint.x + tilePoint.y) % this.options.subdomains.length;
+ return this.options.subdomains[index];
+ },
+
_createTileProto: function () {
var img = this._tileImg = L.DomUtil.create('img', 'leaflet-tile');
img.galleryimg = 'no';
@@ -2244,6 +2263,7 @@ L.tileLayer = function (url, options) {
L.TileLayer.WMS = L.TileLayer.extend({
+
defaultWmsParams: {
service: 'WMS',
request: 'GetMap',
@@ -2255,6 +2275,7 @@ L.TileLayer.WMS = L.TileLayer.extend({
},
initialize: function (url, options) { // (String, Object)
+
this._url = url;
var wmsParams = L.Util.extend({}, this.defaultWmsParams);
@@ -2273,6 +2294,7 @@ L.TileLayer.WMS = L.TileLayer.extend({
},
onAdd: function (map, insertAtTheBottom) {
+
var projectionKey = parseFloat(this.wmsParams.version) >= 1.3 ? 'crs' : 'srs';
this.wmsParams[projectionKey] = map.options.crs.code;
@@ -2280,23 +2302,33 @@ L.TileLayer.WMS = L.TileLayer.extend({
},
getTileUrl: function (tilePoint, zoom) { // (Point, Number) -> String
+
var map = this._map,
crs = map.options.crs,
-
tileSize = this.options.tileSize,
-
+
nwPoint = tilePoint.multiplyBy(tileSize),
sePoint = nwPoint.add(new L.Point(tileSize, tileSize)),
- nwMap = map.unproject(nwPoint, zoom),
- seMap = map.unproject(sePoint, zoom),
+ nw = crs.project(map.unproject(nwPoint, zoom)),
+ se = crs.project(map.unproject(sePoint, zoom)),
+
+ bbox = [nw.x, se.y, se.x, nw.y].join(','),
- nw = crs.project(nwMap),
- se = crs.project(seMap),
+ url = L.Util.template(this._url, {s: this._getSubdomain(tilePoint)});
- bbox = [nw.x, se.y, se.x, nw.y].join(',');
+ return url + L.Util.getParamString(this.wmsParams) + "&bbox=" + bbox;
+ },
+
+ setParams: function (params, noRedraw) {
+
+ L.Util.extend(this.wmsParams, params);
+
+ if (!noRedraw) {
+ this.redraw();
+ }
- return this._url + L.Util.getParamString(this.wmsParams) + "&bbox=" + bbox;
+ return this;
}
});
@@ -2647,15 +2679,6 @@ L.Marker = L.Class.extend({
if (map.options.zoomAnimation && map.options.markerZoomAnimation) {
map.on('zoomanim', this._animateZoom, this);
- L.DomUtil.addClass(this._icon, 'leaflet-zoom-animated');
- if (this._shadow) {
- L.DomUtil.addClass(this._shadow, 'leaflet-zoom-animated');
- }
- } else {
- L.DomUtil.addClass(this._icon, 'leaflet-zoom-hide');
- if (this._shadow) {
- L.DomUtil.addClass(this._shadow, 'leaflet-zoom-hide');
- }
}
},
@@ -2720,7 +2743,10 @@ L.Marker = L.Class.extend({
},
_initIcon: function () {
- var options = this.options;
+ var options = this.options,
+ map = this._map,
+ animation = (map.options.zoomAnimation && map.options.markerZoomAnimation),
+ classToAdd = animation ? 'leaflet-zoom-animated' : 'leaflet-zoom-hide';
if (!this._icon) {
this._icon = options.icon.createIcon();
@@ -2731,9 +2757,15 @@ L.Marker = L.Class.extend({
this._initInteraction();
this._updateOpacity();
+
+ L.DomUtil.addClass(this._icon, classToAdd);
}
if (!this._shadow) {
this._shadow = options.icon.createShadow();
+
+ if (this._shadow) {
+ L.DomUtil.addClass(this._shadow, classToAdd);
+ }
}
var panes = this._map._panes;
@@ -2838,16 +2870,25 @@ L.DivIcon = L.Icon.extend({
/*
iconAnchor: (Point)
popupAnchor: (Point)
- innerHTML: (String)
+ html: (String)
+ bgPos: (Point)
*/
className: 'leaflet-div-icon'
},
createIcon: function () {
- var div = document.createElement('div');
- if (this.options.html) {
- div.innerHTML = this.options.html;
+ var div = document.createElement('div'),
+ options = this.options;
+
+ if (options.html) {
+ div.innerHTML = options.html;
+ }
+
+ if (options.bgPos) {
+ div.style.backgroundPosition =
+ (-options.bgPos.x) + 'px ' + (-options.bgPos.y) + 'px';
}
+
this._setIconStyles(div, 'icon');
return div;
},
@@ -2895,7 +2936,7 @@ L.Popup = L.Class.extend({
}
this._updateContent();
- this._container.style.opacity = '0';
+ L.DomUtil.setOpacity(this._container, 0);
map._panes.popupPane.appendChild(this._container);
map.on('viewreset', this._updatePosition, this);
@@ -2910,7 +2951,7 @@ L.Popup = L.Class.extend({
this._update();
- this._container.style.opacity = '1'; //TODO fix ugly opacity hack
+ L.DomUtil.setOpacity(this._container, 1);
},
addTo: function (map) {
@@ -2929,7 +2970,7 @@ L.Popup = L.Class.extend({
zoomanim: this._zoomAnimation
}, this);
- this._container.style.opacity = '0';
+ L.DomUtil.setOpacity(this._container, 0);
this._map = null;
},
@@ -3108,6 +3149,7 @@ L.popup = function (options, source) {
return new L.Popup(options, source);
};
+
/*
* Popup extension to L.Marker, adding openPopup & bindPopup methods.
*/
diff --git a/lib/leaflet-dist/leaflet.js b/lib/leaflet-dist/leaflet.js
index c4b0654..e384e5b 100644
--- a/lib/leaflet-dist/leaflet.js
+++ b/lib/leaflet-dist/leaflet.js
@@ -3,4 +3,4 @@
Leaflet is a modern open-source JavaScript library for interactive maps.
http://leaflet.cloudmade.com
*/
-(function(e,t){var n,r;typeof exports!=t+""?n=exports:(r=e.L,n={},n.noConflict=function(){return e.L=r,this},e.L=n),n.version="0.4",n.Util={extend:function(e){var t=Array.prototype.slice.call(arguments,1);for(var n=0,r=t.length,i;n<r;n++){i=t[n]||{};for(var s in i)i.hasOwnProperty(s)&&(e[s]=i[s])}return e},bind:function(e,t){var n=arguments.length>2?Array.prototype.slice.call(arguments,2):null;return function(){return e.apply(t,n||arguments)}},stamp:function(){var e=0,t="_leaflet_id";ret [...]
\ No newline at end of file
+(function(e,t){var n,r;typeof exports!=t+""?n=exports:(r=e.L,n={},n.noConflict=function(){return e.L=r,this},e.L=n),n.version="0.4",n.Util={extend:function(e){var t=Array.prototype.slice.call(arguments,1);for(var n=0,r=t.length,i;n<r;n++){i=t[n]||{};for(var s in i)i.hasOwnProperty(s)&&(e[s]=i[s])}return e},bind:function(e,t){var n=arguments.length>2?Array.prototype.slice.call(arguments,2):null;return function(){return e.apply(t,n||arguments)}},stamp:function(){var e=0,t="_leaflet_id";ret [...]
\ No newline at end of file
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/leaflet-markercluster.git
More information about the Pkg-javascript-commits
mailing list