Fix bug when options.data.length == 2.

Closes #19
This commit is contained in:
Olly Smith 2012-02-29 08:10:48 +00:00
parent 819f40b3d4
commit b3b8377c53
3 changed files with 14 additions and 8 deletions

View File

@ -223,10 +223,10 @@ class Morris.Line
hideHover()
updateHilight = (x) =>
x -= @el.offset().left
for i in [hoverMargins.length..1]
if hoverMargins[i - 1] > x
for hoverIndex in [hoverMargins.length..0]
if hoverIndex == 0 || hoverMargins[hoverIndex - 1] > x
hilight hoverIndex
break
hilight i
@el.mousemove (evt) =>
updateHilight evt.pageX
touchHandler = (evt) =>

View File

@ -230,12 +230,18 @@
if (index === null) return hideHover();
};
updateHilight = function(x) {
var i, _ref9;
var hoverIndex, _ref9, _results;
x -= _this.el.offset().left;
for (i = _ref9 = hoverMargins.length; _ref9 <= 1 ? i <= 1 : i >= 1; _ref9 <= 1 ? i++ : i--) {
if (hoverMargins[i - 1] > x) break;
_results = [];
for (hoverIndex = _ref9 = hoverMargins.length; _ref9 <= 0 ? hoverIndex <= 0 : hoverIndex >= 0; _ref9 <= 0 ? hoverIndex++ : hoverIndex--) {
if (hoverIndex === 0 || hoverMargins[hoverIndex - 1] > x) {
hilight(hoverIndex);
break;
} else {
_results.push(void 0);
}
}
return hilight(i);
return _results;
};
this.el.mousemove(function(evt) {
return updateHilight(evt.pageX);

2
morris.min.js vendored

File diff suppressed because one or more lines are too long