Пример #1
0
  constructor() {
    super();

    this.state = {
      midiAccess: null,
      settings: false,
      parameters: false,
      selectGeometry: false,
      info: false,
      noteTrace: [[]], // stack of noteStacks
      renderStack: [], // note stack to render
      octaveMod: 12,
     	commandHeld: false,
     	animationSpeed: 2000, // in milliseconds
     	width: window.innerWidth,
     	height: window.innerHeight,
     	midiBase: 24,
     	octaves: window.innerWidth < 800 ? 2 : 5,
     	autoLength: 4,
     	activeGeometry: 'TriadicChordTypes',
     	activePCs: Scales.chromatic,
     	setClasses: TetrachordalSetClasses.multisets_only,
     	voiceleading: {
	     	singleStepVL: true,
	     	twoVoiceParallel: false,
	     	twoVoiceContrary: false,
	     	threeVoiceParallel: false,
	     	threeVoiceContrary: false
     	}
    }

    this.handleMidiEvent = this.handleMidiEvent.bind(this);
    this.handlePianoEvent = this.handlePianoEvent.bind(this);
    this.toggleSettings = this.toggleSettings.bind(this);
    this.togglePitchClass = this.togglePitchClass.bind(this);
    this.toggleScale = this.toggleScale.bind(this);
    this.toggleSetClass = this.toggleSetClass.bind(this);
    this.toggleParameters = this.toggleParameters.bind(this);
    this.toggleSelectGeometry = this.toggleSelectGeometry.bind(this);
    this.toggleGeometry = this.toggleGeometry.bind(this);
    this.toggleInfo = this.toggleInfo.bind(this);
    this.removeSetClass = this.removeSetClass.bind(this);
    this.toggleSetClassPreset = this.toggleSetClassPreset.bind(this);

    this.hotkeyHandler = this.handleHotkey.bind(this);
    hotkey.activate('keydown');
    hotkey.activate('keyup');
    hotkey.activate('keypress');
  }
Пример #2
0
import React, { Component, PropTypes } from 'react';
import { Provider } from 'react-redux';
import { hashHistory, Router, Redirect, Route } from 'react-router';
import hotkey from 'react-hotkey';
hotkey.activate('keydown');

import App from '../components/App';
import ListContainer from './ListContainer';
import SearchContainer from './SearchContainer';
import ExploreContainer from './ExploreContainer';
import CalendarContainer from './CalendarContainer';
import SettingsContainer from './SettingsContainer';
import ExploreCollections from '../components/ExploreCollections';
import RSSFeedContainer from './RSSFeedContainer';
import ChartContainer from './ChartContainer';
import OnboardContainer from './OnboardContainer';

class Root extends Component {
  componentDidMount() {
    setTimeout(() => {
      $('body').addClass('visible');
    }, 500);
  }
  render() {
    const store = this.props.store;
    return (
      <Provider store={store}>
        <Router history={hashHistory}>
          <Redirect from="/" to="/animelist" />
          <Route path="/" component={App}>
            <Route path="/animelist" component={ListContainer} />
Пример #3
0
var React = require('react/addons');
var HotKey = require('react-hotkey');

HotKey.activate('keydown');

var isTextInputElement = require('react/lib/isTextInputElement');

var MPDiscoController = require('../mpdisco_controller.js');

var tree = require('../mpdisco_model.js').tree;

var PlayerMixin = {
    mixins: [HotKey.Mixin('handleKeyboard'), tree.mixin],

    propTypes: {
        controller: React.PropTypes.instanceOf(MPDiscoController).isRequired
    },

    cursors: {
        song: ['currentsong'],
        status: ['status']
    },

    getInitialState: function() {
        return {
            animations: false,
            time: 0,
            indicatorAppear: false,
            indicatorState: null
        };
    },