[OpenLayers-Users] Unselecting multiple features

Eric Lemoine eric.lemoine at camptocamp.com
Tue Jul 28 03:05:35 EDT 2009


On Mon, Jul 27, 2009 at 12:02 PM, Florian
Diederichs<florian_diederichs at hotmail.com> wrote:
>
> Hi all,
>
> I have encountered a problem with the SelectFeature-Control. I wonder if
> anybody has a workaround/patch, knows anything, or is seeing something I am
> not. Any help would be very much appreciated.
>
> The problems arises every time I use this function:
>
> select: new OpenLayers.Control.SelectFeature(
>                        kunden,
>                        {
>                                onSelect: onFeatureSelect,
>                                onUnselect: onFeatureUnselect,
>                                clickout: true, toggle: true,
>                                multiple: true, hover: false,
>                                box: true,
>                                toggleKey: "ctrlKey",
>                                multipleKey: "shiftKey"
>                        }
>                )
>
>
> It can also be found at http://openlayers.org/dev/examples/ - Open Layers
> Select Feature Example.
>
>
> When you first draw some points and then select the control allowing you to
> select multiple features with a box, unselecting by clicking out isn't
> working. (With "click out to unselect features" = true of course). Only when
> you click on one of the features, the others get unselected. After that,
> unselecting by clicking out works sort of.
>
> Because then, when you unselect by clicking out, only the feature that got
> selected last is rendered as unselected, the others remain in their
> graphical state of being selected. Although they aren't selected, at least
> they are not in the selectedfeatures array of the layer.
>
> I wonder if anybody has a workaround/patch, knows anything, or if i'm just
> doing something wrong. Help would be very much appreciated.

Hi. I know what's going on: when selecting features by drawing a box
the feature handler does not participate in the selection so it never
triggers the clickout callback. I don't see any other way than faking
the feature handler, see the patch attached to this email.

Cheers

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: selectfeature.patch
Type: text/x-diff
Size: 600 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090728/2bf954e8/selectfeature.bin


More information about the Users mailing list