UNPKG

satie

Version:

A sheet music renderer for the web

140 lines (139 loc) 5.25 kB
/** * This file is part of Satie music engraver <https://github.com/jnetterf/satie>. * Copyright (C) Joshua Netterfield <joshua.ca> 2015 - present. * * Satie is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * Satie is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with Satie. If not, see <http://www.gnu.org/licenses/>. */ "use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var musicxml_interfaces_1 = require("musicxml-interfaces"); var react_1 = require("react"); var private_views_glyph_1 = require("./private_views_glyph"); var $Glyph = react_1.createFactory(private_views_glyph_1.default); var Articulation = (function (_super) { __extends(Articulation, _super); function Articulation() { return _super !== null && _super.apply(this, arguments) || this; } Articulation.prototype.render = function () { var _this = this; var model = this.props.articulation; var children = []; // Articulations not in MusicXML: // "articAccentStaccatoAbove": "U+E4B0", // "articAccentStaccatoBelow": "U+E4B1", // "articLaissezVibrerAbove": "U+E4BA", // "articLaissezVibrerBelow": "U+E4BB", // "articMarcatoStaccatoAbove": "U+E4AE", // "articMarcatoStaccatoBelow": "U+E4AF", // "articStaccatissimoStrokeAbove": "U+E4AA", // "articStaccatissimoStrokeBelow": "U+E4AB", // "articTenutoAccentAbove": "U+E4B4", // "articTenutoAccentBelow": "U+E4B5", // "articTenutoStaccatoBelow": "U+E4B3", // // "breathMarkSalzedo": "U+E4D5", // "breathMarkTick": "U+E4CF", // "breathMarkUpbow": "U+E4D0", // // "caesuraCurved": "U+E4D4", // "caesuraShort": "U+E4D3", // "caesuraThick": "U+E4D2", var append = function (type, name, directioned) { if (directioned === void 0) { directioned = true; } var printStyle = type; var placement = type; var direction = (function () { if (!directioned) { return ""; } switch (placement.placement) { case musicxml_interfaces_1.AboveBelow.Below: return "Below"; case musicxml_interfaces_1.AboveBelow.Above: case musicxml_interfaces_1.AboveBelow.Unspecified: return "Above"; default: return "Above"; } }()); children.push($Glyph({ fill: "black", glyphName: "" + name + direction, key: name, x: _this.props.defaultX + printStyle.defaultX + (printStyle.relativeX || 0), y: (_this.context.originY || 0) - printStyle.defaultY - (printStyle.relativeY || 0) })); }; if (model.accent) { append(model.accent, "articAccent"); } if (model.breathMark) { append(model.breathMark, "breathMarkComma", false); } if (model.caesura) { append(model.caesura, "caesura", false); } if (model.detachedLegato) { append(model.detachedLegato, "articTenutoStaccato"); } if (model.doit) { } if (model.falloff) { } if (model.plop) { } if (model.scoop) { } if (model.spiccato) { append(model.spiccato, "articStaccatissimoWedge"); } if (model.staccatissimo) { append(model.staccatissimo, "articStaccatissimo"); } if (model.staccato) { append(model.staccato, "articStaccato"); } if (model.stress) { append(model.stress, "articStress"); } if (model.strongAccent) { append(model.strongAccent, "articMarcato"); } if (model.tenuto) { append(model.tenuto, "articTenuto"); } if (model.unstress) { append(model.unstress, "articUnstress"); } switch (children.length) { case 0: return null; case 1: return children[0]; default: return react_1.DOM.g(null, children); } }; return Articulation; }(react_1.Component)); Articulation.contextTypes = { originY: react_1.PropTypes.number, }; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = Articulation;