11/**
22 * Add Google as Leaflet layer for API integration.
3- *
3+ *
44 * @author Bencevans, Crofty, Raruto
55 *
66 * @link https://gist.github.com/bencevans/4504864
@@ -64,7 +64,7 @@ L.Google = (L.Layer || L.Class).extend({
6464 map . on ( 'viewreset' , this . _resetCallback , this ) ;
6565
6666 this . _limitedUpdate = L . Util . limitExecByInterval ? L . Util . limitExecByInterval ( this . _update , 150 , this ) : L . Util . throttle ( this . _update , 150 , this ) ;
67- map . on ( 'move' , this . _update , this ) ;
67+ map . on ( 'move drag zoomend ' , this . _update , this ) ;
6868
6969 map . on ( 'zoomanim' , this . _handleZoomAnim , this ) ;
7070
@@ -82,7 +82,7 @@ L.Google = (L.Layer || L.Class).extend({
8282
8383 this . _map . off ( 'viewreset' , this . _resetCallback , this ) ;
8484
85- this . _map . off ( 'move' , this . _update , this ) ;
85+ this . _map . off ( 'move drag zoomend ' , this . _update , this ) ;
8686
8787 this . _map . off ( 'zoomanim' , this . _handleZoomAnim , this ) ;
8888
@@ -156,6 +156,17 @@ L.Google = (L.Layer || L.Class).extend({
156156 _this . _pegamenFix ( ) ;
157157 }
158158 ) ;
159+
160+ var panorama = map . getStreetView ( ) ;
161+ if ( panorama ) {
162+ google . maps . event . addListener ( panorama , 'visible_changed' , function ( ) {
163+ if ( panorama . getVisible ( ) ) {
164+ _this . _map . _container . classList . add ( "google-streetview-enabled" ) ;
165+ } else {
166+ _this . _map . _container . classList . remove ( "google-streetview-enabled" ) ;
167+ }
168+ } ) ;
169+ }
159170 } ,
160171
161172 _checkZoomLevels : function ( ) {
0 commit comments