[OpenLayers-Users] OpenLayers.Control.TYPE_TOGGLE with
DragFeature
Eric Lemoine
eric.c2c at gmail.com
Mon Jun 2 13:11:07 EDT 2008
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