Discussion:
OL2 - layer label opacity
(too old to reply)
Joseph Armbruster
2016-06-29 20:02:14 UTC
Permalink
Hi,

Is there a simple way to change the layers label opacity independent
of the layers opacity. I have some code that calls into
layer.setOpacity and I would like all of my calls to this function to
not operate on feature geometry but not the labels. Is this possible?

On this topic, should there be a fontOpacity within
layer.styleMap.styles.default.defaultStyle?

Thank You,
Joseph Armbruster
prashu84k
2016-06-30 06:14:10 UTC
Permalink
Hi,

You can set opacity while assigning rgba(0,0,0,0.9) color code to label. Set
opacity in last parameter varies from 0.0 to 1.0.See if this works.

Regards,
Prashant



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/OL2-layer-label-opacity-tp5274067p5274095.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
Joseph Armbruster
2016-07-01 20:43:45 UTC
Permalink
João,

This is true and the snippet you provided does illustrate all of the
items of interest. In your example, if you add vector.setOpacity(0.2)
before your 'var center' statement, this will illustrate my situation.
You will notice the labels opacity change. What I am looking for is
the fontOpacity to remain the same even if the layerOpacity is
changed.

Is there a trivial way to implement an override?

Thank You,
Joseph Armbruster
Hi.
I don't know if I understood you question, but there is definitely a
fontOpacity option.
http://codepen.io/joaorodr84/pen/XKRWXy
Please, let me know if this is what you asked for.
Kind regards.
João Rodrigues
Post by Joseph Armbruster
Hi,
Is there a simple way to change the layers label opacity independent
of the layers opacity. I have some code that calls into
layer.setOpacity and I would like all of my calls to this function to
not operate on feature geometry but not the labels. Is this possible?
On this topic, should there be a fontOpacity within
layer.styleMap.styles.default.defaultStyle?
Thank You,
Joseph Armbruster
_______________________________________________
Users mailing list
http://lists.osgeo.org/mailman/listinfo/openlayers-users
Continue reading on narkive:
Loading...