Improve speed of changing input tabs.

Handle not finding an active tab
This commit is contained in:
j433866 2019-06-06 16:53:58 +01:00
parent c2087f6d5f
commit 97f86af6b9
2 changed files with 4 additions and 3 deletions

View File

@ -947,7 +947,8 @@ class InputWaiter {
* @param {boolean} [changeOutput=false] - If true, also changes the output
*/
changeTab(inputNum, changeOutput) {
if (this.manager.tabs.changeInputTab(inputNum)) {
if (this.manager.tabs.getInputTabItem(inputNum) !== null) {
this.manager.tabs.changeInputTab(inputNum);
this.inputWorker.postMessage({
action: "setInput",
data: {
@ -1245,6 +1246,7 @@ class InputWaiter {
*/
changeTabRight() {
const activeTab = this.manager.tabs.getActiveInputTab();
if (activeTab === -1) return;
this.inputWorker.postMessage({
action: "changeTabRight",
data: {
@ -1258,6 +1260,7 @@ class InputWaiter {
*/
changeTabLeft() {
const activeTab = this.manager.tabs.getActiveInputTab();
if (activeTab === -1) return;
this.inputWorker.postMessage({
action: "changeTabLeft",
data: {

View File

@ -288,8 +288,6 @@ class TabWaiter {
} else {
this.hideTabBar();
}
this.changeTab(activeTab, io);
}
/**