2amigos / yii2-leaflet-extension

Yii 2 Extension library to display interactive maps with Leaflet .
http://yiiwheels.com
Other
30 stars 26 forks source link

Add support for setting Bounds with ClientOptions #33

Closed sergeantjonas closed 7 years ago

sergeantjonas commented 8 years ago

In our project we wanted to call fitBounds on our map to fit the view based on an array of LatLngBounds (coming from a drawn polygon) but since this code:

   $js[] = "$name.setView({$lateInitClientOptions['center']}, {$lateInitClientOptions['zoom']});";

was being called at the end regardless, we couldn't. So I extended the registerScript function in Map to use an extra parameter in ClientOptions to use fitBounds instead of setView if it is set. The parameter should be a JsExpression of LatLngBounds::getBoundsOfLatLngs().

tonydspaniard commented 8 years ago

@sergeantjonas sorry for the delay. Do you mind fix tests?

markebjones commented 7 years ago

What happened to this? Did it get merged?

tonydspaniard commented 7 years ago

@markebjones needs tests to be fixed

markebjones commented 7 years ago

Ahh ok. Seems to be a problem with composer and fxp/composer-asset-plugin? Looks like a common problem for many Pull Requests. Is it something specific that needs to be done to setup the tests correctly before they are run?

tonydspaniard commented 7 years ago

Give me a few min and I'll fix it

markebjones commented 7 years ago

Cool. Thank you.