diff --git a/js/components/MilkdropWindow/Milkdrop.js b/js/components/MilkdropWindow/Milkdrop.js index f1dc30a8..3f99b1bb 100644 --- a/js/components/MilkdropWindow/Milkdrop.js +++ b/js/components/MilkdropWindow/Milkdrop.js @@ -1,4 +1,6 @@ import React from "react"; +import { connect } from "react-redux"; +import { getCurrentTrackDisplayName } from "../../selectors"; import DropTarget from "../DropTarget"; import PresetOverlay from "./PresetOverlay"; @@ -6,7 +8,7 @@ const USER_PRESET_TRANSITION_SECONDS = 5.7; const PRESET_TRANSITION_SECONDS = 2.7; const MILLISECONDS_BETWEEN_PRESET_TRANSITIONS = 15000; -export default class Milkdrop extends React.Component { +class Milkdrop extends React.Component { constructor(props) { super(props); this.state = { @@ -64,6 +66,10 @@ export default class Milkdrop extends React.Component { ) { this.visualizer.setRendererSize(this.props.width, this.props.height); } + + if (this.props.trackTitle !== prevProps.trackTitle) { + this.visualizer.launchSongTitleAnim(this.props.trackTitle); + } } _pauseViz() { @@ -108,6 +114,10 @@ export default class Milkdrop extends React.Component { this.setState({ presetOverlay: !this.state.presetOverlay }); e.stopPropagation(); break; + case 84: // T + this.visualizer.launchSongTitleAnim(this.props.trackTitle); + e.stopPropagation(); + break; case 145: // scroll lock case 125: // F14 (scroll lock for OS X) this.presetCycle = !this.presetCycle; @@ -232,3 +242,9 @@ export default class Milkdrop extends React.Component { ); } } + +const mapStateToProps = state => ({ + trackTitle: getCurrentTrackDisplayName(state) +}); + +export default connect(mapStateToProps)(Milkdrop); diff --git a/package.json b/package.json index 303e341c..c1f406fd 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "babel-jest": "^23.4.2", "babel-loader": "^8.0.0-beta.6", "babel-plugin-remove-webpack": "^1.1.0", - "butterchurn": "^2.4.10", + "butterchurn": "^2.5.3", "butterchurn-presets": "^2.4.7", "canvas-mock": "0.0.0", "cardinal-spline-js": "^2.3.9", diff --git a/yarn.lock b/yarn.lock index 4f1d7278..72e513af 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1596,9 +1596,9 @@ butterchurn-presets@^2.4.7: ecma-proposal-math-extensions "0.0.2" lodash "^4.17.4" -butterchurn@^2.4.10: - version "2.4.10" - resolved "https://registry.yarnpkg.com/butterchurn/-/butterchurn-2.4.10.tgz#bf74ed57629a73063f4726e1ddeabb8bc9276ff1" +butterchurn@^2.5.3: + version "2.5.3" + resolved "https://registry.yarnpkg.com/butterchurn/-/butterchurn-2.5.3.tgz#e654aff4031921003323e1741569af7a24bc4102" dependencies: babel-runtime "^6.26.0" ecma-proposal-math-extensions "0.0.2"