Permalink
Browse files

Smarter justification when dealing with barlines.

Barlines are set to ignore ticks (since they have no time value), but
steal space from the measure. This change recalculates the per-tick
space everytime a barline (or other elements with ignored ticks) are
encountered.
  • Loading branch information...
1 parent 9629d4b commit 1fa6ab6da338d509da96b18c928d326169e23db4 @0xfe committed Nov 29, 2012
Showing with 7 additions and 0 deletions.
  1. +7 −0 src/formatter.js
View
@@ -282,6 +282,13 @@ Vex.Flow.Formatter.prototype.preFormat = function(justifyWidth) {
set_x = context.shouldIgnoreTicks() ?
(min_x + context.getWidth()) : Math.max(set_x, min_x);
+ if (context.shouldIgnoreTicks() && justifyWidth) {
+ // This note stole room... recalculate with new justification width.
+ justifyWidth -= context.getWidth();
+ this.pixelsPerTick = justifyWidth /
+ (this.totalTicks.value() * contexts.resolutionMultiplier);
+ }
+
// Determine pixels needed for left modifiers
var left_px = thisMetrics.extraLeftPx;

0 comments on commit 1fa6ab6

Please sign in to comment.