@@ -218,35 +218,35 @@ watch(() => props.features, (newValue) => {
218218
219219function initMap() {
220220 if (! map .value ) {
221- if ( props .bbox ) {
222- const clipped = clipAndEnvelope (props .features , normalizeBbox (props .bbox ))
223-
224- if ( clipped ) {
225- const boundsArray = turfBbox (clipped )
226-
227- const bounds : [[ number , number ], [ number , number ]] = [
228- [ boundsArray [ 0 ], boundsArray [ 1 ]],
229- [boundsArray [2 ], boundsArray [3 ]],
230- ]
231-
232- map . value = new maplibre . Map ({
233- hash: false ,
234- container: ` map-${ props . id } ` ,
235- bounds ,
236- fitBoundsOptions: {
237- padding: paddingOptions ,
238- animate: false ,
239- maxZoom: 17 ,
240- } ,
241- style: MAP_STYLE_URL ,
242- attributionControl: {
243- compact: false ,
244- } ,
245- })
246- map . value . addControl ( new maplibre . NavigationControl () )
247-
248- map . value . on ( ' load ' , handleMapOnLoad )
249- }
221+ const clipped = props .bbox
222+ ? clipAndEnvelope (props .features , normalizeBbox (props .bbox ))
223+ : turfFeatureCollection ( props . features )
224+
225+ if (clipped ) {
226+ const boundsArray = turfBbox ( clipped )
227+
228+ const bounds : [[ number , number ], [ number , number ]] = [
229+ [boundsArray [0 ], boundsArray [1 ]],
230+ [ boundsArray [ 2 ], boundsArray [ 3 ]],
231+ ]
232+
233+ map . value = new maplibre . Map ({
234+ hash: false ,
235+ container: ` map-${ props . id } ` ,
236+ bounds ,
237+ fitBoundsOptions: {
238+ padding: paddingOptions ,
239+ animate: false ,
240+ maxZoom: 17 ,
241+ } ,
242+ style: MAP_STYLE_URL ,
243+ attributionControl: {
244+ compact: false ,
245+ },
246+ } )
247+ map . value . addControl ( new maplibre . NavigationControl ())
248+
249+ map . value . on ( ' load ' , handleMapOnLoad )
250250 }
251251 }
252252}
0 commit comments