diff --git a/css/equalizer-window.css b/css/equalizer-window.css index 276dbd99..8d99e0cc 100644 --- a/css/equalizer-window.css +++ b/css/equalizer-window.css @@ -8,6 +8,70 @@ height: 14px; } +#winamp2-js #equalizer-volume { + position: absolute; + left: 60px; + top: 4px; + height: 6px; + width: 97px; + background-position: 0 0; + cursor: url('../cursors/POSBAR.PNG'), auto; +} + +#winamp2-js #equalizer-volume::-webkit-slider-thumb { + height: 7px; + width: 2px; + cursor: url('../cursors/POSBAR.PNG'), auto; +} + +#winamp2-js #equalizer-volume::-moz-range-thumb { + height: 7px; + width: 2px; + cursor: url('../cursors/POSBAR.PNG'), auto; +} + +#winamp2-js #equalizer-volume.center::-webkit-slider-thumb { + width: 5px; + cursor: url('../cursors/POSBAR.PNG'), auto; +} + +#winamp2-js #equalizer-volume.center::-moz-range-thumb { + width: 5px; + cursor: url('../cursors/POSBAR.PNG'), auto; +} + +#winamp2-js #equalizer-balance { + position: absolute; + left: 164px; + top: 4px; + height: 6px; + width: 43px; + background-position: 0 0; + cursor: url('../cursors/POSBAR.PNG'), auto; +} + +#winamp2-js #equalizer-balance::-webkit-slider-thumb { + height: 7px; + width: 2px; + cursor: url('../cursors/POSBAR.PNG'), auto; +} + +#winamp2-js #equalizer-balance::-moz-range-thumb { + height: 7px; + width: 2px; + cursor: url('../cursors/POSBAR.PNG'), auto; +} + +#winamp2-js #equalizer-balance.center::-webkit-slider-thumb { + width: 5px; + cursor: url('../cursors/POSBAR.PNG'), auto; +} + +#winamp2-js #equalizer-balance.center::-moz-range-thumb { + width: 5px; + cursor: url('../cursors/POSBAR.PNG'), auto; +} + #winamp2-js .equalizer-top { height: 14px; width: 275px; diff --git a/js/components/Balance.js b/js/components/Balance.js new file mode 100644 index 00000000..ae0c76c3 --- /dev/null +++ b/js/components/Balance.js @@ -0,0 +1,31 @@ +import React from "react"; +import { connect } from "react-redux"; + +import { setBalance } from "../actionCreators"; +import { SET_FOCUS, UNSET_FOCUS } from "../actionTypes"; + +const Balance = props => + ; + +const mapDispatchToProps = dispatch => ({ + handleChange: e => dispatch(setBalance(e.target.value)), + showMarquee: () => dispatch({ type: SET_FOCUS, input: "balance" }), + hideMarquee: () => dispatch({ type: UNSET_FOCUS }) +}); + +export default connect( + state => ({ balance: state.media.balance }), + mapDispatchToProps +)(Balance); diff --git a/js/components/EqualizerWindow/EqGraph.js b/js/components/EqualizerWindow/EqGraph.js index 30dfb155..51cded36 100644 --- a/js/components/EqualizerWindow/EqGraph.js +++ b/js/components/EqualizerWindow/EqGraph.js @@ -23,11 +23,17 @@ class EqGraph extends React.Component { this.canvasCtx.imageSmoothingEnabled = false; this.width = this.canvas.width * 1; // Cast to int this.height = this.canvas.height * 1; // Cast to int + + if (this.props.lineColorsImage) { + this.createColorPattern(this.props.lineColorsImage); + } + if (this.props.preampLineUrl) { + this.createPreampLineImage(this.props.preampLineUrl); + } } componentDidUpdate() { this.canvasCtx.clearRect(0, 0, this.width, this.height); - //this.createColorPattern(); this.drawPreampLine(); this.drawEqLine(); // This should paint on top of the preamp line } diff --git a/js/components/EqualizerWindow/index.js b/js/components/EqualizerWindow/index.js index 043de46b..a61578b1 100644 --- a/js/components/EqualizerWindow/index.js +++ b/js/components/EqualizerWindow/index.js @@ -2,6 +2,8 @@ import React from "react"; import PropTypes from "prop-types"; import { connect } from "react-redux"; import classnames from "classnames"; +import Volume from "../Volume"; +import Balance from "../Balance"; import { BANDS, WINDOWS } from "../../constants"; import { @@ -30,16 +32,21 @@ import "../../../css/equalizer-window.css"; const bandClassName = band => `band-${band}`; const EqualizerWindow = props => { - const { doubled, selected, closed } = props; + const { doubled, selected, closed, volume, balance, shade } = props; const className = classnames({ selected, closed, doubled, + shade, window: true, - draggable: true, - shade: props.shade + draggable: true }); + + const v = Math.round(volume); + const eqVolumeClassName = v === 50 ? "center" : v > 50 ? "right" : "left"; + const b = Math.round(balance); + const eqBalanceClassName = b === 0 ? "center" : v > 0 ? "right" : "left"; return (