Zoomslider cannot be added to a map with no target

The zoom slider control's initSlider_ function requires that the control's element is inserted in the document. So if initSlider_ is called before the map have a target then the slider isn't correctly initialized. This commit fixes that by defering the slider initialization until the first handleMapPostrender call.
This commit is contained in:
Éric Lemoine
2013-07-05 22:37:31 +02:00
parent a071c3521c
commit ccf6aa10ac
2 changed files with 14 additions and 5 deletions

View File

@@ -68,6 +68,7 @@ describe('ol.control.ZoomSlider', function() {
control.element.style.width = '1000px';
control.element.style.height = '10px';
control.setMap(map);
control.initSlider_();
var horizontal = ol.control.ZoomSlider.direction.HORIZONTAL;
expect(control.direction_).to.be(horizontal);