[OpenLayers-Users] Drag control deactivation
David Alda Fernandez de Lezea
dalda at ikt.es
Mon Dec 21 06:18:35 EST 2009
Hi Brad,
I had a similar problem. I wanted to deactivate navigation controls for a while and I tried this:
for (var i = 0; i< map.controls.length; i++) {
if (map.controls[i].displayClass == "olControlNavigation") {
map.controls[i].deactivate();
}
}
This worked for me. I hope it helps.
Regards.
Un saludo,
··················································································
David Alda Fernández de Lezea
Lurralde eta Biodibertsitate Saila / Dpto. de Territorio y Biodiversidad
IKT
Granja Modelo s/n · 01192 · Arkaute (Araba)
··················································································
Tlfnos.: 945-00-32-95 Fax: 945-00.32.90
··················································································
email: dalda at ikt.es web: www.ikt.es <http://www.ikt.es/>
··················································································
________________________________
De: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] En nombre de Brad Spencer
Enviado el: domingo, 20 de diciembre de 2009 23:40
Para: openlayers users
Asunto: [OpenLayers-Users] Drag control deactivation
I have a checkbox control that the user uses to activate and deactivate feature dragging within a vector layer. This works for activating the drag control but I can't seem to get it to work when deactivating the control:
I setup the drag control after I load the vector layer as follows:
dragItControl =
{
drag: new OpenLayers.Control.DragFeature
(
userMarkers,
{
'onComplete': onCompleteMove
}
)
};
map.addControl(dragItControl['drag']);
dragItControl['drag'].activate();
When trying to deactivate the control, I have tried all of the following separately and collectively with no luck:
dragItControl['drag'].destroy();
dragItControl['drag'].deactivate();
map.removeControl(dragItControl);
dragItControl = null;
The only way I can deactivate the control is to reload the data again and I would prefer not to have to do this.
Any ideas?
Cheers,
Merry Xmas
Brad Spencer
More information about the Users
mailing list