@@ -618,6 +618,42 @@ modeBarButtons.resetViewMapbox = {
618618 }
619619} ;
620620
621+ modeBarButtons . zoomInMapbox = {
622+ name : 'zoomInMapbox' ,
623+ title : function ( gd ) { return _ ( gd , 'Zoom in' ) ; } ,
624+ attr : 'zoom' ,
625+ val : 'in' ,
626+ icon : Icons . zoom_plus ,
627+ click : handleMapboxZoom
628+ } ;
629+
630+ modeBarButtons . zoomOutMapbox = {
631+ name : 'zoomOutMapbox' ,
632+ title : function ( gd ) { return _ ( gd , 'Zoom out' ) ; } ,
633+ attr : 'zoom' ,
634+ val : 'out' ,
635+ icon : Icons . zoom_minus ,
636+ click : handleMapboxZoom
637+ } ;
638+
639+ function handleMapboxZoom ( gd , ev ) {
640+ var button = ev . currentTarget ;
641+ var val = button . getAttribute ( 'data-val' ) ;
642+ var fullLayout = gd . _fullLayout ;
643+ var subplotIds = fullLayout . _subplots . mapbox || [ ] ;
644+ var scalar = 1.05 ;
645+ var aObj = { } ;
646+
647+ for ( var i = 0 ; i < subplotIds . length ; i ++ ) {
648+ var id = subplotIds [ i ] ;
649+ var current = fullLayout [ id ] . zoom ;
650+ var next = ( val === 'in' ) ? scalar * current : current / scalar ;
651+ aObj [ id + '.zoom' ] = next ;
652+ }
653+
654+ Registry . call ( '_guiRelayout' , gd , aObj ) ;
655+ }
656+
621657function resetView ( gd , subplotType ) {
622658 var fullLayout = gd . _fullLayout ;
623659 var subplotIds = fullLayout . _subplots [ subplotType ] || [ ] ;
0 commit comments