flot
Advanced tools
Comparing version 4.2.3 to 4.2.6
{ | ||
"name": "flot", | ||
"version": "4.2.3", | ||
"version": "4.2.6", | ||
"main": "dist/es5/jquery.flot.js", | ||
@@ -37,6 +37,6 @@ "scripts": { | ||
"gulp-uglify": "^3.0.2", | ||
"jasmine-core": "~2.7.0", | ||
"jasmine-core": "~4.5.0", | ||
"jasmine-jquery": "^2.1.1", | ||
"karma": "^1.3.0", | ||
"karma-chrome-launcher": "^2.0.0", | ||
"karma": "^6.3.0", | ||
"karma-chrome-launcher": "^3.1.0", | ||
"karma-coverage": "^1.1.2", | ||
@@ -46,7 +46,7 @@ "karma-coveralls": "^1.1.2", | ||
"karma-eslint": "^2.2.0", | ||
"karma-firefox-launcher": "^1.3.0", | ||
"karma-jasmine": "^1.0.2", | ||
"karma-jasmine-html-reporter": "^0.2.2", | ||
"karma-firefox-launcher": "^2.1.0", | ||
"karma-jasmine": "^5.1.0", | ||
"karma-jasmine-html-reporter": "^2.0.0", | ||
"karma-safari-launcher": "^1.0.0", | ||
"karma-spec-reporter": "0.0.32", | ||
"karma-spec-reporter": "0.0.36", | ||
"ljs": "^0.3.2", | ||
@@ -53,0 +53,0 @@ "tmp": "0.0.33" |
@@ -26,4 +26,3 @@ /** | ||
ctx.beginPath(); | ||
for (i = ps; i < points.length; i += ps) { | ||
var initPoints = function (i) { | ||
x1 = points[i - ps]; | ||
@@ -33,42 +32,32 @@ y1 = points[i - ps + 1]; | ||
y2 = points[i + 1]; | ||
}; | ||
if (x1 === null || x2 === null) { | ||
var handleSteps = function () { | ||
if (mx !== null && my !== null) { | ||
// if middle point exists, transfer p2 -> p1 and p1 -> mp | ||
x2 = x1; | ||
y2 = y1; | ||
x1 = mx; | ||
y1 = my; | ||
// 'remove' middle point | ||
mx = null; | ||
my = null; | ||
continue; | ||
} | ||
if (isNaN(x1) || isNaN(x2) || isNaN(y1) || isNaN(y2)) { | ||
prevx = null; | ||
prevy = null; | ||
continue; | ||
return true; | ||
} else if (y1 !== y2 && x1 !== x2) { | ||
// create a middle point | ||
y2 = y1; | ||
mx = x2; | ||
my = y1; | ||
} | ||
if (steps) { | ||
if (mx !== null && my !== null) { | ||
// if middle point exists, transfer p2 -> p1 and p1 -> mp | ||
x2 = x1; | ||
y2 = y1; | ||
x1 = mx; | ||
y1 = my; | ||
return false; | ||
}; | ||
// 'remove' middle point | ||
mx = null; | ||
my = null; | ||
// subtract pointsize from i to have current point p1 handled again | ||
i -= ps; | ||
} else if (y1 !== y2 && x1 !== x2) { | ||
// create a middle point | ||
y2 = y1; | ||
mx = x2; | ||
my = y1; | ||
} | ||
} | ||
// clip with ymin | ||
var handleYMinClipping = function () { | ||
if (y1 <= y2 && y1 < axisy.min) { | ||
if (y2 < axisy.min) { | ||
// line segment is outside | ||
continue; | ||
return true; | ||
} | ||
@@ -80,3 +69,3 @@ // compute new intersection point | ||
if (y1 < axisy.min) { | ||
continue; | ||
return true; | ||
} | ||
@@ -87,7 +76,8 @@ | ||
} | ||
}; | ||
// clip with ymax | ||
var handleYMaxClipping = function () { | ||
if (y1 >= y2 && y1 > axisy.max) { | ||
if (y2 > axisy.max) { | ||
continue; | ||
return true; | ||
} | ||
@@ -99,3 +89,3 @@ | ||
if (y1 > axisy.max) { | ||
continue; | ||
return true; | ||
} | ||
@@ -106,7 +96,8 @@ | ||
} | ||
}; | ||
// clip with xmin | ||
var handleXMinClipping = function () { | ||
if (x1 <= x2 && x1 < axisx.min) { | ||
if (x2 < axisx.min) { | ||
continue; | ||
return true; | ||
} | ||
@@ -118,3 +109,3 @@ | ||
if (x1 < axisx.min) { | ||
continue; | ||
return true; | ||
} | ||
@@ -125,7 +116,8 @@ | ||
} | ||
}; | ||
// clip with xmax | ||
var handleXMaxClipping = function () { | ||
if (x1 >= x2 && x1 > axisx.max) { | ||
if (x2 > axisx.max) { | ||
continue; | ||
return true; | ||
} | ||
@@ -137,3 +129,3 @@ | ||
if (x1 > axisx.max) { | ||
continue; | ||
return true; | ||
} | ||
@@ -144,3 +136,5 @@ | ||
} | ||
}; | ||
var drawLine = function () { | ||
if (x1 !== prevx || y1 !== prevy) { | ||
@@ -153,3 +147,48 @@ ctx.moveTo(axisx.p2c(x1) + xoffset, axisy.p2c(y1) + yoffset); | ||
ctx.lineTo(axisx.p2c(x2) + xoffset, axisy.p2c(y2) + yoffset); | ||
}; | ||
ctx.beginPath(); | ||
for (i = ps; i < points.length; i += ps) { | ||
initPoints(i); | ||
if (x1 === null || x2 === null) { | ||
mx = null; | ||
my = null; | ||
continue; | ||
} | ||
if (isNaN(x1) || isNaN(x2) || isNaN(y1) || isNaN(y2)) { | ||
prevx = null; | ||
prevy = null; | ||
continue; | ||
} | ||
if (steps) { | ||
var hadMiddlePoint = handleSteps(); | ||
if (hadMiddlePoint) { | ||
// Subtract pointsize from i to have current point p1 handled again. | ||
i -= ps; | ||
} | ||
} | ||
if (handleYMinClipping()) continue; | ||
if (handleYMaxClipping()) continue; | ||
if (handleXMinClipping()) continue; | ||
if (handleXMaxClipping()) continue; | ||
drawLine(); | ||
} | ||
// Connects last two points in case middle point exists after the loop. | ||
if (mx !== null && my !== null) { | ||
initPoints(i); | ||
handleSteps(); | ||
if (!handleYMinClipping() && | ||
!handleYMaxClipping() && | ||
!handleXMinClipping() && | ||
!handleXMaxClipping()) { | ||
drawLine(); | ||
} | ||
} | ||
ctx.stroke(); | ||
@@ -156,0 +195,0 @@ } |
Sorry, the diff of this file is too big to display
995464
19612