[OpenLayers-Users] Labels/Tooltips on mouse over a Vector layer

Adrian Popa adrian_gh.popa at romtelecom.ro
Thu Jul 16 08:07:56 EDT 2009


Hello Pavel,

Great idea... However - I would like to keep popups for when I click on 
an item.
Would it be possible to do something like:

layer.events.on({ "featureselected": onLocationSelect, 
"featureunselected": onLocationUnselect,  //open regular popups
                                  "onMouseOver": onLocationMouseOver, 
"onMouseOut": onLocationMouseOut
 });?

Problem is - I don't see those kinds of events on my layer. These are 
the event types for a vector layer:
0 "beforefeatureadded"
1 "beforefeaturesadded"
2 "featureadded"
3 "featuresadded"
4 "beforefeatureremoved"
5 "featureremoved"
6 "featuresremoved"
7 "beforefeatureselected"
8 "featureselected"
9 "featureunselected"
10 "beforefeaturemodified"
11 "featuremodified"
12 "afterfeaturemodified"
13 "vertexmodified"
14 "sketchstarted"
15 "sketchmodified"
16 "sketchcomplete"
17 "refresh"
18 "loadstart"
19 "loadend"
20 "loadcancel"
21 "visibilitychanged"
22 "move"
23 "moveend"

Any idea what the events would be? If they are supported?

Pavel Iacovlev wrote:
> There many possible ways around this problem.
>
> One is rewrite/extend your popup code. Popup is triggered on mouseover
> and on mouseout popup is hidden. You can style the popup so it looks
> more like a tooltip/label.
>
> On Thu, Jul 16, 2009 at 2:34 PM, Adrian
> Popa<adrian_gh.popa at romtelecom.ro> wrote:
>   
>> Hi,
>>
>> Just a quick question - my users want to see the name of the city when
>> they are hovering over points loaded through KML in a vector layer. I
>> know this isn't supported, but are there plans to support such labels?
>>
>> I'm thinking a different strategy might be to override/inherit the
>> OpenLayers.Control.MousePosition class and based on coordinate changes,
>> load the name from the closest KML feature. It doesn't need to be too
>> accurate, but it can't be an exact match, because the mouse will never
>> get that close to the KML coordinates.
>> However this solution will be costly - because on every mouse move you
>> would have to go through all the KML items and see which match...
>>
>> What are your ideas regarding this subject?
>>
>> ---
>>
>> Adrian Popa
>> NOC Division
>> Network Engineer
>> Divizia Centrul National de Operare Retea
>> Departament Transport IP & Metro
>> Compartiment IP Core & Backbone
>> Phone: +40 21 400 3099
>>
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
>>     
>
>
>
>   


-- 
--- 
Adrian Popa
NOC Division
Network Engineer
Divizia Centrul National de Operare Retea
Departament Transport IP & Metro
Compartiment IP Core & Backbone
Phone: +40 21 400 3099

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090716/a7a7f3f0/attachment.html


More information about the Users mailing list