@@ -471,6 +471,7 @@ L.Mixin.Events.fire = L.Mixin.Events.fireEvent;
471
471
ua = navigator . userAgent . toLowerCase ( ) ,
472
472
webkit = ua . indexOf ( 'webkit' ) !== - 1 ,
473
473
chrome = ua . indexOf ( 'chrome' ) !== - 1 ,
474
+ phantomjs = ua . indexOf ( 'phantom' ) !== - 1 ,
474
475
android = ua . indexOf ( 'android' ) !== - 1 ,
475
476
android23 = ua . search ( 'android [23]' ) !== - 1 ,
476
477
@@ -486,7 +487,7 @@ L.Mixin.Events.fire = L.Mixin.Events.fireEvent;
486
487
webkit3d = ( 'WebKitCSSMatrix' in window ) && ( 'm11' in new window . WebKitCSSMatrix ( ) ) ,
487
488
gecko3d = 'MozPerspective' in doc . style ,
488
489
opera3d = 'OTransition' in doc . style ,
489
- any3d = ! window . L_DISABLE_3D && ( ie3d || webkit3d || gecko3d || opera3d ) ;
490
+ any3d = ! window . L_DISABLE_3D && ( ie3d || webkit3d || gecko3d || opera3d ) && ! phantomjs ;
490
491
491
492
492
493
var touch = ! window . L_NO_TOUCH && ( function ( ) {
@@ -951,7 +952,12 @@ L.DomUtil = {
951
952
filterName = 'DXImageTransform.Microsoft.Alpha' ;
952
953
953
954
// filters collection throws an error if we try to retrieve a filter that doesn't exist
954
- try { filter = el . filters . item ( filterName ) ; } catch ( e ) { }
955
+ try {
956
+ filter = el . filters . item ( filterName ) ;
957
+ } catch ( e ) {
958
+ //Don't set opacity to 1 if we haven't already set an opacity, it isn't needed and breaks transparent pngs.
959
+ if ( value === 1 ) { return ; }
960
+ }
955
961
956
962
value = Math . round ( value * 100 ) ;
957
963
@@ -3284,6 +3290,10 @@ L.Marker = L.Class.extend({
3284
3290
} ,
3285
3291
3286
3292
onRemove : function ( map ) {
3293
+ if ( this . dragging ) {
3294
+ this . dragging . disable ( ) ;
3295
+ }
3296
+
3287
3297
this . _removeIcon ( ) ;
3288
3298
3289
3299
this . fire ( 'remove' ) ;
@@ -4021,6 +4031,16 @@ L.LayerGroup = L.Class.extend({
4021
4031
return this ;
4022
4032
} ,
4023
4033
4034
+ getLayers : function ( ) {
4035
+ var layers = [ ] ;
4036
+ for ( var i in this . _layers ) {
4037
+ if ( this . _layers . hasOwnProperty ( i ) ) {
4038
+ layers . push ( this . _layers [ i ] ) ;
4039
+ }
4040
+ }
4041
+ return layers ;
4042
+ } ,
4043
+
4024
4044
setZIndex : function ( zIndex ) {
4025
4045
return this . invoke ( 'setZIndex' , zIndex ) ;
4026
4046
}
@@ -5290,11 +5310,20 @@ L.Polygon = L.Polyline.extend({
5290
5310
} ,
5291
5311
5292
5312
initialize : function ( latlngs , options ) {
5313
+ var i , len , hole ;
5314
+
5293
5315
L . Polyline . prototype . initialize . call ( this , latlngs , options ) ;
5294
5316
5295
5317
if ( latlngs && L . Util . isArray ( latlngs [ 0 ] ) && ( typeof latlngs [ 0 ] [ 0 ] !== 'number' ) ) {
5296
5318
this . _latlngs = this . _convertLatLngs ( latlngs [ 0 ] ) ;
5297
5319
this . _holes = latlngs . slice ( 1 ) ;
5320
+
5321
+ for ( i = 0 , len = this . _holes . length ; i < len ; i ++ ) {
5322
+ hole = this . _holes [ i ] = this . _convertLatLngs ( this . _holes [ i ] ) ;
5323
+ if ( hole [ 0 ] . equals ( hole [ hole . length - 1 ] ) ) {
5324
+ hole . pop ( ) ;
5325
+ }
5326
+ }
5298
5327
}
5299
5328
5300
5329
// filter out last point if its equal to the first one
@@ -5550,7 +5579,7 @@ L.CircleMarker = L.Circle.extend({
5550
5579
projectLatlngs : function ( ) {
5551
5580
this . _point = this . _map . latLngToLayerPoint ( this . _latlng ) ;
5552
5581
} ,
5553
-
5582
+
5554
5583
_updateStyle : function ( ) {
5555
5584
L . Circle . prototype . _updateStyle . call ( this ) ;
5556
5585
this . setRadius ( this . options . radius ) ;
@@ -5881,7 +5910,7 @@ L.DomEvent = {
5881
5910
key = '_leaflet_' + type + id ,
5882
5911
handler = obj [ key ] ;
5883
5912
5884
- if ( ! handler ) { return ; }
5913
+ if ( ! handler ) { return this ; }
5885
5914
5886
5915
if ( L . Browser . msTouch && type . indexOf ( 'touch' ) === 0 ) {
5887
5916
this . removeMsTouchListener ( obj , type , id ) ;
@@ -7132,6 +7161,11 @@ L.Handler.MarkerDrag = L.Handler.extend({
7132
7161
} ,
7133
7162
7134
7163
removeHooks : function ( ) {
7164
+ this . _draggable
7165
+ . off ( 'dragstart' , this . _onDragStart )
7166
+ . off ( 'drag' , this . _onDrag )
7167
+ . off ( 'dragend' , this . _onDragEnd ) ;
7168
+
7135
7169
this . _draggable . disable ( ) ;
7136
7170
} ,
7137
7171
@@ -7950,9 +7984,9 @@ L.Map.include({
7950
7984
if ( canBeAnimated ) {
7951
7985
7952
7986
// try animating pan or zoom
7953
- var animated = zoomChanged && this . options . zoomAnimation ?
7954
- this . _animateZoomIfClose && this . _animateZoomIfClose ( center , zoom ) :
7955
- this . _animatePanIfClose ( center ) ;
7987
+ var animated = zoomChanged ?
7988
+ this . options . zoomAnimation && this . _animateZoomIfClose && this . _animateZoomIfClose ( center , zoom ) :
7989
+ this . _animatePanIfClose ( center ) ;
7956
7990
7957
7991
if ( animated ) {
7958
7992
// prevent resize handler call, the view will refresh after animation anyway
0 commit comments