App-Music-ChordPro
view release on metacpan or search on metacpan
lib/ChordPro/res/abc/abc2svg/sth-1.js view on Meta::CPAN
h = sth_a.shift()
if (h == '*')
continue // no change
if (h == '|') { // skip to the next measure bar
for (s = s.next; s; s = s.next) {
if (s.bar_type)
break
}
continue
}
h = Number(h)
if (isNaN(h) || !h)
continue // fixme: error
if (s.stem >= 0) {
s.ys = s.y + h;
s.ymx = (s.ys + 2.5) | 0
} else {
s.ys = s.y - h;
s.ymn = (s.ys - 2.5) | 0
}
s.sth = s.ys
}
}
}, // set_sth()
calculate_beam: function(of, bm, s1) {
var done = of(bm, s1)
if (done && bm.s2 && (s1.sth || bm.s2.sth))
abc2svg.sth.recal_beam.call(this, bm, s1)
return done
},
new_note: function(of, grace, tp_fact) {
var C = abc2svg.C,
s = of(grace, tp_fact),
curvoice = this.get_curvoice()
if (curvoice.sth && s && s.type == C.NOTE) {
s.sth = curvoice.sth;
curvoice.sth = null // some stem widths in this voice
}
return s
},
set_fmt: function(of, cmd, param) {
if (cmd == "sth") {
var curvoice = this.get_curvoice()
if (curvoice)
curvoice.sth = param.split(/[ \t;-]+/)
return
}
of(cmd, param)
},
set_stems: function(of) {
of();
abc2svg.sth.set_sth.call(this)
},
set_hooks: function(abc) {
abc.calculate_beam = abc2svg.sth.calculate_beam.bind(abc, abc.calculate_beam);
abc.new_note = abc2svg.sth.new_note.bind(abc, abc.new_note);
abc.set_format = abc2svg.sth.set_fmt.bind(abc, abc.set_format);
abc.set_stems = abc2svg.sth.set_stems.bind(abc, abc.set_stems)
}
} // sth
if (!abc2svg.mhooks)
abc2svg.mhooks = {}
abc2svg.mhooks.sth = abc2svg.sth.set_hooks
( run in 1.637 second using v1.01-cache-2.11-cpan-2398b32b56e )