var oldL = window.L,
L = {};
-L.version = '0.7.3';
+L.version = '0.7.4';
// define Leaflet for Node module pattern loaders, including Browserify
if (typeof module === 'object' && typeof module.exports === 'object') {
gecko = ua.indexOf('gecko') !== -1,
mobile = typeof orientation !== undefined + '',
- msPointer = window.navigator && window.navigator.msPointerEnabled &&
- window.navigator.msMaxTouchPoints && !window.PointerEvent,
+ msPointer = !window.PointerEvent && window.MSPointerEvent,
pointer = (window.PointerEvent && window.navigator.pointerEnabled && window.navigator.maxTouchPoints) ||
msPointer,
retina = ('devicePixelRatio' in window && window.devicePixelRatio > 1) ||
opera3d = 'OTransition' in doc.style,
any3d = !window.L_DISABLE_3D && (ie3d || webkit3d || gecko3d || opera3d) && !phantomjs;
-
- // PhantomJS has 'ontouchstart' in document.documentElement, but doesn't actually support touch.
- // https://github.com/Leaflet/Leaflet/pull/1434#issuecomment-13843151
-
- var touch = !window.L_NO_TOUCH && !phantomjs && (function () {
-
- var startName = 'ontouchstart';
-
- // IE10+ (We simulate these into touch* events in L.DomEvent and L.DomEvent.Pointer) or WebKit, etc.
- if (pointer || (startName in doc)) {
- return true;
- }
-
- // Firefox/Gecko
- var div = document.createElement('div'),
- supported = false;
-
- if (!div.setAttribute) {
- return false;
- }
- div.setAttribute(startName, 'return;');
-
- if (typeof div[startName] === 'function') {
- supported = true;
- }
-
- div.removeAttribute(startName);
- div = null;
-
- return supported;
- }());
-
+ var touch = !window.L_NO_TOUCH && !phantomjs && (pointer || 'ontouchstart' in window ||
+ (window.DocumentTouch && document instanceof window.DocumentTouch));
L.Browser = {
ie: ie,
var paddingTL = L.point(options.paddingTopLeft || options.padding || [0, 0]),
paddingBR = L.point(options.paddingBottomRight || options.padding || [0, 0]),
- zoom = this.getBoundsZoom(bounds, false, paddingTL.add(paddingBR)),
- paddingOffset = paddingBR.subtract(paddingTL).divideBy(2),
+ zoom = this.getBoundsZoom(bounds, false, paddingTL.add(paddingBR));
+
+ zoom = (options.maxZoom) ? Math.min(options.maxZoom, zoom) : zoom;
+
+ var paddingOffset = paddingBR.subtract(paddingTL).divideBy(2),
swPoint = this.project(bounds.getSouthWest(), zoom),
nePoint = this.project(bounds.getNorthEast(), zoom),
center = this.unproject(swPoint.add(nePoint).divideBy(2).add(paddingOffset), zoom);
- zoom = options && options.maxZoom ? Math.min(options.maxZoom, zoom) : zoom;
-
return this.setView(center, zoom, options);
},
}
if (options.bounds) {
- var tileSize = options.tileSize,
+ var tileSize = this._getTileSize(),
nwPoint = tilePoint.multiplyBy(tileSize),
sePoint = nwPoint.add([tileSize, tileSize]),
nw = this._map.unproject(nwPoint),
update: function () {
if (this._icon) {
var pos = this._map.latLngToLayerPoint(this._latlng).round();
- this._setPos(pos);
+ L.Util.requestAnimFrame(function () {
+ this._setPos(pos);
+ }, this);
}
return this;
if (content instanceof L.Popup) {
L.setOptions(content, options);
this._popup = content;
+ content._source = this;
} else {
this._popup = new L.Popup(options, this)
.setContent(content);
if (options.fill) {
this._ctx.fillStyle = options.fillColor || options.color;
}
+
+ if (options.lineCap) {
+ this._ctx.lineCap = options.lineCap;
+ }
+ if (options.lineJoin) {
+ this._ctx.lineJoin = options.lineJoin;
+ }
},
_drawPath: function () {
if (options.fill) {
ctx.globalAlpha = options.fillOpacity;
- ctx.fill();
+ ctx.fill(options.fillRule || 'evenodd');
}
if (options.stroke) {
_initEvents: function () {
if (this.options.clickable) {
- // TODO dblclick
this._map.on('mousemove', this._onMouseMove, this);
- this._map.on('click', this._onClick, this);
+ this._map.on('click dblclick contextmenu', this._fireMouseEvent, this);
}
},
- _onClick: function (e) {
+ _fireMouseEvent: function (e) {
if (this._containsPoint(e.layerPoint)) {
- this.fire('click', e);
+ this.fire(e.type, e);
}
},
delta: delta,
backwards: backwards
});
+ // horrible hack to work around a Chrome bug https://github.com/Leaflet/Leaflet/issues/3689
+ setTimeout(L.bind(this._onZoomTransitionEnd, this), 250);
}, this);
},
_onZoomTransitionEnd: function () {
+ if (!this._animatingZoom) { return; }
this._animatingZoom = false;
// force reflow
L.Util.falseFn(bg.offsetWidth);
+ var zoom = this._map.getZoom();
+ if (zoom > this.options.maxZoom || zoom < this.options.minZoom) {
+ this._clearBgBuffer();
+ }
+
this._animating = false;
},