[OpenLayers-Users] labels looses fix on its marker feature and fixes on viewport location

João Belém lissabon at online.de
Thu Feb 7 05:08:24 PST 2013


Hi OL-users,

I am about to switch from OL 2.10 to 2.12 and noticed that my labels on the
features stay on their last geo-location when zooming near the marker
feature, but the marker correctly moves out of sight on zoom, i.e. the
labels moves apart, like detatched from its marker feature.

Please let me describe:

This happens when
- I first hover the OpenLayers.Feature.Vector (which represents a marker as
backgroundGraphic),
- then an OpenLayers.Popup opens
- and as soon as I hover out (the popup closes)
- and start zooming,
the label on that Feature is no more fixed to it, but is fixed to the
viewport position (the position it had before started zooming).

I recognized that the OpenLayers.Layer.Vector.RootContainer_204_svgRoot had
just multiples of OpenLayers.Feature.Vector_260_label's for all rendered
labels in the viewport before the described action above, that's ok.
However, after zooming, a new one appears, an
OpenLayers.Feature.Vector_260_outline! *The _outline now represents the
styles of the label and is now exactly the one that moves apart!* The _label
stays fixed on the marker feature on zooming, but has new styles, changed to
default style like the "select" style:
fill="black"
stroke="white"
stroke-width="3"

(That means, the correctly fixed _label looks invisible because I have white
backgroundGraphic on my marker features.)

As soon as I hover again onto the marker feature, the visible label (the
_outline) snaps back on its correct location over the marker feature
(correct x and y element attributes), but because it was hovered again, when
zooming, the _outline keeps on running off and fixes again onto the viewport
location.

*Interesting observation:*
When hovered and I zoom and the marker feature leaves the viewport and I
move or zoom it back into viewport, the label keeps being correctly fixed to
its marker feature, i.e. the effect is just recognizable inside rendered
viewport state.

I use a styleMap with Rules and Symbolizers, like seen in some default
examples.
While trying to create a test case, I am yet not aware to reproduce it,
hoping someone had this described behavior and a solution already.
Does anyone imagine what could be the cause to this?

Is it possible to have no _outline rendered for labels? (I should be able to
fix the re-styling of the _label so that it will not appear stroke="white"
etc.)

I could provide more details!

Thanks a lot!
João



--
View this message in context: http://osgeo-org.1560.n6.nabble.com/labels-looses-fix-on-its-marker-feature-and-fixes-on-viewport-location-tp5032786.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list