Coder Social home page Coder Social logo

workingapp's Introduction

TROMPA selectable-score React component

Screenshot demonstrating selectable score

This repository contains the selectable-score React component, a wrapper around a MELD score component that allows for selection of score elements via click-and-drag, built using the DragSelect node module.

The MELD score is itself a wrapper around the Verovio MEI engraver supporting the incorporation of Linked Data (e.g. Web Annotations).

This component is intended to serve various score-centric applications of the TROMPA project.

Usage

To use the component in your project:

import SelectableScore from 'selectable-score/dist/selectable-score';

If your application requires paging through the score, additionally import the following:

import NextPageButton from 'selectable-score/dist/next-page-button';
import PrevPageButton from 'selectable-score/dist/prev-page-button';

SelectableScore props

The <SelectableScore> component accepts the following props:

{ 
  scale: 45,
  adjustPageHeight: 1,
  pageHeight: 2500,
  pageWidth: 2200,
  footer: "none",
  unit: 6
}
  • selectionString (optional): specifies the CSS selector used by DragSelect for click-and-drag selections. Any valid CSS selector acceptable; if not specified, defaults to .note.

  • onSelectionChange (required): a callback to your application's selection handler.

NextPageButton and PrevPageButton props

The <NextPageButton> and <PrevPageButton> components are simple interaction wrappers that attach a click handler for MELD-score-based paging to any HTML (JSX) elements you care to provide -- typically, "Next page" and "Previous page" buttons. They accept the following props:

  • buttonContent (optional): Your JSX content for the button. This could be as simple as <span>Next page</span>. Note that you can attach your own click handlers if your application requires actions beyond the page turn itself to occur on button click -- but don't stop the click event's propagation (event.stopPropagation), or the page won't turn. Failure to supply buttonContent will result in an empty component.

  • uri (required): Your MEI file's URI.

Demo application

This repository also contains a minimal example React application integrating the selectable-score component. To run it, clone this repository, then:

cd selectable-score
npm install
npm start

Now point your web browser at https://localhost:8080. Wait a few moments for Verovio to render the score.

Click and drag to select MEI elements (in this example, notes); hold down shift or ctrl to select discontinuous regions.

Known issues

Paging is currently very slow. We're working on improving this, through MELD optimisations and potentially by running Verovio as a Web Worker (work in progress!)

Further reading

For more information on TROMPA see the TROMPA website and the following paper:

For more information on MELD see the MELD metarepository and these papers:

workingapp's People

Contributors

fedezubo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.