kekscom / osmbuildings

OSM Buildings Classic 2.5D
http://osmbuildings.org
BSD 2-Clause "Simplified" License
505 stars 140 forks source link

Two bug fixes: check for non-null attributionControl and listen for onViewReset event #45

Closed bennlich closed 11 years ago

bennlich commented 11 years ago

1) Leaflet lets users disable attributionControl in Map options. I added a check for attributionControl before OSM tries to add its attribution.

2) After calling map.setView() and loading new building data, the building layer would be incorrectly offset until after scrolling the map. I added an onViewReset listener that realigns the building layer (just like onMoveEnd).

Note: the onViewReset event is also triggered after a zoom, so it might be worthwhile to set a flag in onZoom that prevents the onViewReset event handler from firing, but I didn't notice a significant performance hit.

kekscom commented 11 years ago

Final check tomorrow, which is really son for me. I'll do the merge then. Thanks!

bennlich commented 11 years ago

Np! Thanks for the awesome lib.

On Thu, Aug 1, 2013 at 5:11 PM, Jan Marsch notifications@github.com wrote:

Final check tomorrow, which is really son for me. I'll do the merge then. Thanks!

— Reply to this email directly or view it on GitHubhttps://github.com/kekscom/osmbuildings/pull/45#issuecomment-21978968 .

kekscom commented 11 years ago

You're very welcome!

I needed to merge manually, it's now here c1bd0b41e18b21b0dfb6a3ae2fbec2a49e450dfd After more testing I think it's fine to call onViewReset whenever its needed so I skipped the flag for it.

Thanks!

bennlich commented 11 years ago

Cool! How do those debug flags work?

kekscom commented 11 years ago

When testing I usually run tests/index.php that doesn't need to be build. Then everything between the flag's tags gets executed. During build, all of that gets removed :-)

bennlich commented 11 years ago

Ah, k, cool.

On Fri, Aug 2, 2013 at 1:54 PM, Jan Marsch notifications@github.com wrote:

When testing I usually run tests/index.php that doesn't need to be build. Then everything between the flag's tags gets executed. During build, all of that gets removed :-)

— Reply to this email directly or view it on GitHubhttps://github.com/kekscom/osmbuildings/pull/45#issuecomment-22035259 .