From 0f8f55165e3045a0418dea85fce5e9f4d6067dd7 Mon Sep 17 00:00:00 2001 From: bordun Date: Sun, 19 Apr 2020 10:44:01 +0200 Subject: [PATCH] icons: add support for transform suffixes --- CHANGELOG.md | 1 + src/client/ui/utils.js | 3 ++- src/client/widgets/common/widget.js | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a0e7f86..9e23681d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -126,3 +126,4 @@ - more detached DOM for lighter nested canvas widgets (ie multixy) - unified (kind of) dom html structure for widgets, known css tricks will require adjustments. - cache and config files are now stored in a folder named `open-stage-control` (located in the system's default location for config file). The `.open-stage-control` is no longer used. + - added support for icons rotate/flip transform suffixes (example: `^cog.spin`, `^play.rotate-horizontal`) diff --git a/src/client/ui/utils.js b/src/client/ui/utils.js index 65fdecca..c7fd584f 100644 --- a/src/client/ui/utils.js +++ b/src/client/ui/utils.js @@ -3,7 +3,8 @@ module.exports = { icon: function(i) { - return `` + var iclass = i.split('.').join(' fa-') + return `` }, iconify:function(string){ return String(string).replace(/\^[^\s]{2,}/g,(x)=>{return module.exports.icon(x.substring(1))}) diff --git a/src/client/widgets/common/widget.js b/src/client/widgets/common/widget.js index 06bb2e28..c7951a0d 100644 --- a/src/client/widgets/common/widget.js +++ b/src/client/widgets/common/widget.js @@ -54,7 +54,8 @@ class Widget extends EventEmitter { id: {type: 'string', value: 'auto', help: 'Widgets sharing the same `id` will act as clones and update each other\'s value(s) without sending extra osc messages.' }, label: {type: 'string|boolean', value: 'auto', help: [ 'Set to `false` to hide completely', - '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)' + '- 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`', ]}, visible: {type: 'boolean', value: true, help: 'Set to `false` to hide the widget.'}, interaction: {type: 'boolean', value: true, help: 'Set to `false` to disable pointer interactions.'},