minor clean up

This commit is contained in:
Vladimir Agafonkin 2013-12-12 23:52:36 -05:00
parent ddb9a376be
commit 41a576b930
2 changed files with 21 additions and 19 deletions

View File

@ -114,13 +114,13 @@ L.Polyline = L.Path.extend({
var parts = this._parts,
bounds = this._renderer._bounds,
i, j, k, segment, points;
i, j, k, len, len2, segment, points;
for (j = 0, k = 0, len = this._rings.length; j < len; j++) {
points = this._rings[j];
for (i = 0, k = 0, len = this._rings.length; i < len; i++) {
points = this._rings[i];
for (i = 0, len2 = points.length; i < len2 - 1; i++) {
segment = L.LineUtil.clipSegment(points[i], points[i + 1], bounds, i);
for (j = 0, len2 = points.length; j < len2 - 1; j++) {
segment = L.LineUtil.clipSegment(points[j], points[j + 1], bounds, j);
if (!segment) { continue; }
@ -128,7 +128,7 @@ L.Polyline = L.Path.extend({
parts[k].push(segment[0]);
// if segment goes out of screen, or it's the last one, it's the end of the line part
if ((segment[1] !== points[i + 1]) || (i === len2 - 2)) {
if ((segment[1] !== points[j + 1]) || (j === len2 - 2)) {
parts[k].push(segment[1]);
k++;
}

View File

@ -18,7 +18,7 @@ L.Browser.vml = !L.Browser.svg && (function () {
}
}());
L.SVG.include(L.Browser.vml ? {} : {
L.SVG.include(!L.Browser.vml ? {} : {
onAdd: function () {
this._container = L.DomUtil.create('div', 'leaflet-vml-container', this.getPane());
@ -115,15 +115,17 @@ L.SVG.include(L.Browser.vml ? {} : {
}
});
L.SVG.create = (function () {
try {
document.namespaces.add('lvml', 'urn:schemas-microsoft-com:vml');
return function (name) {
return document.createElement('<lvml:' + name + ' class="lvml">');
};
} catch (e) {
return function (name) {
return document.createElement('<' + name + ' xmlns="urn:schemas-microsoft.com:vml" class="lvml">');
};
}
})();
if (L.Browser.vml) {
L.SVG.create = (function () {
try {
document.namespaces.add('lvml', 'urn:schemas-microsoft-com:vml');
return function (name) {
return document.createElement('<lvml:' + name + ' class="lvml">');
};
} catch (e) {
return function (name) {
return document.createElement('<' + name + ' xmlns="urn:schemas-microsoft.com:vml" class="lvml">');
};
}
})();
}