diff --git a/app/pods/components/hue-controls/template.hbs b/app/pods/components/hue-controls/template.hbs index 29e5d13..9154bda 100644 --- a/app/pods/components/hue-controls/template.hbs +++ b/app/pods/components/hue-controls/template.hbs @@ -33,5 +33,5 @@ {{lights-tab apiURL=apiURL lightsData=lightsData activeLights=activeLights trial=trial active=lightsTabSelected}} - {{music-tab apiURL=apiURL lightsData=lightsData activeLights=activeLights active=musicTabSelected pauseLightUpdates=pauseLightUpdates}} + {{music-tab apiURL=apiURL lightsData=lightsData activeLights=activeLights active=musicTabSelected pauseLightUpdates=pauseLightUpdates dimmerOn=dimmerOn}} {{/if}} \ No newline at end of file diff --git a/app/pods/components/huegasm-app/component.js b/app/pods/components/huegasm-app/component.js index 80efba0..6995ea4 100644 --- a/app/pods/components/huegasm-app/component.js +++ b/app/pods/components/huegasm-app/component.js @@ -1,12 +1,36 @@ import Em from 'ember'; export default Em.Component.extend({ + actions: { + toggleDimmer(){ + this.toggleProperty('dimmerOn'); + } + }, bridgeIp: null, bridgeUsername: null, trial: false, + dimmerOn: false, + dimmerOnClass: function(){ + var dimmerOn = this.get('dimmerOn'), + className = null; + + if(dimmerOn){ + className = 'active'; + Em.$('body').addClass('dimmerOn'); + Em.$('html').addClass('dimmerOn'); + Em.$('md-icon').addClass('dimmerOn'); + } else { + Em.$('body').removeClass('dimmerOn'); + Em.$('html').removeClass('dimmerOn'); + Em.$('md-icon').removeClass('dimmerOn'); + } + + return className; + }.property('dimmerOn'), + init(){ this._super(); diff --git a/app/pods/components/huegasm-app/template.hbs b/app/pods/components/huegasm-app/template.hbs index 7e8ee07..10c5f65 100644 --- a/app/pods/components/huegasm-app/template.hbs +++ b/app/pods/components/huegasm-app/template.hbs @@ -1,9 +1,9 @@ {{#if bridgeUsername}} - {{hue-controls bridgeIp=bridgeIp bridgeUsername=bridgeUsername trial=trial}} + {{hue-controls bridgeIp=bridgeIp bridgeUsername=bridgeUsername trial=trial dimmerOn=dimmerOn}} {{else}} {{bridge-finder bridgeIp=bridgeIp bridgeUsername=bridgeUsername trial=trial}} {{/if}} \ No newline at end of file diff --git a/app/pods/components/music-tab/component.js b/app/pods/components/music-tab/component.js index 50ae7d6..03bda10 100644 --- a/app/pods/components/music-tab/component.js +++ b/app/pods/components/music-tab/component.js @@ -72,9 +72,6 @@ export default Em.Component.extend(musicControlMixin, visualizerMixin, { toggleIsShowingAddSoundCloudModal() { this.toggleProperty('isShowingAddSoundCloudModal'); }, - toggleDimming(){ - this.changePlayerControl('dimmerEnabled', !this.get('dimmerEnabled')); - }, useLocalAudio(){ var audioStream = this.get('audioStream'); this.changePlayerControl('audioMode', 0); @@ -192,8 +189,6 @@ export default Em.Component.extend(musicControlMixin, visualizerMixin, { if(!replayPause){ this.set('timeElapsed', Math.floor(dancer.getTime())); } - - this.set('dimmerOn', false); } else { var timeTotal = this.get('timeTotal'); @@ -209,10 +204,6 @@ export default Em.Component.extend(musicControlMixin, visualizerMixin, { } dancer.play(); - - if(this.get('dimmerEnabled')){ - this.set('dimmerOn', true); - } } this.toggleProperty('playing'); @@ -287,8 +278,7 @@ export default Em.Component.extend(musicControlMixin, visualizerMixin, { var dancer = this.get('dancer'); if(dancer.audio){ - var audioPosition = Math.floor(this.get('timeTotal') * position / 100); - dancer.audio.currentTime = audioPosition; + dancer.audio.currentTime = Math.floor(this.get('timeTotal') * position / 100); } }, volumeMutedChanged(value) { @@ -665,7 +655,7 @@ export default Em.Component.extend(musicControlMixin, visualizerMixin, { this.set('usingMicSupported', false); } - ['volume', 'shuffle', 'repeat', 'volumeMuted', 'threshold', 'interval', 'frequency', 'speakerViewed', 'transitionTime', 'randomTransition', 'playerBottomDisplayed', 'onBeatBriAndColor', 'audioMode', 'dimmerEnabled', 'songBeatPreferences', 'debugFiltered'].forEach(function (item) { + ['volume', 'shuffle', 'repeat', 'volumeMuted', 'threshold', 'interval', 'frequency', 'speakerViewed', 'transitionTime', 'randomTransition', 'playerBottomDisplayed', 'onBeatBriAndColor', 'audioMode', 'songBeatPreferences', 'debugFiltered'].forEach(function (item) { if (!Em.isNone(storage.get('huegasm.' + item))) { var itemVal = storage.get('huegasm.' + item); @@ -696,12 +686,6 @@ export default Em.Component.extend(musicControlMixin, visualizerMixin, { event.preventDefault(); }); - Em.$(document).on('mousedown', function(event){ - if(Em.$('#musicTab').has(event.target).length === 0 && self.get('dimmerEnabled')){ - self.set('dimmerEnabled', false); - } - }); - // control the volume by scrolling up/down Em.$('#playerArea').on('mousewheel', function(event) { if(self.get('playQueueNotEmpty')) { diff --git a/app/pods/components/music-tab/mixins/music-tab.js b/app/pods/components/music-tab/mixins/music-tab.js index 213a28a..ef52434 100644 --- a/app/pods/components/music-tab/mixins/music-tab.js +++ b/app/pods/components/music-tab/mixins/music-tab.js @@ -90,7 +90,6 @@ export default Em.Mixin.create({ visualizationsDisplayed: false, audioStream: null, dimmerOn: false, - dimmerEnabled: false, isShowingAddSoundCloudModal: false, SC_CLIENT_ID: 'aeec0034f58ecd85c2bd1deaecc41594', @@ -225,22 +224,12 @@ export default Em.Mixin.create({ } if(this.get('dimmerOn')){ - classes += ' dimmerFriendly'; + classes += ' dimmerOn'; } return classes; }.property('dragging', 'draggingOverPlayListArea', 'dimmerOn'), - dimmingClass: function(){ - var classes = 'playerControllIcon'; - - if(this.get('dimmerEnabled')){ - classes += ' active'; - } - - return classes; - }.property('dimmerEnabled'), - volumeMutedClass: function(){ var classes = 'playerControllIcon volumeButton'; @@ -281,20 +270,6 @@ export default Em.Mixin.create({ } }.property('volumeMuted', 'volume'), - onDimmerOnChange: function() { - var opacity = 0; - - if(this.get('dimmerOn')) { - opacity = 0.8; - } - - this.$('#dimmer').fadeTo(400, opacity, function() { - if(opacity === 0) { - Em.$(this).hide(); - } - }); - }.observes('dimmerOn'), - onOptionChange: function(self, option){ this.get('storage').set('huegasm.' + option, this.get(option)); }.observes('randomTransition', 'onBeatBriAndColor'), @@ -311,22 +286,6 @@ export default Em.Mixin.create({ this.changeTooltipText(type, tooltipTxt); }.observes('repeat').on('init'), - onDimmerEnabledChange: function () { - var tooltipTxt = 'Dim on play', type = 'dimmerEnabled'; - - if (this.get(type)) { - tooltipTxt = 'Stop dimming'; - } - - if(!this.get(type)){ - this.set('dimmerOn', false); - } else if(this.get('playing')){ - this.set('dimmerOn', true); - } - - this.changeTooltipText(type, tooltipTxt); - }.observes('dimmerEnabled').on('init'), - onShuffleChange: function () { var tooltipTxt = 'Shuffle', type = 'shuffle'; diff --git a/app/pods/components/music-tab/template.hbs b/app/pods/components/music-tab/template.hbs index fe7c52b..e73fee0 100644 --- a/app/pods/components/music-tab/template.hbs +++ b/app/pods/components/music-tab/template.hbs @@ -1,4 +1,4 @@ -