Fix tab bar shadows appearing when they shouldn't

This commit is contained in:
j433866 2019-07-24 14:22:56 +01:00
parent 507c951f28
commit 36abaeb6fb
3 changed files with 18 additions and 10 deletions

View file

@ -988,9 +988,13 @@ class InputWaiter {
this.manager.highlighter.removeHighlights(); this.manager.highlighter.removeHighlights();
getSelection().removeAllRanges(); getSelection().removeAllRanges();
const tabsList = document.getElementById("input-tabs").children; const tabsList = document.getElementById("input-tabs");
for (let i = tabsList.length - 1; i >= 0; i--) { const tabsListChildren = tabsList.children;
tabsList.item(i).remove();
tabsList.classList.remove("tabs-left");
tabsList.classList.remove("tabs-right");
for (let i = tabsListChildren.length - 1; i >= 0; i--) {
tabsListChildren.item(i).remove();
} }
this.showLoadingInfo({ this.showLoadingInfo({

View file

@ -217,9 +217,13 @@ class OutputWaiter {
*/ */
removeAllOutputs() { removeAllOutputs() {
this.outputs = {}; this.outputs = {};
const tabs = document.getElementById("output-tabs").children; const tabsList = document.getElementById("output-tabs");
for (let i = tabs.length - 1; i >= 0; i--) { const tabsListChildren = tabsList.children;
tabs.item(i).remove();
tabsList.classList.remove("tabs-left");
tabsList.classList.remove("tabs-right");
for (let i = tabsListChildren.length - 1; i >= 0; i--) {
tabsListChildren.item(i).remove();
} }
} }
@ -935,8 +939,8 @@ class OutputWaiter {
*/ */
refreshTabs(activeTab, direction) { refreshTabs(activeTab, direction) {
const newNums = this.getNearbyNums(activeTab, direction), const newNums = this.getNearbyNums(activeTab, direction),
tabsLeft = (newNums[0] !== this.getSmallestInputNum()), tabsLeft = (newNums[0] !== this.getSmallestInputNum() && newNums.length > 0),
tabsRight = (newNums[newNums.length - 1] !== this.getLargestInputNum()); tabsRight = (newNums[newNums.length - 1] !== this.getLargestInputNum() && newNums.length > 0);
this.manager.tabs.refreshOutputTabs(newNums, activeTab, tabsLeft, tabsRight); this.manager.tabs.refreshOutputTabs(newNums, activeTab, tabsLeft, tabsRight);

View file

@ -493,8 +493,8 @@ self.setInput = function(inputData) {
self.refreshTabs = function(inputNum, direction) { self.refreshTabs = function(inputNum, direction) {
const nums = self.getNearbyNums(inputNum, direction), const nums = self.getNearbyNums(inputNum, direction),
inputNums = Object.keys(self.inputs), inputNums = Object.keys(self.inputs),
tabsLeft = (self.getSmallestInputNum(inputNums) !== nums[0]), tabsLeft = (self.getSmallestInputNum(inputNums) !== nums[0] && nums.length > 0),
tabsRight = (self.getLargestInputNum(inputNums) !== nums[nums.length - 1]); tabsRight = (self.getLargestInputNum(inputNums) !== nums[nums.length - 1] && nums.length > 0);
self.postMessage({ self.postMessage({
action: "refreshTabs", action: "refreshTabs",