clean up lineJoin/lineCap

This commit is contained in:
Vladimir Agafonkin 2013-12-12 19:56:42 -05:00
parent 08028b7a7a
commit 6aa605f606
3 changed files with 15 additions and 16 deletions

View File

@ -13,9 +13,6 @@ L.Canvas = L.Renderer.extend({
var ctx = this._ctx = container.getContext('2d');
ctx.lineCap = 'round';
ctx.lineJoin = 'round';
this.getPane().appendChild(container);
this._update();
},
@ -104,23 +101,25 @@ L.Canvas = L.Renderer.extend({
ctx.globalAlpha = options.opacity;
ctx.lineWidth = options.weight;
ctx.strokeStyle = options.color;
ctx.lineCap = options.lineCap;
ctx.lineJoin = options.lineJoin;
ctx.stroke();
}
// TODO optimization: 1 fill/stroke for all features with equal style instead of 1 for each feature
},
_bringToFront: function (layer) {
// TODO
},
// _bringToFront: function (layer) {
// // TODO
// },
_bringToBack: function (layer) {
// TODO
},
// _bringToBack: function (layer) {
// // TODO
// },
_initEvents: function (layer) {
// TODO
}
// _initEvents: function (layer) {
// // TODO
// }
});
L.Browser.canvas = (function () {

View File

@ -7,8 +7,8 @@ L.Path = L.Layer.extend({
stroke: true,
color: '#0033ff',
// dashArray: null,
// lineCap: null,
// lineJoin: null,
lineCap: 'round',
lineJoin: 'round',
weight: 5,
opacity: 0.5,

View File

@ -73,8 +73,8 @@ L.SVG = L.Renderer.extend({
path.setAttribute('stroke', options.color);
path.setAttribute('stroke-opacity', options.opacity);
path.setAttribute('stroke-width', options.weight);
path.setAttribute('stroke-linecap', options.lineCap || 'round');
path.setAttribute('stroke-linejoin', options.lineJoin || 'round');
path.setAttribute('stroke-linecap', options.lineCap);
path.setAttribute('stroke-linejoin', options.lineJoin);
if (options.dashArray) {
path.setAttribute('stroke-dasharray', options.dashArray);