1

More improvements to baseline

This commit is contained in:
Alex Yatskov 2014-08-31 09:56:31 +09:00
parent 43ebc4284e
commit 0338eb1dc5

View File

@ -21,18 +21,18 @@ function Column(canvas, name, params, scale, range, bounds) {
} }
this.updateShapes = function(final) { this.updateShapes = function(final) {
this.labelBounds = this.getLabelBounds(this.bounds);
this.columnBounds = this.getColumnBounds(this.bounds); this.columnBounds = this.getColumnBounds(this.bounds);
this.labelBounds = this.getLabelBounds(this.columnBounds);
this.hintBounds = this.getHintBounds(this.columnBounds); this.hintBounds = this.getHintBounds(this.columnBounds);
this.fillBounds = this.getFillBounds(this.columnBounds); this.fillBounds = this.getFillBounds(this.columnBounds);
this.handleBounds = this.getHandleBounds(this.columnBounds, this.fillBounds); this.handleBounds = this.getHandleBounds(this.columnBounds, this.fillBounds);
if (final) { if (final) {
this.updateRect('boundsRect', { this.updateRect('boundsRect', {
left: this.bounds.left, left: this.columnBounds.left,
top: this.bounds.top, top: this.columnBounds.top,
width: this.bounds.width, width: this.columnBounds.width,
height: this.bounds.height, height: this.columnBounds.height,
stroke: this.strokeColor, stroke: this.strokeColor,
fill: this.emptyColor fill: this.emptyColor
}); });
@ -87,12 +87,10 @@ function Column(canvas, name, params, scale, range, bounds) {
}); });
if (final && goog.math.Range.containsPoint(this.range, 0.0)) { if (final && goog.math.Range.containsPoint(this.range, 0.0)) {
var w = 2; var y = this.getPosFromValue(0.0);
var y = this.getPosFromValue(0.0) - w / 2; var p = [this.bounds.left, y, this.bounds.left + this.tickLength, y];
var p = [this.columnBounds.left, y, this.hintBounds.left, y];
this.updateLine('baseline', p, { this.updateLine('baseline', p, {
stroke: this.strokeColor, stroke: this.tickColor
strokeWidth: w
}); });
} }
@ -209,9 +207,9 @@ function Column(canvas, name, params, scale, range, bounds) {
this.getColumnBounds = function(bounds) { this.getColumnBounds = function(bounds) {
return new goog.math.Rect( return new goog.math.Rect(
bounds.left, bounds.left + this.tickLength,
bounds.top, bounds.top,
bounds.width, bounds.width - this.tickLength,
bounds.height - this.labelSize bounds.height - this.labelSize
); );
} }
@ -358,8 +356,10 @@ function Column(canvas, name, params, scale, range, bounds) {
this.hintSize = 10; this.hintSize = 10;
this.labelFontSize = 15; this.labelFontSize = 15;
this.labelSize = 20; this.labelSize = 20;
this.tickLength = 5;
this.emptyColor = '#eeeeec'; this.emptyColor = '#eeeeec';
this.strokeColor = '#d3d7cf'; this.strokeColor = '#d3d7cf';
this.tickColor = '#888a85';
this.canvas = canvas; this.canvas = canvas;
this.shapes = []; this.shapes = [];