@@ -13,7 +13,7 @@ import classnames from 'classnames';
1313import  isEmpty  from  'lodash.isempty' ; 
1414import  PropTypes  from  'prop-types' ; 
1515
16- import  {  zoomToPoint  }  from  '../actions/map' ; 
16+ import  {  zoomToExtent ,   zoomToPoint  }  from  '../actions/map' ; 
1717import  Icon  from  '../components/Icon' ; 
1818import  SideBar  from  '../components/SideBar' ; 
1919import  Spinner  from  '../components/Spinner' ; 
@@ -39,6 +39,7 @@ class Bookmark extends React.Component {
3939        side : PropTypes . string , 
4040        state : PropTypes . object , 
4141        task : PropTypes . string , 
42+         zoomToExtent : PropTypes . func , 
4243        zoomToPoint : PropTypes . func 
4344    } ; 
4445    static  defaultProps  =  { 
@@ -131,10 +132,15 @@ class Bookmark extends React.Component {
131132    } ; 
132133    zoomToBookmarkExtent  =  ( bookmarkkey )  =>  { 
133134        resolveBookmark ( bookmarkkey ,  ( params )  =>  { 
134-             const  scale  =  parseFloat ( params . s ) ; 
135-             const  zoom  =  MapUtils . computeZoom ( this . props . mapScales ,  scale ) ; 
136-             const  center  =  params . c . split ( / [ ; , ] / g) . map ( x  =>  parseFloat ( x ) ) ; 
137-             this . props . zoomToPoint ( center ,  zoom ,  this . props . mapCrs ) ; 
135+             if  ( 'c'  in  params  &&  's'  in  params )  { 
136+                 const  scale  =  parseFloat ( params . s ) ; 
137+                 const  zoom  =  MapUtils . computeZoom ( this . props . mapScales ,  scale ) ; 
138+                 const  center  =  params . c . split ( / [ ; , ] / g) . map ( x  =>  parseFloat ( x ) ) ; 
139+                 this . props . zoomToPoint ( center ,  zoom ,  this . props . mapCrs ) ; 
140+             }  else  if  ( 'e'  in  params )  { 
141+                 const  bounds  =  ( params . e ) . split ( ',' ) . map ( n  =>  parseFloat ( n ) ) ; 
142+                 this . props . zoomToExtent ( bounds ,  this . props . mapCrs ) ; 
143+             } 
138144        } ) ; 
139145    } ; 
140146    toggleCurrentBookmark  =  ( bookmark )  =>  { 
@@ -189,5 +195,6 @@ const selector = state => ({
189195} ) ; 
190196
191197export  default  connect ( selector ,  { 
198+     zoomToExtent : zoomToExtent , 
192199    zoomToPoint : zoomToPoint 
193200} ) ( Bookmark ) ; 
0 commit comments