diff --git a/src/components/Fader.vue b/src/components/Fader.vue index 11e03fe..eccc726 100644 --- a/src/components/Fader.vue +++ b/src/components/Fader.vue @@ -3,7 +3,7 @@
@@ -53,7 +53,8 @@ export default { selectedSource: '', obsUpdateInProgress: false, localUpdateInProgress: false, - localUpdateTimeout: null + localUpdateTimeout: null, + labelBgColor: 'none' } }, created: function () { @@ -141,11 +142,12 @@ export default { } } }, - sourceChanged (newSource) { + sourceChanged () { if (this.selectedSource === '') { return } - this.isMidiLocked = false; + this.isMidiLocked = false + this.labelBgColor = 'none'; (async () => { var data = await (this.obs.send('GetVolume', { source: this.selectedSource, useDecibel: false })) diff --git a/src/components/FaderPanel.vue b/src/components/FaderPanel.vue index eb14a42..78605c6 100644 --- a/src/components/FaderPanel.vue +++ b/src/components/FaderPanel.vue @@ -1,7 +1,10 @@ @@ -41,6 +44,30 @@ export default { } }, methods: { + autoUpdateFaders () { + let anchorSourceIndex = -1 + let anchorNextIndex = -1 + for (let iter = 0; iter < 2; iter++) { + this.$refs.faders.forEach((fader, i) => { + if (fader.value === 0) { + if (anchorNextIndex > -1 && anchorNextIndex < this.sources.length) { + fader.selectedSource = this.sources[anchorNextIndex].name + fader.sourceChanged() + anchorNextIndex++ + } + } else { + // Fader is set to non-zero value, so it's an anchor + anchorSourceIndex = this.sources.findIndex(source => source.name === fader.selectedSource) + if (anchorSourceIndex > -1) { + anchorNextIndex = anchorSourceIndex + 1 + if (i > 0) { + fader.labelBgColor = 'red' + } + } + } + }) + } + }, obsVolumeChanged (data) { this.$refs.faders.forEach(fader => { fader.obsVolumeChanged(data)