@@ -1961,4 +1961,52 @@ describe('Test geo zoom/pan/drag interactions:', function() {
1961
1961
. catch ( failTest )
1962
1962
. then ( done ) ;
1963
1963
} ) ;
1964
+
1965
+ it ( 'should respect scrollZoom config option' , function ( done ) {
1966
+ var fig = Lib . extendDeep ( { } , require ( '@mocks/geo_winkel-tripel' ) ) ;
1967
+ fig . layout . width = 700 ;
1968
+ fig . layout . height = 500 ;
1969
+ fig . layout . dragmode = 'pan' ;
1970
+
1971
+ function _assert ( step , attr , proj , eventKeys ) {
1972
+ var msg = '[' + step + '] ' ;
1973
+
1974
+ var geoLayout = gd . _fullLayout . geo ;
1975
+ var scale = geoLayout . projection . scale ;
1976
+ expect ( scale ) . toBeCloseTo ( attr [ 0 ] , 1 , msg + 'zoom' ) ;
1977
+
1978
+ var geo = geoLayout . _subplot ;
1979
+ var _scale = geo . projection . scale ( ) ;
1980
+ expect ( _scale ) . toBeCloseTo ( proj [ 0 ] , 0 , msg + 'scale' ) ;
1981
+
1982
+ assertEventData ( msg , eventKeys ) ;
1983
+ }
1984
+
1985
+ plot ( fig )
1986
+ . then ( function ( ) {
1987
+ _assert ( 'base' , [ 1 ] , [ 101.9 ] , undefined ) ;
1988
+ } )
1989
+ . then ( function ( ) { return scroll ( [ 200 , 250 ] , [ - 200 , - 200 ] ) ; } )
1990
+ . then ( function ( ) {
1991
+ _assert ( 'with scroll enable (by default)' ,
1992
+ [ 1.3 ] , [ 134.4 ] ,
1993
+ [ 'geo.projection.rotation.lon' , 'geo.center.lon' , 'geo.center.lat' , 'geo.projection.scale' ]
1994
+ ) ;
1995
+ } )
1996
+ . then ( function ( ) { return Plotly . plot ( gd , [ ] , { } , { scrollZoom : false } ) ; } )
1997
+ . then ( function ( ) { return scroll ( [ 200 , 250 ] , [ - 200 , - 200 ] ) ; } )
1998
+ . then ( function ( ) {
1999
+ _assert ( 'with scrollZoom:false' , [ 1.3 ] , [ 134.4 ] , undefined ) ;
2000
+ } )
2001
+ . then ( function ( ) { return Plotly . plot ( gd , [ ] , { } , { scrollZoom : 'geo' } ) ; } )
2002
+ . then ( function ( ) { return scroll ( [ 200 , 250 ] , [ - 200 , - 200 ] ) ; } )
2003
+ . then ( function ( ) {
2004
+ _assert ( 'with scrollZoom:geo' ,
2005
+ [ 1.74 ] , [ 177.34 ] ,
2006
+ [ 'geo.projection.rotation.lon' , 'geo.center.lon' , 'geo.center.lat' , 'geo.projection.scale' ]
2007
+ ) ;
2008
+ } )
2009
+ . catch ( failTest )
2010
+ . then ( done ) ;
2011
+ } ) ;
1964
2012
} ) ;
0 commit comments