App-Music-ChordPro

 view release on metacpan or  search on metacpan

lib/ChordPro/res/abc/abc2svg/ambitus-1.js  view on Meta::CPAN

		this.set_scale(s);
		this.draw_note(s)
		if (s.notes[1].pit - s.notes[0].pit > 4) {
			this.xypath(s.x, 3 * (s.notes[1].pit - 18) + staff_tb[s.st].y);
			this.out_svg('v' +
				((s.notes[1].pit - s.notes[0].pit) * 3).toFixed(1) +
				'" stroke-width=".6"/>\n');
		}
		s.x += 26;
		s.nhd = 0
		p_voice.clef.nhd = 0
	}
	of(p_voice)
    }, // draw_symbols()

    set_pitch: function(of, last_s) {
	of(last_s)
	if (!last_s && this.cfmt().ambitus)
		abc2svg.ambitus.do_ambitus.call(this)
    },

    set_fmt: function(of, cmd, param) {
	if (cmd == "ambitus") {
		this.cfmt().ambitus = param
		return
	}
	of(cmd, param)
    },

    set_glue: function(of, w) {
    var	v, s,
	voice_tb = this.get_voice_tb()

	of(w)
	if (this.cfmt().ambitus) {
		for (v = 0; v < voice_tb.length; v++) {
			s = voice_tb[v].sym
			while (!s.time && !s.clef_type)
				s = s.next
			if (s && s.nhd) {	// draw the helper lines if any
				s.x -= 26
				this.draw_hl(s)
				s.ymn = 3 * (s.notes[0].pit - 18) - 2
				s.ymx = 3 * (s.notes[1].pit - 18) + 2
				s.x += 26
			}
		}
	}
    }, // set_glue()

    set_width: function(of, s) {
	if (s.clef_type != undefined && s.nhd > 0) {
		s.wl = 40;
		s.wr = 12
	} else {
		of(s)
	}
    },

    set_hooks: function(abc) {
	abc.draw_symbols = abc2svg.ambitus.draw_symbols.bind(abc, abc.draw_symbols);
	abc.set_pitch = abc2svg.ambitus.set_pitch.bind(abc, abc.set_pitch);
	abc.set_format = abc2svg.ambitus.set_fmt.bind(abc, abc.set_format);
	abc.set_sym_glue = abc2svg.ambitus.set_glue.bind(abc, abc.set_sym_glue)
	abc.set_width = abc2svg.ambitus.set_width.bind(abc, abc.set_width)
    }
} // ambitus

if (!abc2svg.mhooks)
	abc2svg.mhooks = {}
abc2svg.mhooks.ambitus = abc2svg.ambitus.set_hooks



( run in 1.093 second using v1.01-cache-2.11-cpan-2398b32b56e )