@@ -34,7 +34,7 @@ const Map = function (options) {
3434 } catch ( e ) {
3535 this . center = this . options . center ? new mapboxgl . LngLat ( this . options . center [ 0 ] , this . options . center [ 1 ] ) : new mapboxgl . LngLat ( 0 , 0 ) ;
3636 }
37- this . resize = function ( ) { } ;
37+ this . resize = function ( ) { } ;
3838 this . style = options . style ;
3939 this . setStyle = function ( style , options ) {
4040 if ( style . layers ) {
@@ -53,7 +53,7 @@ const Map = function (options) {
5353 } ;
5454 this . _controlCorners = {
5555 'top-left' : {
56- appendChild : function ( ) { }
56+ appendChild : function ( ) { }
5757 }
5858 } ;
5959
@@ -81,33 +81,33 @@ const Map = function (options) {
8181 this [ setters [ i ] ] = genericSetter ;
8282 }
8383
84- this . setLayoutProperty = function ( layerid ) { } ;
84+ this . setLayoutProperty = function ( layerid ) { } ;
8585
8686 this . addControl = function ( control ) {
8787 control . onAdd ( this ) ;
8888 } ;
8989
9090 this . getStyle = function ( ) {
9191 return {
92- version :8 ,
93- source :this . _sources ,
94- layers :Object . values ( this . _layers )
92+ version : 8 ,
93+ source : this . _sources ,
94+ layers : Object . values ( this . _layers )
9595 }
9696 } ;
9797
9898 this . getContainer = function ( ) {
9999 const container = {
100100 parentNode : container ,
101- appendChild : function ( ) { } ,
102- removeChild : function ( ) { } ,
101+ appendChild : function ( ) { } ,
102+ removeChild : function ( ) { } ,
103103 getElementsByClassName : function ( ) {
104104 return [ container ] ;
105105 } ,
106- addEventListener : function ( name , handle ) { } ,
107- removeEventListener : function ( ) { } ,
106+ addEventListener : function ( name , handle ) { } ,
107+ removeEventListener : function ( ) { } ,
108108 classList : {
109- add : function ( ) { } ,
110- remove : function ( ) { }
109+ add : function ( ) { } ,
110+ remove : function ( ) { }
111111 }
112112 } ;
113113
@@ -134,7 +134,7 @@ const Map = function (options) {
134134 this . removeSource = function ( name ) {
135135 delete this . _sources [ name ] ;
136136 } ;
137- this . off = function ( ) { } ;
137+ this . off = function ( ) { } ;
138138 this . addLayer = function ( layer , before ) {
139139 this . _layers [ layer . id ] = layer ;
140140 if ( layer . onAdd ) {
@@ -150,15 +150,15 @@ const Map = function (options) {
150150 return style ;
151151 } ;
152152
153- this . removeLayer = function ( layerId ) { } ;
154- this . moveLayer = function ( layerId ) { } ;
155- this . getFilter = function ( layerId ) { } ;
156- this . setFilter = function ( layerId , filter ) { } ;
153+ this . removeLayer = function ( layerId ) { } ;
154+ this . moveLayer = function ( layerId ) { } ;
155+ this . getFilter = function ( layerId ) { } ;
156+ this . setFilter = function ( layerId , filter ) { } ;
157157 this . getLayer = function ( id ) {
158- return this . _layers [ layer . id ]
158+ return this . _layers [ id ]
159159 } ;
160160 this . getBounds = function ( ) {
161- return this . bounds ;
161+ return this . bounds || mapboxgl . LngLatBounds . convert ( [ [ - 180 , - 90 ] , [ 180 , 90 ] ] ) ; ;
162162 } ;
163163
164164 this . getZoom = function ( ) {
@@ -184,38 +184,38 @@ const Map = function (options) {
184184 return 22 ;
185185 } ;
186186 this . doubleClickZoom = {
187- disable : function ( ) { } ,
188- enable : function ( ) { }
187+ disable : function ( ) { } ,
188+ enable : function ( ) { }
189189 } ;
190190
191191 this . boxZoom = {
192- disable : function ( ) { } ,
193- enable : function ( ) { }
192+ disable : function ( ) { } ,
193+ enable : function ( ) { }
194194 } ;
195195
196196 this . dragPan = {
197- disable : function ( ) { } ,
198- enable : function ( ) { }
197+ disable : function ( ) { } ,
198+ enable : function ( ) { }
199199 } ;
200200
201201 this . scrollZoom = {
202- disable : function ( ) { } ,
203- enable : function ( ) { }
202+ disable : function ( ) { } ,
203+ enable : function ( ) { }
204204 } ;
205205
206206 this . dragRotate = {
207- disable : function ( ) { } ,
208- enable : function ( ) { }
207+ disable : function ( ) { } ,
208+ enable : function ( ) { }
209209 } ;
210210
211211 this . keyboard = {
212- disable : function ( ) { } ,
213- enable : function ( ) { }
212+ disable : function ( ) { } ,
213+ enable : function ( ) { }
214214 } ;
215215
216216 this . touchZoomRotate = {
217- disable : function ( ) { } ,
218- enable : function ( ) { }
217+ disable : function ( ) { } ,
218+ enable : function ( ) { }
219219 } ;
220220
221221 this . project = function ( ) {
@@ -249,28 +249,28 @@ const Map = function (options) {
249249 return this . zoom ;
250250 } ;
251251 this . loadImage = function ( src , callback ) {
252- callback ( null , [ 1 , 2 , 3 ] ) ;
252+ callback ( null , [ 1 , 2 , 3 ] ) ;
253253 } ;
254- this . addImage = function ( ) { } ;
254+ this . addImage = function ( ) { } ;
255255 this . hasImage = function ( ) {
256256 return true ;
257257 } ;
258- this . getPaintProperty = function ( ) { } ;
259- this . removeImage = function ( ) { } ;
258+ this . getPaintProperty = function ( ) { } ;
259+ this . removeImage = function ( ) { } ;
260260 this . getCanvasContainer = ( ) => {
261- return {
262- appendChild ( ) { } ,
263- addEventListener ( eventName , callback ) { } ,
264- style : {
265- cursor : null
266- }
267- } ;
261+ return this . _container ;
268262 } ;
269263 this . getCanvas = ( ) => {
270264 return {
271265 style : {
272266 width : 100 ,
273267 height : 100
268+ } ,
269+ getBoundingClientRect : function ( ) {
270+ return {
271+ width : 100 ,
272+ height : 100
273+ }
274274 }
275275 } ;
276276 } ;
@@ -279,13 +279,13 @@ const Map = function (options) {
279279 getExtent : ( ) => jest . fn ( )
280280 } ;
281281 } ;
282- this . setCRS = ( ) => { } ;
283- this . flyTo = options => { } ;
284- this . setRenderWorldCopies = epsgCode => { } ;
285- this . triggerRepaint = ( ) => { } ;
286- setTimeout ( ( ) => {
287- this . fire ( 'load' ) ;
288- } , 0 ) ;
282+ this . setCRS = ( ) => { } ;
283+ this . flyTo = options => { } ;
284+ this . setRenderWorldCopies = epsgCode => { } ;
285+ this . triggerRepaint = ( ) => { } ;
286+ setTimeout ( ( ) => {
287+ this . fire ( 'load' ) ;
288+ } , 0 ) ;
289289} ;
290290
291291export default Map ;
0 commit comments