@@ -53,8 +53,12 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
53
53
if ( ! document . namespaces . olv ) {
54
54
document . namespaces . add ( "olv" , this . xmlns ) ;
55
55
var style = document . createStyleSheet ( ) ;
56
- style . addRule ( 'olv\\:*' , "behavior: url(#default#VML); " +
57
- "position: absolute; display: inline-block;" ) ;
56
+ var shapes = [ 'shape' , 'rect' , 'oval' , 'fill' , 'stroke' , 'imagedata' , 'group' , 'textbox' ] ;
57
+ for ( var i = 0 , len = shapes . length ; i < len ; i ++ ) {
58
+
59
+ style . addRule ( 'olv\\:' + shapes [ i ] , "behavior: url(#default#VML); " +
60
+ "position: absolute; display: inline-block;" ) ;
61
+ }
58
62
}
59
63
60
64
OpenLayers . Renderer . Elements . prototype . initialize . apply ( this ,
@@ -111,14 +115,14 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
111
115
112
116
113
117
var org = left + " " + top ;
114
- this . root . setAttribute ( " coordorigin" , org ) ;
118
+ this . root . coordorigin = org ;
115
119
var roots = [ this . root , this . vectorRoot , this . textRoot ] ;
116
120
var root ;
117
121
for ( var i = 0 , len = roots . length ; i < len ; ++ i ) {
118
122
root = roots [ i ] ;
119
123
120
124
var size = this . size . w + " " + this . size . h ;
121
- root . setAttribute ( " coordsize" , size ) ;
125
+ root . coordsize = size ;
122
126
123
127
}
124
128
// flip the VML display Y axis upside down so it
@@ -240,11 +244,10 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
240
244
options . isStroked = false ;
241
245
} else if ( this . isComplexSymbol ( style . graphicName ) ) {
242
246
var cache = this . importSymbol ( style . graphicName ) ;
243
- node . setAttribute ( "path" , cache . path ) ;
244
- node . setAttribute ( "coordorigin" , cache . left + "," +
245
- cache . bottom ) ;
247
+ node . path = cache . path ;
248
+ node . coordorigin = cache . left + "," + cache . bottom ;
246
249
var size = cache . size ;
247
- node . setAttribute ( " coordsize" , size + "," + size ) ;
250
+ node . coordsize = size + "," + size ;
248
251
this . drawCircle ( node , geometry , style . pointRadius ) ;
249
252
node . style . flip = "y" ;
250
253
} else {
@@ -254,9 +257,9 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
254
257
255
258
// fill
256
259
if ( options . isFilled ) {
257
- node . setAttribute ( " fillcolor" , style . fillColor ) ;
260
+ node . fillcolor = style . fillColor ;
258
261
} else {
259
- node . setAttribute ( " filled" , "false" ) ;
262
+ node . filled = "false" ;
260
263
}
261
264
var fills = node . getElementsByTagName ( "fill" ) ;
262
265
var fill = ( fills . length == 0 ) ? null : fills [ 0 ] ;
@@ -268,18 +271,18 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
268
271
if ( ! fill ) {
269
272
fill = this . createNode ( 'olv:fill' , node . id + "_fill" ) ;
270
273
}
271
- fill . setAttribute ( " opacity" , style . fillOpacity ) ;
274
+ fill . opacity = style . fillOpacity ;
272
275
273
276
if ( node . _geometryClass == "OpenLayers.Geometry.Point" &&
274
277
style . externalGraphic ) {
275
278
276
279
// override fillOpacity
277
280
if ( style . graphicOpacity ) {
278
- fill . setAttribute ( " opacity" , style . graphicOpacity ) ;
281
+ fill . opacity = style . graphicOpacity ;
279
282
}
280
283
281
- fill . setAttribute ( " src" , style . externalGraphic ) ;
282
- fill . setAttribute ( " type" , "frame" ) ;
284
+ fill . src = style . externalGraphic ;
285
+ fill . type = "frame" ;
283
286
284
287
if ( ! ( style . graphicWidth && style . graphicHeight ) ) {
285
288
fill . aspect = "atmost" ;
@@ -298,18 +301,18 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
298
301
// the graphic as imagedata element. We cannot just remove
299
302
// the fill, because this is part of the hack described
300
303
// in graphicRotate
301
- fill . setAttribute ( " opacity" , 0 ) ;
304
+ fill . opacity = 0 ;
302
305
} else {
303
306
node . style . rotation = style . rotation ;
304
307
}
305
308
}
306
309
307
310
// stroke
308
311
if ( options . isStroked ) {
309
- node . setAttribute ( " strokecolor" , style . strokeColor ) ;
310
- node . setAttribute ( " strokeweight" , style . strokeWidth + "px" ) ;
312
+ node . strokecolor = style . strokeColor ;
313
+ node . strokeweight = style . strokeWidth + "px" ;
311
314
} else {
312
- node . setAttribute ( " stroked" , " false" ) ;
315
+ node . stroked = false ;
313
316
}
314
317
var strokes = node . getElementsByTagName ( "stroke" ) ;
315
318
var stroke = ( strokes . length == 0 ) ? null : strokes [ 0 ] ;
@@ -322,9 +325,9 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
322
325
stroke = this . createNode ( 'olv:stroke' , node . id + "_stroke" ) ;
323
326
node . appendChild ( stroke ) ;
324
327
}
325
- stroke . setAttribute ( " opacity" , style . strokeOpacity ) ;
326
- stroke . setAttribute ( " endcap" , ! style . strokeLinecap || style . strokeLinecap == 'butt' ? 'flat' : style . strokeLinecap ) ;
327
- stroke . setAttribute ( " dashstyle" , this . dashStyle ( style ) ) ;
328
+ stroke . opacity = style . strokeOpacity ;
329
+ stroke . endcap = ! style . strokeLinecap || style . strokeLinecap == 'butt' ? 'flat' : style . strokeLinecap ;
330
+ stroke . dashstyle = this . dashStyle ( style ) ;
328
331
}
329
332
330
333
if ( style . cursor != "inherit" && style . cursor != null ) {
@@ -453,12 +456,12 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
453
456
var fillColor = node . _style . fillColor ;
454
457
var strokeColor = node . _style . strokeColor ;
455
458
if ( fillColor == "none" &&
456
- node . getAttribute ( " fillcolor" ) != fillColor ) {
457
- node . setAttribute ( " fillcolor" , fillColor ) ;
459
+ node . fillcolor != fillColor ) {
460
+ node . fillcolor = fillColor ;
458
461
}
459
462
if ( strokeColor == "none" &&
460
- node . getAttribute ( " strokecolor" ) != strokeColor ) {
461
- node . setAttribute ( " strokecolor" , strokeColor ) ;
463
+ node . strokecolor != strokeColor ) {
464
+ node . strokecolor = strokeColor ;
462
465
}
463
466
} ,
464
467
@@ -544,12 +547,12 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
544
547
createNode : function ( type , id ) {
545
548
var node = document . createElement ( type ) ;
546
549
if ( id ) {
547
- node . setAttribute ( 'id' , id ) ;
550
+ node . id = id ;
548
551
}
549
552
550
553
// IE hack to make elements unselectable, to prevent 'blue flash'
551
554
// while dragging vectors; #1410
552
- node . setAttribute ( ' unselectable' , 'on' , 0 ) ;
555
+ node . unselectable = 'on' ;
553
556
node . onselectstart = function ( ) { return ( false ) ; } ;
554
557
555
558
return node ;
@@ -816,7 +819,10 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
816
819
textbox . style . fontWeight = style . fontWeight ;
817
820
}
818
821
textbox . style . whiteSpace = "nowrap" ;
819
- textbox . inset = "0px,0px,0px,0px" ;
822
+ // fun with IE: IE7 in standards compliant mode does not display any
823
+ // text with a left inset of 0. So we set this to 1px and subtract one
824
+ // pixel later when we set label.style.left
825
+ textbox . inset = "1px,0px,0px,0px" ;
820
826
821
827
if ( ! label . parentNode ) {
822
828
label . appendChild ( textbox ) ;
@@ -828,7 +834,7 @@ OpenLayers.Renderer.VML = OpenLayers.Class(OpenLayers.Renderer.Elements, {
828
834
( OpenLayers . Renderer . VML . LABEL_SHIFT [ align . substr ( 0 , 1 ) ] ) ;
829
835
var yshift = textbox . clientHeight *
830
836
( OpenLayers . Renderer . VML . LABEL_SHIFT [ align . substr ( 1 , 1 ) ] ) ;
831
- label . style . left = parseInt ( label . style . left ) - xshift + "px" ;
837
+ label . style . left = parseInt ( label . style . left ) - xshift - 1 + "px" ;
832
838
label . style . top = parseInt ( label . style . top ) + yshift + "px" ;
833
839
} ,
834
840
0 commit comments