From 8689ece6da44ed6a1627db728aadd61f99256964 Mon Sep 17 00:00:00 2001 From: sawka Date: Thu, 23 Feb 2023 16:06:44 -0800 Subject: [PATCH] start working on terrible scrollbar display --- src/main.tsx | 26 +++++++++++++++++++++++++- src/sh2.less | 22 +++++++++++++++++++++- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/src/main.tsx b/src/main.tsx index fb8afc6c..4f5e46a2 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -2670,6 +2670,14 @@ class ScreenView extends React.Component<{screen : Screen}, {}> { class ScreenTabs extends React.Component<{session : Session}, {}> { tabsRef : React.RefObject = React.createRef(); lastActiveScreenId : string = null; + scrolling : OV = mobx.observable.box(false, {name: "screentabs-scrolling"}); + + stopScrolling_debounced : () => void; + + constructor(props : any) { + super(props); + this.stopScrolling_debounced = debounce(1500, this.stopScrolling.bind(this)); + } @boundMethod handleNewScreen() { @@ -2714,6 +2722,22 @@ class ScreenTabs extends React.Component<{session : Session}, {}> { this.lastActiveScreenId = activeScreenId; } + stopScrolling() : void { + mobx.action(() => { + this.scrolling.set(false); + })(); + } + + @boundMethod + handleScroll() { + if (!this.scrolling.get()) { + mobx.action(() => { + this.scrolling.set(true); + })(); + } + this.stopScrolling_debounced(); + } + render() { let {session} = this.props; if (session == null) { @@ -2729,7 +2753,7 @@ class ScreenTabs extends React.Component<{session : Session}, {}> { } } return ( -
+
this.handleSwitchScreen(screen.screenId)} onContextMenu={(event) => this.handleContextMenu(event, screen.screenId)}> {screen.name.get()} diff --git a/src/sh2.less b/src/sh2.less index ed6f805d..8b661f6b 100644 --- a/src/sh2.less +++ b/src/sh2.less @@ -40,6 +40,10 @@ html, body, #main { background-color: #000; } +body::-webkit-scrollbar { + display: none; +} + #main { height: 100vh; display: flex; @@ -346,9 +350,25 @@ html, body, #main { flex-direction: row; border-top: 1px solid #666; border-right: 1px solid #eee; - overflow-x: scroll; + overflow-x: overlay; align-items: center; + &::-webkit-scrollbar { + display: none; + z-index: 5; + background-color: #fff; + height: 4px; + width: 0; + } + + &::-webkit-scrollbar-thumb { + background: #777; + } + + &.scrolling::-webkit-scrollbar { + display: block; + } + .screen-tab { height: 30px; min-width: 80px;