From e4e536b5b1b24ca9c27eb8519698257c3eee6cfc Mon Sep 17 00:00:00 2001 From: bordun Date: Thu, 19 Mar 2020 18:15:20 +0100 Subject: [PATCH] root: missing scroll property scrollbar: error when transparent --- src/client/ui/scrollbar-color.js | 12 ++++++++++-- src/client/widgets/containers/root.js | 3 ++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/client/ui/scrollbar-color.js b/src/client/ui/scrollbar-color.js index 1ffa0da2..6606903e 100644 --- a/src/client/ui/scrollbar-color.js +++ b/src/client/ui/scrollbar-color.js @@ -5,9 +5,17 @@ module.exports = (container)=>{ setTimeout(()=>{ var computedStyle = window.getComputedStyle(container), - color = computedStyle.getPropertyValue('--color-fill').trim(), alpha = parseFloat(computedStyle.getPropertyValue('--alpha-scrollbar')), - alphaOn = parseFloat(computedStyle.getPropertyValue('--alpha-scrollbar-on')) + alphaOn = parseFloat(computedStyle.getPropertyValue('--alpha-scrollbar-on')), + color = computedStyle.getPropertyValue('--color-fill').trim() + + if (color === 'transparent') { + // prevent chroma-js error + // irrelevant case, but still... + color = 'rgb(0, 0, 0)' + alpha = 0 + alphaOn = 0 + } if (color) { container.style.setProperty('--color-scrollbar', chroma(color).alpha(alpha).css()) diff --git a/src/client/widgets/containers/root.js b/src/client/widgets/containers/root.js index b9a158dd..a576d80f 100644 --- a/src/client/widgets/containers/root.js +++ b/src/client/widgets/containers/root.js @@ -5,7 +5,7 @@ var Panel = require('./panel'), html = require('nanohtml'), raw = require('nanohtml/raw') -class Root extends StaticProperties(Panel, {scroll: false, visible: true, label: false, id: 'root'}) { +class Root extends StaticProperties(Panel, {visible: true, label: false, id: 'root'}) { static description() { @@ -26,6 +26,7 @@ class Root extends StaticProperties(Panel, {scroll: false, visible: true, label: gridTemplate: {type: 'string|number', value: '', help:'If `layout` is `grid`, can be either a number of columns of a value css grid-template definition.'}, verticalTabs: {type: 'boolean', value: false, help: 'Set to `true` to display for vertical tab layout'}, traversing: {type: 'boolean', value: false, help: 'Set to `true` to enable traversing gestures in this widget. Set to `smart` or `auto` to limit affected widgets by the type of the first touched widget'}, + scroll: {type: 'boolean', value: true, help: 'Set to `false` to disable scrollbars'}, variables: {type: '*', value: '', help: 'Defines one or more arbitrary variables that can be inherited by children widgets'}, }, [