2010-09-23 20:56:29 +08:00
/ *
2012-12-18 01:15:51 +08:00
Leaflet , a JavaScript library for mobile - friendly interactive maps . http : //leafletjs.com
2013-01-15 18:16:15 +08:00
( c ) 2010 - 2013 , Vladimir Agafonkin , CloudMade
2010-09-23 20:56:29 +08:00
* /
2013-05-08 18:02:15 +08:00
( function ( t , e , i ) { var n = t . L , o = { } ; o . version = "0.6-dev" , "object" == typeof module && "object" == typeof module . exports ? module . exports = o : "function" == typeof define && define . amd && define ( "leaflet" , [ ] , function ( ) { return o } ) , o . noConflict = function ( ) { return t . L = n , this } , t . L = o , o . Util = { extend : function ( t ) { var e , i , n , o , s = Array . prototype . slice . call ( arguments , 1 ) ; for ( i = 0 , n = s . length ; n > i ; i ++ ) { o = s [ i ] || { } ; for ( e in o ) o . hasOwnProperty ( e ) && ( t [ e ] = o [ e ] ) } return t } , bind : function ( t , e ) { var i = arguments . length > 2 ? Array . prototype . slice . call ( arguments , 2 ) : null ; return function ( ) { return t . apply ( e , i || arguments ) } } , stamp : function ( ) { var t = 0 , e = "_leaflet_id" ; return function ( i ) { return i [ e ] = i [ e ] || ++ t , i [ e ] } } ( ) , invokeEach : function ( t , e , i ) { var n , o ; if ( "object" == typeof t ) { o = Array . prototype . slice . call ( arguments , 3 ) ; for ( n in t ) e . apply ( i , [ n , t [ n ] ] . concat ( o ) ) ; return ! 0 } return ! 1 } , limitExecByInterval : function ( t , e , n ) { var o , s ; return function a ( ) { var r = arguments ; return o ? ( s = ! 0 , i ) : ( o = ! 0 , setTimeout ( function ( ) { o = ! 1 , s && ( a . apply ( n , r ) , s = ! 1 ) } , e ) , t . apply ( n , r ) , i ) } } , falseFn : function ( ) { return ! 1 } , formatNum : function ( t , e ) { var i = Math . pow ( 10 , e || 5 ) ; return Math . round ( t * i ) / i } , trim : function ( t ) { return t . trim ? t . trim ( ) : t . replace ( /^\s+|\s+$/g , "" ) } , splitWords : function ( t ) { return o . Util . trim ( t ) . split ( /\s+/ ) } , setOptions : function ( t , e ) { return t . options = o . extend ( { } , t . options , e ) , t . options } , getParamString : function ( t , e ) { var i = [ ] ; for ( var n in t ) i . push ( encodeURIComponent ( n ) + "=" + encodeURIComponent ( t [ n ] ) ) ; return ( e && - 1 !== e . indexOf ( "?" ) ? "&" : "?" ) + i . join ( "&" ) } , template : function ( t , e ) { return t . replace ( /\{ *([\w_]+) *\}/g , function ( t , n ) { var o = e [ n ] ; if ( o === i ) throw Error ( "No value provided for variable " + t ) ; return "function" == typeof o && ( o = o ( e ) ) , o } ) } , isArray : function ( t ) { return "[object Array]" === Object . prototype . toString . call ( t ) } , emptyImageUrl : "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" } , function ( ) { function e ( e ) { var i , n , o = [ "webkit" , "moz" , "o" , "ms" ] ; for ( i = 0 ; o . length > i && ! n ; i ++ ) n = t [ o [ i ] + e ] ; return n } function n ( e ) { var i = + new Date , n = Math . max ( 0 , 16 - ( i - s ) ) ; return s = i + n , t . setTimeout ( e , n ) } var s = 0 , a = t . requestAnimationFrame || e ( "RequestAnimationFrame" ) || n , r = t . cancelAnimationFrame || e ( "CancelAnimationFrame" ) || e ( "CancelRequestAnimationFrame" ) || function ( e ) { t . clearTimeout ( e ) } ; o . Util . requestAnimFrame = function ( e , s , r , h ) { return e = o . bind ( e , s ) , r && a === n ? ( e ( ) , i ) : a . call ( t , e , h ) } , o . Util . cancelAnimFrame = function ( e ) { e && r . call ( t , e ) } } ( ) , o . extend = o . Util . extend , o . bind = o . Util . bind , o . stamp = o . Util . stamp , o . setOptions = o . Util . setOptions , o . Class = function ( ) { } , o . Class . extend = function ( t ) { var e = function ( ) { this . initialize && this . initialize . apply ( this , arguments ) , this . _initHooks && this . callInitHooks ( ) } , i = function ( ) { } ; i . prototype = this . prototype ; var n = new i ; n . constructor = e , e . prototype = n ; for ( var s in this ) this . hasOwnProperty ( s ) && "prototype" !== s && ( e [ s ] = this [ s ] ) ; t . statics && ( o . extend ( e , t . statics ) , delete t . statics ) , t . includes && ( o . Util . extend . apply ( null , [ n ] . concat ( t . includes ) ) , delete t . includes ) , t . options && n . options && ( t . options = o . extend ( { } , n . options , t . options ) ) , o . extend ( n , t ) , n . _initHooks = [ ] ; var a = this ; return e . _ _super _ _ = a . prototype , n . callInitHooks = function ( ) { if ( ! this . _initHooksCalled ) { a . prototype . callInitHooks && a . prototype . callInitHooks . call ( this ) , this . _initHooksCalled = ! 0 ; for ( var t = 0 , e = n . _initHooks . length ; e > t ; t ++ ) n . _initHooks [ t ] . call ( this ) } } , e } , o . Class . include = function ( t ) { o . extend ( this . prototype , t ) } , o . Class . mergeOptions = function ( t ) { o . extend ( this . prototype . options , t ) } , o . Class . addInitHook = function ( t ) { var e = Array . prototype . slice . call ( arguments , 1 ) , i = "function" == typeof t ? t : function ( ) { this [ t ] . apply ( this , e ) } ; this . prototype . _initHooks = this . prototype . _initHooks || [ ] , this . prototype . _initHooks . push ( i ) } ; var s = "_leaflet_events" ; o . Mixin = { } , o . Mixin . Events = { addEventListener : function ( t , e , i ) { if ( o . Util . invokeEach ( t , this . addEventListener , this , e , i ) ) return this ; var n , a , r , h , l , u , c , d = this [ s ] = this [ s ] || { } , _ = i && o . stamp ( i ) ; for ( t = o . Util . splitWords ( t ) , n = 0 , a = t . length ; a > n ; n ++ ) r = { action : e , context : i || this } , h = t [ n ] , i ? ( l = h + "_idx" , u = l + "_len" , c = d [ l ] = d [ l ] || { } , c [ _ ] || ( c [ _ ] = [ ] , d [ u ] = ( d [ u ] || 0 ) + 1 ) , c [ _ ] . push ( r ) ) : ( d [ h ] = d [ h ] || [ ] , d [ h ] . push ( r ) ) ; return this } , hasEventListeners : function ( t ) { var e = this [ s ] ; return ! ! e && ( t in e && e [ t ] . length > 0 || t + " _i
} , getAttribution : function ( ) { return this . options . attribution } , getContainer : function ( ) { return this . _container } , setOpacity : function ( t ) { return this . options . opacity = t , this . _map && this . _updateOpacity ( ) , this } , setZIndex : function ( t ) { return this . options . zIndex = t , this . _updateZIndex ( ) , this } , setUrl : function ( t , e ) { return this . _url = t , e || this . redraw ( ) , this } , redraw : function ( ) { return this . _map && ( this . _reset ( { hard : ! 0 } ) , this . _update ( ) ) , this } , _updateZIndex : function ( ) { this . _container && this . options . zIndex !== i && ( this . _container . style . zIndex = this . options . zIndex ) } , _setAutoZIndex : function ( t , e ) { var i , n , o , s = t . children , a = - e ( 1 / 0 , - 1 / 0 ) ; for ( n = 0 , o = s . length ; o > n ; n ++ ) s [ n ] !== this . _container && ( i = parseInt ( s [ n ] . style . zIndex , 10 ) , isNaN ( i ) || ( a = e ( a , i ) ) ) ; this . options . zIndex = this . _container . style . zIndex = ( isFinite ( a ) ? a : 0 ) + e ( 1 , - 1 ) } , _updateOpacity : function ( ) { var t , e = this . _tiles ; if ( o . Browser . ielt9 ) for ( t in e ) o . DomUtil . setOpacity ( e [ t ] , this . options . opacity ) ; else o . DomUtil . setOpacity ( this . _container , this . options . opacity ) ; if ( o . Browser . webkit ) for ( t in e ) e [ t ] . style . webkitTransform += " translate(0,0)" } , _initContainer : function ( ) { var t = this . _map . _panes . tilePane ; if ( ! this . _container ) { if ( this . _container = o . DomUtil . create ( "div" , "leaflet-layer" ) , this . _updateZIndex ( ) , this . _animated ) { var e = "leaflet-tile-container leaflet-zoom-animated" ; this . _bgBuffer = o . DomUtil . create ( "div" , e , this . _container ) , this . _tileContainer = o . DomUtil . create ( "div" , e , this . _container ) } else this . _tileContainer = this . _container ; t . appendChild ( this . _container ) , 1 > this . options . opacity && this . _updateOpacity ( ) } } , _reset : function ( t ) { for ( var e in this . _tiles ) this . fire ( "tileunload" , { tile : this . _tiles [ e ] } ) ; this . _tiles = { } , this . _tilesToLoad = 0 , this . options . reuseTiles && ( this . _unusedTiles = [ ] ) , this . _tileContainer . innerHTML = "" , this . _animated && t && t . hard && this . _clearBgBuffer ( ) , this . _initContainer ( ) } , _update : function ( ) { if ( this . _map ) { var t = this . _map . getPixelBounds ( ) , e = this . _map . getZoom ( ) , i = this . options . tileSize ; if ( ! ( e > this . options . maxZoom || this . options . minZoom > e ) ) { var n = o . bounds ( t . min . divideBy ( i ) . _floor ( ) , t . max . divideBy ( i ) . _floor ( ) ) ; this . _addTilesFromCenterOut ( n ) , ( this . options . unloadInvisibleTiles || this . options . reuseTiles ) && this . _removeOtherTiles ( n ) } } } , _addTilesFromCenterOut : function ( t ) { var i , n , s , a = [ ] , r = t . getCenter ( ) ; for ( i = t . min . y ; t . max . y >= i ; i ++ ) for ( n = t . min . x ; t . max . x >= n ; n ++ ) s = new o . Point ( n , i ) , this . _tileShouldBeLoaded ( s ) && a . push ( s ) ; var h = a . length ; if ( 0 !== h ) { a . sort ( function ( t , e ) { return t . distanceTo ( r ) - e . distanceTo ( r ) } ) ; var l = e . createDocumentFragment ( ) ; for ( this . _tilesToLoad || this . fire ( "loading" ) , this . _tilesToLoad += h , n = 0 ; h > n ; n ++ ) this . _addTile ( a [ n ] , l ) ; this . _tileContainer . appendChild ( l ) } } , _tileShouldBeLoaded : function ( t ) { if ( t . x + ":" + t . y in this . _tiles ) return ! 1 ; var e = this . options ; if ( ! e . continuousWorld && e . noWrap ) { var i = this . _getWrapTileNum ( ) ; if ( 0 > t . x || t . x >= i || 0 > t . y || t . y >= i ) return ! 1 } if ( e . bounds ) { var n = e . tileSize , o = t . multiplyBy ( n ) , s = o . add ( [ n , n ] ) , a = this . _map . unproject ( o ) , r = this . _map . unproject ( s ) ; if ( e . continuousWorld || e . noWrap || ( a = a . wrap ( ) , r = r . wrap ( ) ) , ! e . bounds . intersects ( [ a , r ] ) ) return ! 1 } return ! 0 } , _removeOtherTiles : function ( t ) { var e , i , n , o ; for ( o in this . _tiles ) e = o . split ( ":" ) , i = parseInt ( e [ 0 ] , 10 ) , n = parseInt ( e [ 1 ] , 10 ) , ( t . min . x > i || i > t . max . x || t . min . y > n || n > t . max . y ) && this . _removeTile ( o ) } , _removeTile : function ( t ) { var e = this . _tiles [ t ] ; this . fire ( "tileunload" , { tile : e , url : e . src } ) , this . options . reuseTiles ? ( o . DomUtil . removeClass ( e , "leaflet-tile-loaded" ) , this . _unusedTiles . push ( e ) ) : e . parentNode === this . _tileContainer && this . _tileContainer . removeChild ( e ) , o . Browser . android || ( e . onload = null , e . src = o . Util . emptyImageUrl ) , delete this . _tiles [ t ] } , _addTile : function ( t , e ) { var i = this . _getTilePos ( t ) , n = this . _getTile ( ) ; o . DomUtil . setPosition ( n , i , o . Browser . chrome || o . Browser . android23 ) , this . _tiles [ t . x + ":" + t . y ] = n , this . _loadTile ( n , t ) , n . parentNode !== this . _tileContainer && e . appendChild ( n ) } , _getZoomForUrl : function ( ) { var t = this . options , e = this . _map . getZoom ( ) ; return t . zoomReverse && ( e = t . maxZoom - e ) , e + t . zoomOffset } , _getTilePos : function ( t ) { var e = this . _map . getPixelOrigin ( ) , i = this . options . tileSize ; return t . multiplyBy ( i ) . subtract ( e ) } , getTileUrl : function ( t ) { return o . Util . template ( this . _url , o . extend ( { s : this . _getSubdomain (
} , setStyle : function ( t ) { return o . setOptions ( this , t ) , this . _map && ( this . _updateStyle ( ) , this . _requestUpdate ( ) ) , this } , onRemove : function ( t ) { t . off ( "viewreset" , this . projectLatlngs , this ) . off ( "moveend" , this . _updatePath , this ) , this . options . clickable && this . _map . off ( "click" , this . _onClick , this ) , this . _requestUpdate ( ) , this . _map = null } , _requestUpdate : function ( ) { this . _map && ! o . Path . _updateRequest && ( o . Path . _updateRequest = o . Util . requestAnimFrame ( this . _fireMapMoveEnd , this . _map ) ) } , _fireMapMoveEnd : function ( ) { o . Path . _updateRequest = null , this . fire ( "moveend" ) } , _initElements : function ( ) { this . _map . _initPathRoot ( ) , this . _ctx = this . _map . _canvasCtx } , _updateStyle : function ( ) { var t = this . options ; t . stroke && ( this . _ctx . lineWidth = t . weight , this . _ctx . strokeStyle = t . color ) , t . fill && ( this . _ctx . fillStyle = t . fillColor || t . color ) } , _drawPath : function ( ) { var t , e , i , n , s , a ; for ( this . _ctx . beginPath ( ) , t = 0 , i = this . _parts . length ; i > t ; t ++ ) { for ( e = 0 , n = this . _parts [ t ] . length ; n > e ; e ++ ) s = this . _parts [ t ] [ e ] , a = ( 0 === e ? "move" : "line" ) + "To" , this . _ctx [ a ] ( s . x , s . y ) ; this instanceof o . Polygon && this . _ctx . closePath ( ) } } , _checkIfEmpty : function ( ) { return ! this . _parts . length } , _updatePath : function ( ) { if ( ! this . _checkIfEmpty ( ) ) { var t = this . _ctx , e = this . options ; this . _drawPath ( ) , t . save ( ) , this . _updateStyle ( ) , e . fill && ( t . globalAlpha = e . fillOpacity , t . fill ( ) ) , e . stroke && ( t . globalAlpha = e . opacity , t . stroke ( ) ) , t . restore ( ) } } , _initEvents : function ( ) { this . options . clickable && ( this . _map . on ( "mousemove" , this . _onMouseMove , this ) , this . _map . on ( "click" , this . _onClick , this ) ) } , _onClick : function ( t ) { this . _containsPoint ( t . layerPoint ) && this . fire ( "click" , t ) } , _onMouseMove : function ( t ) { this . _map && ! this . _map . _animatingZoom && ( this . _containsPoint ( t . layerPoint ) ? ( this . _ctx . canvas . style . cursor = "pointer" , this . _mouseInside = ! 0 , this . fire ( "mouseover" , t ) ) : this . _mouseInside && ( this . _ctx . canvas . style . cursor = "" , this . _mouseInside = ! 1 , this . fire ( "mouseout" , t ) ) ) } } ) , o . Map . include ( o . Path . SVG && ! t . L _PREFER _CANVAS || ! o . Browser . canvas ? { } : { _initPathRoot : function ( ) { var t , i = this . _pathRoot ; i || ( i = this . _pathRoot = e . createElement ( "canvas" ) , i . style . position = "absolute" , t = this . _canvasCtx = i . getContext ( "2d" ) , t . lineCap = "round" , t . lineJoin = "round" , this . _panes . overlayPane . appendChild ( i ) , this . options . zoomAnimation && ( this . _pathRoot . className = "leaflet-zoom-animated" , this . on ( "zoomanim" , this . _animatePathZoom ) , this . on ( "zoomend" , this . _endPathZoom ) ) , this . on ( "moveend" , this . _updateCanvasViewport ) , this . _updateCanvasViewport ( ) ) } , _updateCanvasViewport : function ( ) { if ( ! this . _pathZooming ) { this . _updatePathViewport ( ) ; var t = this . _pathViewport , e = t . min , i = t . max . subtract ( e ) , n = this . _pathRoot ; o . DomUtil . setPosition ( n , e ) , n . width = i . x , n . height = i . y , n . getContext ( "2d" ) . translate ( - e . x , - e . y ) } } } ) , o . LineUtil = { simplify : function ( t , e ) { if ( ! e || ! t . length ) return t . slice ( ) ; var i = e * e ; return t = this . _reducePoints ( t , i ) , t = this . _simplifyDP ( t , i ) } , pointToSegmentDistance : function ( t , e , i ) { return Math . sqrt ( this . _sqClosestPointOnSegment ( t , e , i , ! 0 ) ) } , closestPointOnSegment : function ( t , e , i ) { return this . _sqClosestPointOnSegment ( t , e , i ) } , _simplifyDP : function ( t , e ) { var n = t . length , o = typeof Uint8Array != i + "" ? Uint8Array : Array , s = new o ( n ) ; s [ 0 ] = s [ n - 1 ] = 1 , this . _simplifyDPStep ( t , s , e , 0 , n - 1 ) ; var a , r = [ ] ; for ( a = 0 ; n > a ; a ++ ) s [ a ] && r . push ( t [ a ] ) ; return r } , _simplifyDPStep : function ( t , e , i , n , o ) { var s , a , r , h = 0 ; for ( a = n + 1 ; o - 1 >= a ; a ++ ) r = this . _sqClosestPointOnSegment ( t [ a ] , t [ n ] , t [ o ] , ! 0 ) , r > h && ( s = a , h = r ) ; h > i && ( e [ s ] = 1 , this . _simplifyDPStep ( t , e , i , n , s ) , this . _simplifyDPStep ( t , e , i , s , o ) ) } , _reducePoints : function ( t , e ) { for ( var i = [ t [ 0 ] ] , n = 1 , o = 0 , s = t . length ; s > n ; n ++ ) this . _sqDist ( t [ n ] , t [ o ] ) > e && ( i . push ( t [ n ] ) , o = n ) ; return s - 1 > o && i . push ( t [ s - 1 ] ) , i } , clipSegment : function ( t , e , i , n ) { var o , s , a , r = n ? this . _lastCode : this . _getBitCode ( t , i ) , h = this . _getBitCode ( e , i ) ; for ( this . _lastCode = h ; ; ) { if ( ! ( r | h ) ) return [ t , e ] ; if ( r & h ) return ! 1 ; o = r || h , s = this . _getEdgeIntersection ( t , e , o , i ) , a = this . _getBitCode ( s , i ) , o === r ? ( t = s , r = a ) : ( e = s , h = a ) } } , _getEdgeIntersection : function ( t , e , n , s ) { var a = e . x - t . x , r = e . y - t . y , h = s . min , l = s . max ; return 8 & n ? new o . Point ( t . x + a * ( l . y - t . y ) / r , l . y ) : 4 & n ? new o . Point ( t . x + a * ( h . y - t . y ) / r , h . y ) : 2 & n ? new o . Point ( l . x , t . y + r * ( l . x - t . x ) / a ) : 1 & n ? new o . Point ( h . x , t . y + r * ( h . x - t . x ) / a ) : i } , _getBitCode : function ( t , e ) { var i = 0 ; return t . x < e . min . x ? i |= 1 : t . x > e . max . x && ( i |= 2 ) , t
} , addHooks : function ( ) { var t = this . _map . _container ; - 1 === t . tabIndex && ( t . tabIndex = "0" ) , o . DomEvent . on ( t , "focus" , this . _onFocus , this ) . on ( t , "blur" , this . _onBlur , this ) . on ( t , "mousedown" , this . _onMouseDown , this ) , this . _map . on ( "focus" , this . _addHooks , this ) . on ( "blur" , this . _removeHooks , this ) } , removeHooks : function ( ) { this . _removeHooks ( ) ; var t = this . _map . _container ; o . DomEvent . off ( t , "focus" , this . _onFocus , this ) . off ( t , "blur" , this . _onBlur , this ) . off ( t , "mousedown" , this . _onMouseDown , this ) , this . _map . off ( "focus" , this . _addHooks , this ) . off ( "blur" , this . _removeHooks , this ) } , _onMouseDown : function ( ) { if ( ! this . _focused ) { var i = e . body , n = e . documentElement , o = i . scrollTop || n . scrollTop , s = i . scrollTop || n . scrollLeft ; this . _map . _container . focus ( ) , t . scrollTo ( s , o ) } } , _onFocus : function ( ) { this . _focused = ! 0 , this . _map . fire ( "focus" ) } , _onBlur : function ( ) { this . _focused = ! 1 , this . _map . fire ( "blur" ) } , _setPanOffset : function ( t ) { var e , i , n = this . _panKeys = { } , o = this . keyCodes ; for ( e = 0 , i = o . left . length ; i > e ; e ++ ) n [ o . left [ e ] ] = [ - 1 * t , 0 ] ; for ( e = 0 , i = o . right . length ; i > e ; e ++ ) n [ o . right [ e ] ] = [ t , 0 ] ; for ( e = 0 , i = o . down . length ; i > e ; e ++ ) n [ o . down [ e ] ] = [ 0 , t ] ; for ( e = 0 , i = o . up . length ; i > e ; e ++ ) n [ o . up [ e ] ] = [ 0 , - 1 * t ] } , _setZoomOffset : function ( t ) { var e , i , n = this . _zoomKeys = { } , o = this . keyCodes ; for ( e = 0 , i = o . zoomIn . length ; i > e ; e ++ ) n [ o . zoomIn [ e ] ] = t ; for ( e = 0 , i = o . zoomOut . length ; i > e ; e ++ ) n [ o . zoomOut [ e ] ] = - t } , _addHooks : function ( ) { o . DomEvent . on ( e , "keydown" , this . _onKeyDown , this ) } , _removeHooks : function ( ) { o . DomEvent . off ( e , "keydown" , this . _onKeyDown , this ) } , _onKeyDown : function ( t ) { var e = t . keyCode , i = this . _map ; if ( e in this . _panKeys ) i . panBy ( this . _panKeys [ e ] ) , i . options . maxBounds && i . panInsideBounds ( i . options . maxBounds ) ; else { if ( ! ( e in this . _zoomKeys ) ) return ; i . setZoom ( i . getZoom ( ) + this . _zoomKeys [ e ] ) } o . DomEvent . stop ( t ) } } ) , o . Map . addInitHook ( "addHandler" , "keyboard" , o . Map . Keyboard ) , o . Handler . MarkerDrag = o . Handler . extend ( { initialize : function ( t ) { this . _marker = t } , addHooks : function ( ) { var t = this . _marker . _icon ; this . _draggable || ( this . _draggable = new o . Draggable ( t , t ) ) , this . _draggable . on ( "dragstart" , this . _onDragStart , this ) . on ( "drag" , this . _onDrag , this ) . on ( "dragend" , this . _onDragEnd , this ) , this . _draggable . enable ( ) } , removeHooks : function ( ) { this . _draggable . off ( "dragstart" , this . _onDragStart ) . off ( "drag" , this . _onDrag ) . off ( "dragend" , this . _onDragEnd ) , this . _draggable . disable ( ) } , moved : function ( ) { return this . _draggable && this . _draggable . _moved } , _onDragStart : function ( ) { this . _marker . closePopup ( ) . fire ( "movestart" ) . fire ( "dragstart" ) } , _onDrag : function ( ) { var t = this . _marker , e = t . _shadow , i = o . DomUtil . getPosition ( t . _icon ) , n = t . _map . layerPointToLatLng ( i ) ; e && o . DomUtil . setPosition ( e , i ) , t . _latlng = n , t . fire ( "move" , { latlng : n } ) . fire ( "drag" ) } , _onDragEnd : function ( ) { this . _marker . fire ( "moveend" ) . fire ( "dragend" ) } } ) , o . Control = o . Class . extend ( { options : { position : "topright" } , initialize : function ( t ) { o . setOptions ( this , t ) } , getPosition : function ( ) { return this . options . position } , setPosition : function ( t ) { var e = this . _map ; return e && e . removeControl ( this ) , this . options . position = t , e && e . addControl ( this ) , this } , getContainer : function ( ) { return this . _container } , addTo : function ( t ) { this . _map = t ; var e = this . _container = this . onAdd ( t ) , i = this . getPosition ( ) , n = t . _controlCorners [ i ] ; return o . DomUtil . addClass ( e , "leaflet-control" ) , - 1 !== i . indexOf ( "bottom" ) ? n . insertBefore ( e , n . firstChild ) : n . appendChild ( e ) , this } , removeFrom : function ( t ) { var e = this . getPosition ( ) , i = t . _controlCorners [ e ] ; return i . removeChild ( this . _container ) , this . _map = null , this . onRemove && this . onRemove ( t ) , this } } ) , o . control = function ( t ) { return new o . Control ( t ) } , o . Map . include ( { addControl : function ( t ) { return t . addTo ( this ) , this } , removeControl : function ( t ) { return t . removeFrom ( this ) , this } , _initControlPos : function ( ) { function t ( t , s ) { var a = i + t + " " + i + s ; e [ t + s ] = o . DomUtil . create ( "div" , a , n ) } var e = this . _controlCorners = { } , i = "leaflet-" , n = this . _controlContainer = o . DomUtil . create ( "div" , i + "control-container" , this . _container ) ; t ( "top" , "left" ) , t ( "top" , "right" ) , t ( "bottom" , "left" ) , t ( "bottom" , "right" ) } , _clearControlPos : function ( ) { this . _container . removeChild ( this . _controlContainer ) } } ) , o . Control . Zoom = o . Control . extend ( { options : { position : "topleft" } , onAdd : function ( t ) { var e = "leaflet-control-zoom" , i = o . DomUtil . create ( "div" , e + " leaflet-bar" ) ; retur