fix hilight WIP

This commit is contained in:
David Gil 2013-08-20 04:10:18 +02:00
parent 92d7790908
commit 8817e221b5
3 changed files with 7 additions and 15 deletions

View File

@ -256,11 +256,11 @@ class Morris.Line extends Morris.Grid
if @prevHilight isnt null and @prevHilight isnt index
for i in [0..@seriesPoints.length-1]
if @seriesPoints[i][@prevHilight]
@seriesPoints[i][@prevHilight].animate @pointShrinkSeries(index)
@seriesPoints[i][@prevHilight].animate @pointShrinkSeries(i)
if index isnt null and @prevHilight isnt index
for i in [0..@seriesPoints.length-1]
if @seriesPoints[i][index]
@seriesPoints[i][index].animate @pointGrowSeries(index)
@seriesPoints[i][index].animate @pointGrowSeries(i)
@prevHilight = index
colorFor: (row, sidx, type) ->
@ -307,18 +307,14 @@ class Morris.Line extends Morris.Grid
# @private
pointSizeForSeries: (index) ->
if (@options.pointSize instanceof Array)
console.log(@options.pointSize)
console.log(index)
console.log(@options.pointSize.length)
console.log(index % @options.pointSize.length)
@options.pointSize[index % @options.pointSize.length]
else
@options.pointSize
# @private
pointGrowSeries: (index) ->
Raphael.animation r: @pointSizeForSeries(index) + 3, 25, 'linear'
# @private
pointShrinkSeries: (index) ->
Raphael.animation r: @pointSizeForSeries(index), 25, 'linear'

View File

@ -995,14 +995,14 @@
if (this.prevHilight !== null && this.prevHilight !== index) {
for (i = _i = 0, _ref = this.seriesPoints.length - 1; 0 <= _ref ? _i <= _ref : _i >= _ref; i = 0 <= _ref ? ++_i : --_i) {
if (this.seriesPoints[i][this.prevHilight]) {
this.seriesPoints[i][this.prevHilight].animate(this.pointShrinkSeries(index));
this.seriesPoints[i][this.prevHilight].animate(this.pointShrinkSeries(i));
}
}
}
if (index !== null && this.prevHilight !== index) {
for (i = _j = 0, _ref1 = this.seriesPoints.length - 1; 0 <= _ref1 ? _j <= _ref1 : _j >= _ref1; i = 0 <= _ref1 ? ++_j : --_j) {
if (this.seriesPoints[i][index]) {
this.seriesPoints[i][index].animate(this.pointGrowSeries(index));
this.seriesPoints[i][index].animate(this.pointGrowSeries(i));
}
}
}
@ -1049,10 +1049,6 @@
Line.prototype.pointSizeForSeries = function(index) {
if (this.options.pointSize instanceof Array) {
console.log(this.options.pointSize);
console.log(index);
console.log(this.options.pointSize.length);
console.log(index % this.options.pointSize.length);
return this.options.pointSize[index % this.options.pointSize.length];
} else {
return this.options.pointSize;

2
morris.min.js vendored

File diff suppressed because one or more lines are too long