0xfe/vexflow — pull request #202 by aerhard (2014-04-09 11:10:58+00:00)
Title: changed barline length calculation

Barlines currently only have correct lengths when the stave line thickness is exactly 2px (that's the value specified in `tables.js`); the length calculation also seems to be a little bit complicated and I can't see a reason for that. I there is none (maybe there is), I would propose to replace the relevant code in `stavebarline.js` with analogous lines from `staveconnector.js` ( https://github.com/0xfe/vexflow/blob/master/src/staveconnector.js#L85-L86 ), which are simpler and also work with stave line thicknesses other than 2px. In the pull request, in addition to these changes, I renamed the local variables `top_line` and `bottom_line` in `stavebarline.js` according to `staveconnector.js` and replaced stave property look-ups by calls of the respective getter functions. The tests (all with the default 2px stave line thickness) seem to work well with these changes. I didn't add tests for values other than 2px, since there seems to be no way to change the barline `THICKNESS` other than modifying `tables.js`. Actually, do you think it could be beneficial to make `THICKNESS` accessible in run-time (for instance, by making `var THICKNESS = Vex.Flow.STAVE_LINE_THICKNESS;` https://github.com/0xfe/vexflow/blob/master/src/stavebarline.js#L25 an object property `Barline.THICKNESS = ...`)?