77var oldL = window . L ,
88 L = { } ;
99
10- L . version = '0.7.3 ' ;
10+ L . version = '0.7.7 ' ;
1111
1212// define Leaflet for Node module pattern loaders, including Browserify
1313if ( typeof module === 'object' && typeof module . exports === 'object' ) {
@@ -519,9 +519,8 @@ L.Mixin.Events.fire = L.Mixin.Events.fireEvent;
519519 gecko = ua . indexOf ( 'gecko' ) !== - 1 ,
520520
521521 mobile = typeof orientation !== undefined + '' ,
522- msPointer = window . navigator && window . navigator . msPointerEnabled &&
523- window . navigator . msMaxTouchPoints && ! window . PointerEvent ,
524- pointer = ( window . PointerEvent && window . navigator . pointerEnabled && window . navigator . maxTouchPoints ) ||
522+ msPointer = ! window . PointerEvent && window . MSPointerEvent ,
523+ pointer = ( window . PointerEvent && window . navigator . pointerEnabled ) ||
525524 msPointer ,
526525 retina = ( 'devicePixelRatio' in window && window . devicePixelRatio > 1 ) ||
527526 ( 'matchMedia' in window && window . matchMedia ( '(min-resolution:144dpi)' ) &&
@@ -534,38 +533,8 @@ L.Mixin.Events.fire = L.Mixin.Events.fireEvent;
534533 opera3d = 'OTransition' in doc . style ,
535534 any3d = ! window . L_DISABLE_3D && ( ie3d || webkit3d || gecko3d || opera3d ) && ! phantomjs ;
536535
537-
538- // PhantomJS has 'ontouchstart' in document.documentElement, but doesn't actually support touch.
539- // https://github.com/Leaflet/Leaflet/pull/1434#issuecomment-13843151
540-
541- var touch = ! window . L_NO_TOUCH && ! phantomjs && ( function ( ) {
542-
543- var startName = 'ontouchstart' ;
544-
545- // IE10+ (We simulate these into touch* events in L.DomEvent and L.DomEvent.Pointer) or WebKit, etc.
546- if ( pointer || ( startName in doc ) ) {
547- return true ;
548- }
549-
550- // Firefox/Gecko
551- var div = document . createElement ( 'div' ) ,
552- supported = false ;
553-
554- if ( ! div . setAttribute ) {
555- return false ;
556- }
557- div . setAttribute ( startName , 'return;' ) ;
558-
559- if ( typeof div [ startName ] === 'function' ) {
560- supported = true ;
561- }
562-
563- div . removeAttribute ( startName ) ;
564- div = null ;
565-
566- return supported ;
567- } ( ) ) ;
568-
536+ var touch = ! window . L_NO_TOUCH && ! phantomjs && ( pointer || 'ontouchstart' in window ||
537+ ( window . DocumentTouch && document instanceof window . DocumentTouch ) ) ;
569538
570539 L . Browser = {
571540 ie : ie ,
@@ -1632,15 +1601,16 @@ L.Map = L.Class.extend({
16321601 var paddingTL = L . point ( options . paddingTopLeft || options . padding || [ 0 , 0 ] ) ,
16331602 paddingBR = L . point ( options . paddingBottomRight || options . padding || [ 0 , 0 ] ) ,
16341603
1635- zoom = this . getBoundsZoom ( bounds , false , paddingTL . add ( paddingBR ) ) ,
1636- paddingOffset = paddingBR . subtract ( paddingTL ) . divideBy ( 2 ) ,
1604+ zoom = this . getBoundsZoom ( bounds , false , paddingTL . add ( paddingBR ) ) ;
1605+
1606+ zoom = ( options . maxZoom ) ? Math . min ( options . maxZoom , zoom ) : zoom ;
1607+
1608+ var paddingOffset = paddingBR . subtract ( paddingTL ) . divideBy ( 2 ) ,
16371609
16381610 swPoint = this . project ( bounds . getSouthWest ( ) , zoom ) ,
16391611 nePoint = this . project ( bounds . getNorthEast ( ) , zoom ) ,
16401612 center = this . unproject ( swPoint . add ( nePoint ) . divideBy ( 2 ) . add ( paddingOffset ) , zoom ) ;
16411613
1642- zoom = options && options . maxZoom ? Math . min ( options . maxZoom , zoom ) : zoom ;
1643-
16441614 return this . setView ( center , zoom , options ) ;
16451615 } ,
16461616
@@ -2782,7 +2752,7 @@ L.TileLayer = L.Class.extend({
27822752 }
27832753
27842754 if ( options . bounds ) {
2785- var tileSize = options . tileSize ,
2755+ var tileSize = this . _getTileSize ( ) ,
27862756 nwPoint = tilePoint . multiplyBy ( tileSize ) ,
27872757 sePoint = nwPoint . add ( [ tileSize , tileSize ] ) ,
27882758 nw = this . _map . unproject ( nwPoint ) ,
@@ -3567,10 +3537,8 @@ L.Marker = L.Class.extend({
35673537
35683538 update : function ( ) {
35693539 if ( this . _icon ) {
3570- var pos = this . _map . latLngToLayerPoint ( this . _latlng ) . round ( ) ;
3571- this . _setPos ( pos ) ;
3540+ this . _setPos ( this . _map . latLngToLayerPoint ( this . _latlng ) . round ( ) ) ;
35723541 }
3573-
35743542 return this ;
35753543 } ,
35763544
@@ -3593,7 +3561,7 @@ L.Marker = L.Class.extend({
35933561 if ( options . title ) {
35943562 icon . title = options . title ;
35953563 }
3596-
3564+
35973565 if ( options . alt ) {
35983566 icon . alt = options . alt ;
35993567 }
@@ -4228,6 +4196,7 @@ L.Marker.include({
42284196 if ( content instanceof L . Popup ) {
42294197 L . setOptions ( content , options ) ;
42304198 this . _popup = content ;
4199+ content . _source = this ;
42314200 } else {
42324201 this . _popup = new L . Popup ( options , this )
42334202 . setContent ( content ) ;
@@ -4420,7 +4389,9 @@ L.FeatureGroup = L.LayerGroup.extend({
44204389 layer = this . _layers [ layer ] ;
44214390 }
44224391
4423- layer . off ( L . FeatureGroup . EVENTS , this . _propagateEvent , this ) ;
4392+ if ( 'off' in layer ) {
4393+ layer . off ( L . FeatureGroup . EVENTS , this . _propagateEvent , this ) ;
4394+ }
44244395
44254396 L . LayerGroup . prototype . removeLayer . call ( this , layer ) ;
44264397
@@ -4740,7 +4711,7 @@ L.Path = L.Path.extend({
47404711 } ,
47414712
47424713 _fireMouseEvent : function ( e ) {
4743- if ( ! this . hasEventListeners ( e . type ) ) { return ; }
4714+ if ( ! this . _map || ! this . hasEventListeners ( e . type ) ) { return ; }
47444715
47454716 var map = this . _map ,
47464717 containerPoint = map . mouseEventToContainerPoint ( e ) ,
@@ -5114,6 +5085,13 @@ L.Path = (L.Path.SVG && !window.L_PREFER_CANVAS) || !L.Browser.canvas ? L.Path :
51145085 if ( options . fill ) {
51155086 this . _ctx . fillStyle = options . fillColor || options . color ;
51165087 }
5088+
5089+ if ( options . lineCap ) {
5090+ this . _ctx . lineCap = options . lineCap ;
5091+ }
5092+ if ( options . lineJoin ) {
5093+ this . _ctx . lineJoin = options . lineJoin ;
5094+ }
51175095 } ,
51185096
51195097 _drawPath : function ( ) {
@@ -5151,7 +5129,7 @@ L.Path = (L.Path.SVG && !window.L_PREFER_CANVAS) || !L.Browser.canvas ? L.Path :
51515129
51525130 if ( options . fill ) {
51535131 ctx . globalAlpha = options . fillOpacity ;
5154- ctx . fill ( ) ;
5132+ ctx . fill ( options . fillRule || 'evenodd' ) ;
51555133 }
51565134
51575135 if ( options . stroke ) {
@@ -5166,15 +5144,14 @@ L.Path = (L.Path.SVG && !window.L_PREFER_CANVAS) || !L.Browser.canvas ? L.Path :
51665144
51675145 _initEvents : function ( ) {
51685146 if ( this . options . clickable ) {
5169- // TODO dblclick
51705147 this . _map . on ( 'mousemove' , this . _onMouseMove , this ) ;
5171- this . _map . on ( 'click' , this . _onClick , this ) ;
5148+ this . _map . on ( 'click dblclick contextmenu ' , this . _fireMouseEvent , this ) ;
51725149 }
51735150 } ,
51745151
5175- _onClick : function ( e ) {
5152+ _fireMouseEvent : function ( e ) {
51765153 if ( this . _containsPoint ( e . layerPoint ) ) {
5177- this . fire ( 'click' , e ) ;
5154+ this . fire ( e . type , e ) ;
51785155 }
51795156 } ,
51805157
@@ -7192,8 +7169,9 @@ L.extend(L.DomEvent, {
71927169 pointers = this . _pointers ;
71937170
71947171 var cb = function ( e ) {
7195-
7196- L . DomEvent . preventDefault ( e ) ;
7172+ if ( e . pointerType !== 'mouse' && e . pointerType !== e . MSPOINTER_TYPE_MOUSE ) {
7173+ L . DomEvent . preventDefault ( e ) ;
7174+ }
71977175
71987176 var alreadyInArray = false ;
71997177 for ( var i = 0 ; i < pointers . length ; i ++ ) {
@@ -8952,20 +8930,25 @@ L.Map.include(!L.DomUtil.TRANSITION ? {} : {
89528930 delta : delta ,
89538931 backwards : backwards
89548932 } ) ;
8933+ // horrible hack to work around a Chrome bug https://github.com/Leaflet/Leaflet/issues/3689
8934+ setTimeout ( L . bind ( this . _onZoomTransitionEnd , this ) , 250 ) ;
89558935 } , this ) ;
89568936 } ,
89578937
89588938 _onZoomTransitionEnd : function ( ) {
8939+ if ( ! this . _animatingZoom ) { return ; }
89598940
89608941 this . _animatingZoom = false ;
89618942
89628943 L . DomUtil . removeClass ( this . _mapPane , 'leaflet-zoom-anim' ) ;
89638944
8964- this . _resetView ( this . _animateToCenter , this . _animateToZoom , true , true ) ;
8945+ L . Util . requestAnimFrame ( function ( ) {
8946+ this . _resetView ( this . _animateToCenter , this . _animateToZoom , true , true ) ;
89658947
8966- if ( L . Draggable ) {
8967- L . Draggable . _disabled = false ;
8968- }
8948+ if ( L . Draggable ) {
8949+ L . Draggable . _disabled = false ;
8950+ }
8951+ } , this ) ;
89698952 }
89708953} ) ;
89718954
@@ -9001,6 +8984,11 @@ L.TileLayer.include({
90018984 // force reflow
90028985 L . Util . falseFn ( bg . offsetWidth ) ;
90038986
8987+ var zoom = this . _map . getZoom ( ) ;
8988+ if ( zoom > this . options . maxZoom || zoom < this . options . minZoom ) {
8989+ this . _clearBgBuffer ( ) ;
8990+ }
8991+
90048992 this . _animating = false ;
90058993 } ,
90068994
0 commit comments