From cd5e36af284b80e7781c67a0db0dff8dbba0a39c Mon Sep 17 00:00:00 2001 From: Keavon Chambers Date: Thu, 1 Jul 2021 22:08:23 -0700 Subject: [PATCH] Add styled scrollbars (#231) --- client/web/src/App.vue | 72 ++++++++++++++++++- .../web/src/components/panels/LayerTree.vue | 4 +- .../widgets/floating-menus/FloatingMenu.vue | 3 +- .../widgets/floating-menus/MenuList.vue | 28 ++++---- .../widgets/inputs/DropdownInput.vue | 11 ++- .../widgets/inputs/MenuBarInput.vue | 10 +-- 6 files changed, 95 insertions(+), 33 deletions(-) diff --git a/client/web/src/App.vue b/client/web/src/App.vue index 179bc74a..4cdf5f65 100644 --- a/client/web/src/App.vue +++ b/client/web/src/App.vue @@ -41,7 +41,7 @@ // TODO: Replace with CSS color() function to calculate alpha when browsers support it // See https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/color() and https://caniuse.com/css-color-function // E6 = 90% alpha - --floating-menu-opacity-color-2-mildblack: #222222e6; + --floating-menu-opacity-color-2-mildblack: #222222f2; --floating-menu-shadow: rgba(0, 0, 0, 50%); } @@ -69,6 +69,72 @@ img { display: block; } +.scrollable, +.scrollable-x, +.scrollable-y { + // Standard + scrollbar-width: thin; + scrollbar-width: 6px; + scrollbar-gutter: 6px; + scrollbar-color: var(--color-5-dullgray) transparent; + + &:not(:hover) { + scrollbar-width: none; + } + + // WebKit + &::-webkit-scrollbar { + width: calc(2px + 6px + 2px); + } + + &:not(:hover)::-webkit-scrollbar { + width: 0; + } + + &::-webkit-scrollbar-track { + box-shadow: inset 0 0 0 1px var(--color-5-dullgray); + border: 2px solid transparent; + border-radius: 10px; + + &:hover { + box-shadow: inset 0 0 0 1px var(--color-6-lowergray); + } + } + + &::-webkit-scrollbar-thumb { + background-clip: padding-box; + background-color: var(--color-5-dullgray); + border: 2px solid transparent; + border-radius: 10px; + margin: 2px; + + &:hover { + background-color: var(--color-6-lowergray); + } + } +} + +.scrollable { + // Standard + overflow: auto; + // WebKit + overflow: overlay; +} + +.scrollable-x { + // Standard + overflow-x: auto; + // WebKit + overflow-x: overlay; +} + +.scrollable-y { + // Standard + overflow-y: auto; + // WebKit + overflow-y: overlay; +} + // For placeholder messages (remove eventually) .floating-menu { h1, @@ -117,12 +183,12 @@ img { border-radius: 2px; &:hover { - background-color: var(--color-6-lowergray); + background: var(--color-6-lowergray); color: var(--color-f-white); } &:active { - background-color: var(--color-accent-hover); + background: var(--color-accent-hover); color: var(--color-f-white); } } diff --git a/client/web/src/components/panels/LayerTree.vue b/client/web/src/components/panels/LayerTree.vue index d9164784..50521346 100644 --- a/client/web/src/components/panels/LayerTree.vue +++ b/client/web/src/components/panels/LayerTree.vue @@ -14,7 +14,7 @@

More blend and compositing options will be here

- +
@@ -62,8 +62,6 @@ } .layer-tree { - overflow: auto; - .layer-row { display: flex; height: 36px; diff --git a/client/web/src/components/widgets/floating-menus/FloatingMenu.vue b/client/web/src/components/widgets/floating-menus/FloatingMenu.vue index d717a187..b6d1e5e0 100644 --- a/client/web/src/components/widgets/floating-menus/FloatingMenu.vue +++ b/client/web/src/components/widgets/floating-menus/FloatingMenu.vue @@ -2,7 +2,7 @@
-
+
@@ -193,6 +193,7 @@ export default defineComponent({ type: { type: String, required: true }, windowEdgeMargin: { type: Number, default: 8 }, minWidth: { type: Number, default: 0 }, + scrollable: { type: Boolean, default: false }, }, data() { return { diff --git a/client/web/src/components/widgets/floating-menus/MenuList.vue b/client/web/src/components/widgets/floating-menus/MenuList.vue index 7c93ace1..c3e6c86c 100644 --- a/client/web/src/components/widgets/floating-menus/MenuList.vue +++ b/client/web/src/components/widgets/floating-menus/MenuList.vue @@ -1,5 +1,5 @@