File tree Expand file tree Collapse file tree 2 files changed +26
-3
lines changed Expand file tree Collapse file tree 2 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -114,9 +114,14 @@ function zoomNonClipped(geo, projection) {
114114 function position ( x ) { return projection . invert ( x ) ; }
115115
116116 function outside ( x ) {
117- var pt = projection ( position ( x ) ) ;
118- return ( Math . abs ( pt [ 0 ] - x [ 0 ] ) > INSIDETOLORANCEPXS ||
119- Math . abs ( pt [ 1 ] - x [ 1 ] ) > INSIDETOLORANCEPXS ) ;
117+ var pos = position ( x ) ;
118+ if ( ! pos ) return true ;
119+
120+ var pt = projection ( pos ) ;
121+ return (
122+ Math . abs ( pt [ 0 ] - x [ 0 ] ) > INSIDETOLORANCEPXS ||
123+ Math . abs ( pt [ 1 ] - x [ 1 ] ) > INSIDETOLORANCEPXS
124+ ) ;
120125 }
121126
122127 function handleZoomstart ( ) {
Original file line number Diff line number Diff line change @@ -1941,4 +1941,22 @@ describe('Test geo zoom/pan/drag interactions:', function() {
19411941 . catch ( failTest )
19421942 . then ( done ) ;
19431943 } ) ;
1944+
1945+ it ( 'should guard againt undefined projection.invert result in some projections' , function ( done ) {
1946+ // e.g. aitoff
1947+ var fig = Lib . extendDeep ( { } , require ( '@mocks/geo_aitoff-sinusoidal.json' ) ) ;
1948+ fig . layout . dragmode = 'pan' ;
1949+ delete fig . layout . geo2 ;
1950+ fig . data = [ fig . data [ 0 ] ] ;
1951+ fig . layout . width = 700 ;
1952+ fig . layout . height = 500 ;
1953+
1954+ plot ( fig )
1955+ . then ( function ( ) { return scroll ( [ 131 , 159 ] , [ - 200 , 200 ] ) ; } )
1956+ . then ( function ( ) {
1957+ // scrolling outside subplot frame should log errors,
1958+ } )
1959+ . catch ( failTest )
1960+ . then ( done ) ;
1961+ } ) ;
19441962} ) ;
You can’t perform that action at this time.
0 commit comments