[OpenLayers-Users] Label mis-align with IE9
Andreas Hocevar
ahocevar at opengeo.org
Mon May 30 10:26:38 EDT 2011
Playing with http://openlayers.org/dev/examples/vector-features-with-text.html,
it seems that IE 9 does not align labes well in VML, depending on
doctype and compatibility mode. To make IE9 use the SVG renderer,
which will fix the issue, you have to use the <!DOCTYPE HTML> doctype.
Andreas.
On Mon, May 30, 2011 at 3:54 PM, Frank Broniewski <brfr at metrico.lu> wrote:
> Hi all,
>
> I noticed a problem with the label align in IE9. I have a style as follows:
> var defaultStyle = new OpenLayers.Style(
> {
> 'pointRadius' : '${radius}',
> 'fillColor' : '#ff8200',
> 'fillOpacity' : 1,
> 'strokeColor' : '#fff',
> 'strokeWidth' : 2,
> 'cursor' : 'pointer',
> 'label' : '${label}',
> 'labelAlign' : 'cm',
> 'fontColor' : 'white',
> 'fontFamily' : 'sans-serif',
> 'fontSize' : '12px',
> 'fontWeight' : 'bold'
>
> },
> {
> 'context' : {
> 'radius' : function(feature) {
> if (feature.attributes.count > 1) {
> return 8;
> } else if (feature.attributes.count == 1) {
> // check for custom num_clients attribute
> if (feature.cluster[0].attributes.num_clients &&
> feature.cluster[0].attributes.num_clients > 1) {
> return 8;
> }
> }
> return 6;
> },
> 'label' : function(feature) {
> if (feature.attributes.count > 1) {
> return feature.attributes.count;
> } else if (feature.cluster[0].attributes.num_clients &&
> feature.cluster[0].attributes.num_clients > 1) {
> return
> feature.cluster[0].attributes.num_clients;
> }
> return '';
> }
> }
> }
> );
>
> It's a stylemap on a clustered vector layer and the label is misaligned in
> IE9, it's not in center-middle as it is with firefox or other browsers. Is
> this a known problem with IE? I suppose this is SVG related, so I really
> have no clue what I can do. I'm using OL 2.10 ...
> You can visit http://viaah.lu/adresse/clervaux/clervaux/streets/3/ for an
> example
>
>
> Many thanks
>
> Frank
>
>
>
> --
> Frank BRONIEWSKI
>
> METRICO s.à r.l.
> géomètres
> technologies d'information géographique
> rue des Romains 36
> L-5433 NIEDERDONVEN
>
> tél.: +352 26 74 94 - 28
> fax.: +352 26 74 94 99
> http://www.metrico.lu
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
More information about the Users
mailing list