button: add wrap and vertical properties
This commit is contained in:
parent
7ec2f2744c
commit
5b2ddc7215
4 changed files with 28 additions and 1 deletions
|
|
@ -24,6 +24,10 @@ class Button extends Widget {
|
|||
'- Insert icons using the prefix ^ followed by the icon\'s name : `^play`, `^pause`, etc (see https://fontawesome.com/icons?d=gallery&s=solid&m=free)',
|
||||
'- Icons can be transformed with the following suffixes: `.flip-[horizontal|vertical|both]`, `.rotate-[90|180|270]`, `.spin`, `.pulse`. Example: `^play.flip-horizontal`',
|
||||
]},
|
||||
vertical: {type: 'boolean', value: false, help: 'Set to `true` to display the text vertically'},
|
||||
wrap: {type: 'boolean', value: false, help: [
|
||||
'Set to `true` to wrap long lines automatically.',
|
||||
]},
|
||||
on: {type: '*', value: 1, help: [
|
||||
'Set to `null` to send send no argument in the osc message',
|
||||
]},
|
||||
|
|
@ -128,9 +132,14 @@ class Button extends Widget {
|
|||
}
|
||||
|
||||
|
||||
|
||||
this.value = this.getProp('off')
|
||||
|
||||
this.label = html`<label></label>`
|
||||
|
||||
if (this.getProp('wrap')) this.label.classList.add('wrap')
|
||||
if (this.getProp('vertical')) this.label.classList.add('vertical')
|
||||
|
||||
this.updateLabel()
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ module.exports = class Text extends StaticProperties(Widget, {bypass: true, inte
|
|||
vertical: {type: 'boolean', value: false, help: 'Set to `true` to display the text vertically'},
|
||||
wrap: {type: 'boolean', value: false, help: [
|
||||
'Set to `true` to wrap long lines automatically.',
|
||||
'This will not break overflowing words by default, word-breaking can be enabled by adding `word-break: break-all;` to the `css` property',
|
||||
]},
|
||||
align: {type: 'string', value: 'center', choices: ['center', 'left', 'right'], help: 'Css text-align property.'},
|
||||
|
||||
|
|
|
|||
|
|
@ -50,6 +50,21 @@
|
|||
height: 100%;
|
||||
width: 100%;
|
||||
border: 2rem solid transparent;
|
||||
|
||||
&.wrap {
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
&.vertical {
|
||||
transform: rotate(180deg);
|
||||
text-overflow: ellipsis;
|
||||
-webkit-writing-mode:vertical-rl;
|
||||
writing-mode:vertical-rl;
|
||||
i {
|
||||
transform: rotate(180deg);
|
||||
writing-mode: initial;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.on {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue