[OpenLayers-Users] OpenLayers.Control.TYPE_TOGGLE with DragFeature

Damien Dudognon ddudognon at anyware-tech.com
Mon Jun 2 12:40:36 EDT 2008


Hi,

I want to use TYPE_TOGGLE to activate/desactivate draw and drag 
controls. It works well with DrawFeature, but fails with DragFeature and 
I don't understand why... Do you know how to solve this problem ?

---------------------------------------------------------------
var containerDraw = document.getElementById("panelDraw");       
var drawpanel = new OpenLayers.Control.Panel({div: containerDraw});
       
c_point = new OpenLayers.Control.DrawFeature
(
    v_edit, OpenLayers.Handler.Point,
    {
        type: OpenLayers.Control.TYPE_TOGGLE,
        'displayClass': 'olControlDrawFeaturePoint'
    }
);

c_ligne = new OpenLayers.Control.DrawFeature
(
    v_edit, OpenLayers.Handler.Path,
    {
        type: OpenLayers.Control.TYPE_TOGGLE,
        handlerOptions: {freehand: true},
        'displayClass': 'olControlDrawFeaturePath'
    }
);

c_polygone = new OpenLayers.Control.DrawFeature
(
    v_edit, OpenLayers.Handler.Polygon,
    {
        type: OpenLayers.Control.TYPE_TOGGLE,
        'displayClass': 'olControlDrawFeaturePolygon'
    }
);

/*
* In this case, TYPE_TOGGLE doesn't work
*/
c_deplacement = new OpenLayers.Control.DragFeature
(
    v_edit, OpenLayers.Handler.Drag,
    {
        type: OpenLayers.Control.TYPE_TOGGLE,
        'displayClass': 'olControlMoveItem'
    }
);
       
drawpanel.addControls([c_point,c_ligne,c_polygone,c_deplacement]);
map.addControl(drawpanel);   
-----------------------------------------------------------------------

Regards,
Damien



More information about the Users mailing list