widgets: add borderRadius property
This commit is contained in:
parent
f2b1f42d51
commit
5df9c436b2
4 changed files with 7 additions and 9 deletions
|
|
@ -83,6 +83,7 @@ class Widget extends EventEmitter {
|
|||
alphaFillOff: {type: 'number', value: 'auto', help: 'Fill color opacity (off).'},
|
||||
alphaFillOn: {type: 'number', value: 'auto', help: 'Fill color opacity (on).'},
|
||||
lineWidth: {type: 'number', value: 'auto', help: 'Stroke width.'},
|
||||
borderRadius: {type: 'number|string', value: 'auto', help: 'Border radius expressed as a number or a css string. This property may not work for all widgets.'},
|
||||
padding: {type: 'number', value: 'auto', help: 'Inner spacing.'},
|
||||
html: {type: 'string', value: '', editor: 'html', syntaxChecker: false, help: [
|
||||
'Custom html content to be inserted in the widget (before the widget\'s content). Elements are all unstyled by default, `css` should be used to customize their appearance.',
|
||||
|
|
@ -1316,6 +1317,7 @@ Widget.cssVariables = [
|
|||
{js: 'colorText', css: '--color-text'},
|
||||
{js: 'padding', css: '--widget-padding', toCss: x=>parseFloat(x) + 'rem', toJs: x=>parseFloat(x) * PXSCALE},
|
||||
{js: 'lineWidth', css: '--line-width', toCss: x=>parseFloat(x) + 'rem', toJs: x=>parseFloat(x) * PXSCALE},
|
||||
{js: 'borderRadius', css: '--border-radius', toCss: x=>parseFloat(x) == x ? x + 'rem' : x},
|
||||
{js: 'alphaFillOn', css: '--alpha-fill-on', toCss: x=>parseFloat(x), toJs: x=>parseFloat(x)},
|
||||
{js: 'alphaFillOff', css: '--alpha-fill-off', toCss: x=>parseFloat(x), toJs: x=>parseFloat(x)},
|
||||
{js: 'alphaStroke', css: '--alpha-stroke', toCss: x=>parseFloat(x), toJs: x=>parseFloat(x)},
|
||||
|
|
|
|||
|
|
@ -17,10 +17,6 @@ module.exports = class Led extends StaticProperties(Widget, {bypass: true, inter
|
|||
widget: {
|
||||
interaction: null
|
||||
},
|
||||
style: {
|
||||
_separator_led_style: 'Led style',
|
||||
borderRadius: {type: 'string', value: '', help: 'Css border-radius property.'},
|
||||
},
|
||||
class_specific: {
|
||||
mode: {type: 'string', value: 'intensity', choices: ['intensity', 'color'], help: 'Defines how value is interpreted (see `value`)'},
|
||||
range: {type: 'object', value: {min:0, max:1}, help: 'Value range'},
|
||||
|
|
@ -53,10 +49,6 @@ module.exports = class Led extends StaticProperties(Widget, {bypass: true, inter
|
|||
|
||||
this.setValueIntensity(this.getProp('mode') === 'intensity' ? this.getProp('range').min : this.getProp('range').max)
|
||||
|
||||
var bR = this.getProp('borderRadius')
|
||||
if (parseInt(bR) == bR) bR += 'rem'
|
||||
this.container.style.setProperty('--border-radius', bR)
|
||||
|
||||
}
|
||||
|
||||
setValue(v, options={}) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue