yourcelf / olwidget

Javascript library to replace textareas that contain WKT data with editable OpenLayers maps, and a django app using it for django forms and admin.
Other
91 stars 44 forks source link

OpenLayers.Control[control] is not a constructor. #36

Closed skyl closed 14 years ago

skyl commented 14 years ago

Not sure if this is a real bug. Feel free to close but it seems like something is amiss here: new OpenLayers.Control[control]()

Might just be something that I'm doing.

yourcelf commented 14 years ago

What values are you setting to mapOptions.controls? The default is:

mapOptions: {
    ...
    controls: ['LayerSwitcher', 'Navigation', 'PanZoom', 'Attribution']
}

In javascript, there's a parity between arrays and objects -- accessing an object property such as "OpenLayers.Control.PanZoomBar" is the same as accessing "OpenLayers.Control['PanZoomBar']".

So if OpenLayers.Control[control]() is not a constructor, you must be passing in some value for 'control' that is not one of the types present in Openlayers.Control: http://dev.openlayers.org/docs/files/OpenLayers/Control-js.html

skyl commented 14 years ago

Maybe github provides a way to not only close an issue but destroy it? Changes I made were causing this problem, but I "fixed" it before really understanding it.

yourcelf commented 14 years ago

haha. No such option, but no worries.