lib/leaflet/src/layer/vector/Path.SVG.js in leaflet-js-0.6.beta4 vs lib/leaflet/src/layer/vector/Path.SVG.js in leaflet-js-0.7.0

- old
+ new

@@ -48,10 +48,15 @@ _initPath: function () { this._container = this._createElement('g'); this._path = this._createElement('path'); + + if (this.options.className) { + L.DomUtil.addClass(this._path, this.options.className); + } + this._container.appendChild(this._path); }, _initStyle: function () { if (this.options.stroke) { @@ -78,10 +83,16 @@ if (this.options.dashArray) { this._path.setAttribute('stroke-dasharray', this.options.dashArray); } else { this._path.removeAttribute('stroke-dasharray'); } + if (this.options.lineCap) { + this._path.setAttribute('stroke-linecap', this.options.lineCap); + } + if (this.options.lineJoin) { + this._path.setAttribute('stroke-linejoin', this.options.lineJoin); + } } else { this._path.setAttribute('stroke', 'none'); } if (this.options.fill) { this._path.setAttribute('fill', this.options.fillColor || this.options.color); @@ -102,11 +113,11 @@ // TODO remove duplication with L.Map _initEvents: function () { if (this.options.clickable) { if (L.Browser.svg || !L.Browser.vml) { - this._path.setAttribute('class', 'leaflet-clickable'); + L.DomUtil.addClass(this._path, 'leaflet-clickable'); } L.DomEvent.on(this._container, 'click', this._onMouseClick, this); var events = ['dblclick', 'mousedown', 'mouseover', @@ -152,17 +163,17 @@ if (!this._pathRoot) { this._pathRoot = L.Path.prototype._createElement('svg'); this._panes.overlayPane.appendChild(this._pathRoot); if (this.options.zoomAnimation && L.Browser.any3d) { - this._pathRoot.setAttribute('class', ' leaflet-zoom-animated'); + L.DomUtil.addClass(this._pathRoot, 'leaflet-zoom-animated'); this.on({ 'zoomanim': this._animatePathZoom, 'zoomend': this._endPathZoom }); } else { - this._pathRoot.setAttribute('class', ' leaflet-zoom-hide'); + L.DomUtil.addClass(this._pathRoot, 'leaflet-zoom-hide'); } this.on('moveend', this._updateSvgViewport); this._updateSvgViewport(); }