1

Filling out code for updateShapes

This commit is contained in:
Alex Yatskov 2014-11-05 16:47:20 +09:00
parent 410dbb5540
commit f45f5b14dc

View File

@ -78,7 +78,7 @@
this.start = Math.min(start, end); this.start = Math.min(start, end);
this.end = Math.max(start, end); this.end = Math.max(start, end);
this.containsPoint = function(value) { this.contains = function(value) {
return value >= this.start && value <= this.end; return value >= this.start && value <= this.end;
}; };
@ -159,7 +159,7 @@
_tickSize, _tickSize,
range.start, range.start,
_width - (_densitySize + _tickSize), _width - (_densitySize + _tickSize),
range.end (range.end - range.start)
).attr({'fill': computeFillColor()}); ).attr({'fill': computeFillColor()});
_elements.density = _canvas.rect( _elements.density = _canvas.rect(
@ -169,12 +169,15 @@
_height - _panelSize _height - _panelSize
).attr({'stroke': '#d3d7cf', 'fill': _elements.gradient}); ).attr({'stroke': '#d3d7cf', 'fill': _elements.gradient});
_elements.tick = _canvas.line( if (_range.contains(0.0)) {
0, var origin = valueToIndicator(0.0);
(_height - _panelSize) / 2, _elements.tick = _canvas.line(
_tickSize, 0,
(_height - _panelSize) / 2 origin,
).attr({'stroke': '#888a85'}); _tickSize,
origin
).attr({'stroke': '#888a85'});
}
_elements.panel = _canvas.rect( _elements.panel = _canvas.rect(
_tickSize, _tickSize,
@ -202,7 +205,15 @@
} }
function updateShapes() { function updateShapes() {
_elements.gradient = _canvas.gradient(decimateHints());
_elements.density.attr('fill', _elements.gradient);
var range = computeIndicatorRange();
_elements.indicator.params({
'y': range.start,
'height': range.end - range.start,
'fill': computeFillColor()
});
} }
function decimateHints() { function decimateHints() {