button: add wrap and vertical properties

This commit is contained in:
bordun 2020-09-12 17:39:20 +02:00
parent 7014d1abda
commit 4e8c6f9a17
4 changed files with 28 additions and 1 deletions

View file

@ -4,9 +4,13 @@
- scripting
- expose toolbar menu actions
- remote control
- optimise small changes made with /EDIT
- widgets
- button: add `wrap` and `vertical` properties
## 1.2.0
- bug fixes

View file

@ -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()
}

View file

@ -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.'},

View file

@ -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 {