[OpenLayers-Users] OpenLayers.Control.TYPE_TOGGLE with
DragFeature
Damien Dudognon
ddudognon at anyware-tech.com
Thu Jun 5 05:13:50 EDT 2008
My CSS was correct. To solve my problem, I have replaced :
-------------------------------------------------
c_deplacement = new OpenLayers.Control.DragFeature
(
v_edit,
OpenLayers.Handler.Drag,
{
type: OpenLayers.Control.TYPE_TOGGLE,
'displayClass': 'olControlMoveItem'
}
);
-------------------------------------------------
with
-------------------------------------------------
c_deplacement = new OpenLayers.Control.DragFeature
(
v_edit,
{
type: OpenLayers.Control.TYPE_TOGGLE,
'displayClass': 'olControlMoveItem'
}
);
-------------------------------------------------
Eric Lemoine a écrit :
> On Mon, Jun 2, 2008 at 6:40 PM, Damien Dudognon
> <ddudognon at anyware-tech.com> wrote:
>
>> 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);
>>
>
> Probably because you don't have CSS for DragFeature, do you?
>
> --
> Eric
>
More information about the Users
mailing list