Skip to content

Conversation

JasonSanford
Copy link
Member

Just getting started here with a debug page. If I get good feedback I can add to build scripts and documentation.

See debug/map/rectangle.html (probably should be in the vector directory, oops!)

… build scripts, documentation to be comlete. Addresses #494.
@mourner
Copy link
Member

mourner commented Feb 17, 2012

Awesome! It also needs setBounds (similar to Polygon#setLatLngs) to update the rectangle dynamically, otherwise perfect!

@JasonSanford
Copy link
Member Author

ok, I think this is done. Do you typically do any kind of checking to see if the user passed a proper object type

if (latLngBounds && latLngBounds instanceof L.LatLngBounds) { ...

or just trust that they passed the proper items?

@mourner
Copy link
Member

mourner commented Feb 21, 2012

I mostly don't do checking, because if I did this everywhere it can be added, Leaflet would be 1.5 times bigger in size. JS is not a good language to do strict checking, so this is only done in special cases (that often confuse people).

You now have some repetition in your code, I'd suggest moving latlngs creation to one private method, e.g. _boundsToLatLngs(bounds) -> Array, and call it both in constructor and setBounds.

mourner added a commit that referenced this pull request Feb 22, 2012
@mourner mourner merged commit 4261eb3 into Leaflet:master Feb 22, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants