2 * Vector rendering for IE6-8 through VML.
3 * Thanks to Dmitry Baranovsky and his Raphael library for inspiration!
6 L
.Path
.VML
= (function() {
7 var d
= document
.createElement('div'), s
;
8 d
.innerHTML
= '<v:shape adj="1"/>';
10 s
.style
.behavior
= 'url(#default#VML)';
12 return (s
&& (typeof s
.adj
== 'object'));
15 L
.Path
= L
.Path
.SVG
|| !L
.Path
.VML
? L
.Path
: L
.Path
.extend({
20 _createElement
: (function() {
22 document
.namespaces
.add('lvml', 'urn:schemas-microsoft-com:vml');
23 return function(name
) {
24 return document
.createElement('<lvml:' + name
+ ' class="lvml">');
27 return function(name
) {
28 return document
.createElement('<' + name
+ ' xmlns="urn:schemas-microsoft.com:vml" class="lvml">');
33 _initRoot: function() {
34 if (!this._map
._pathRoot
) {
35 this._map
._pathRoot
= document
.createElement('div');
36 this._map
._pathRoot
.className
= 'leaflet-vml-container';
37 this._map
._panes
.overlayPane
.appendChild(this._map
._pathRoot
);
39 this._map
.on('moveend', this._updateViewport
, this);
40 this._updateViewport();
44 _initPath: function() {
45 this._container
= this._createElement('shape');
46 this._container
.className
+= ' leaflet-vml-shape' +
47 (this.options
.clickable
? ' leaflet-clickable' : '');
48 this._container
.coordsize
= '1 1';
50 this._path
= this._createElement('path');
51 this._container
.appendChild(this._path
);
53 this._map
._pathRoot
.appendChild(this._container
);
56 _initStyle: function() {
57 if (this.options
.stroke
) {
58 this._stroke
= this._createElement('stroke');
59 this._stroke
.endcap
= 'round';
60 this._container
.appendChild(this._stroke
);
62 this._container
.stroked
= false;
64 if (this.options
.fill
) {
65 this._container
.filled
= true;
66 this._fill
= this._createElement('fill');
67 this._container
.appendChild(this._fill
);
69 this._container
.filled
= false;
74 _updateStyle: function() {
75 if (this.options
.stroke
) {
76 this._stroke
.weight
= this.options
.weight
+ 'px';
77 this._stroke
.color
= this.options
.color
;
78 this._stroke
.opacity
= this.options
.opacity
;
80 if (this.options
.fill
) {
81 this._fill
.color
= this.options
.fillColor
|| this.options
.color
;
82 this._fill
.opacity
= this.options
.fillOpacity
;
86 _updatePath: function() {
87 this._container
.style
.display
= 'none';
88 this._path
.v
= this.getPathString() + ' '; // the space fixes IE empty path string bug
89 this._container
.style
.display
= '';