[OpenLayers-Dev] SelectFeature control
Alexandre Dube
adube at mapgears.com
Thu Mar 5 09:41:51 EST 2009
Hi Eric,
That's a nice and great approach without hurting the core a all.
There's just a small issue with this solution ( see below ).
Keep up the excellent work,
Alexandre
Eric Lemoine wrote:
> On Tue, Mar 3, 2009 at 7:05 PM, Eric Lemoine <eric.c2c at gmail.com> wrote:
>
>> Alexandre
>>
>> I fully support the idea of being able to have two "highlight feature"
>> controls working at the same time, one on hover and one on click.
>> However i don't like the renderIntent array in the feature class, it
>> brings extra complexity that I think is undesirable. I have to say
>> though that i cannot think of a better solution at this point. Still
>> thinking...
>>
>> Thanks for bringing this back up.
>>
>
>
> Alexandre,
>
> What about this: add an highlightOnly boolean option to the select
> feature control, if highlightOnly is true then do not select features,
> just highlight them. Also, if highlightOnly is set to true, when
> clicking or moving out of an highlighted feature do not unhighlight
> the feature if it is in the selected features array, i.e. if it was
> previously selected (by another select feature control).
>
Control #1, select on click, color: blue
Control #2, select on hover, color: yellow, highlightOnly
Mouse over a feature, it's not selected but color changed to yellow. ( OK )
Click on this feature, it's selected and color changed to blue. ( OK )
Move moves over the feature, it remains blue ( OK )
Move out of the feature, it remains blue ( OK )
Move back over the feature, it's not selected but changes from blue to
yellow ( OK )
Move out, it remains yellow ( not OK : it should be drawn back to blue )
Selecting a bunch of features on click with control #1 renders them to
blue, but hovering them makes control #2 renders them to yellow instead.
It's a small price to pay if we consider that your changes don't hurt
the core at all, which is a good thing in my opinion.
BUT ( sorry to bring that up again ^_^ ), a renderIntent "stack" would
resolve this small issue. We would just need to call
this.layer.drawFeature(feature) instead of not calling
this.drawFeature(feature) to draw the feature back to its previous
renderIntent.
What do you ( and others ) think ?
> See the attached patch. Note that patch isn't complete - the select
> feature control should trigger "featurehighlighted" and
> "featureunhighlighted" events to complete the picture.
>
> What do you think?
>
> --
> Eric
>
--
Alexandre Dubé
Mapgears
www.mapgears.com
More information about the Dev
mailing list