diff --git a/CHANGELOG.md b/CHANGELOG.md index ca781fd5..7d8a5ae7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.49.2 + + - bug fixes + - plots: prevent `plot/*` widgets from sending messages when using the sidepanel's "send all" function + ## 0.49.1 - bug fixes diff --git a/src/client/app/widgets/mixins/static_properties.js b/src/client/app/widgets/mixins/static_properties.js new file mode 100644 index 00000000..fc415dde --- /dev/null +++ b/src/client/app/widgets/mixins/static_properties.js @@ -0,0 +1,16 @@ +let StaticProperties = (superclass, props) => class extends superclass { + + createPropsCache() { + + super.createPropsCache() + + for (var k in props) { + this.cachedProps[k] = props[k] + } + + + } + +} + +module.exports = StaticProperties diff --git a/src/client/app/widgets/plots/_plots_base.js b/src/client/app/widgets/plots/_plots_base.js index 8d0ee10f..85a17fd0 100644 --- a/src/client/app/widgets/plots/_plots_base.js +++ b/src/client/app/widgets/plots/_plots_base.js @@ -1,8 +1,9 @@ var {mapToScale} = require('../utils'), Canvas = require('../common/canvas'), - html = require('nanohtml') + html = require('nanohtml'), + StaticProperties = require('../mixins/static_properties') -module.exports = class _plots_base extends Canvas { +module.exports = class _plots_base extends StaticProperties(Canvas, {bypass: true}) { constructor(options) { diff --git a/src/client/app/widgets/plots/frame.js b/src/client/app/widgets/plots/frame.js index 85700785..fcd6e4b5 100644 --- a/src/client/app/widgets/plots/frame.js +++ b/src/client/app/widgets/plots/frame.js @@ -1,9 +1,10 @@ var Widget = require('../common/widget'), html = require('nanohtml'), {urlParser} = require('../utils'), - locales = require('../../locales') + locales = require('../../locales'), + StaticProperties = require('../mixins/static_properties') -class Frame extends Widget { +class Frame extends StaticProperties(Widget, {bypass: true}) { static description() { diff --git a/src/client/app/widgets/plots/html.js b/src/client/app/widgets/plots/html.js index 487b743b..fa2b18da 100644 --- a/src/client/app/widgets/plots/html.js +++ b/src/client/app/widgets/plots/html.js @@ -1,13 +1,14 @@ var Widget = require('../common/widget'), morph = require('nanomorph'), html = require('nanohtml'), - sanitizeHtml = require('sanitize-html') + sanitizeHtml = require('sanitize-html'), + StaticProperties = require('../mixins/static_properties') var sanitizeOptions = { allowedTags: sanitizeHtml.defaults.allowedTags.concat(['img', 'h1', 'h2']).filter(x=>x!=='iframe') } -class Html extends Widget { +class Html extends StaticProperties(Widget, {bypass: true}) { static description() { diff --git a/src/client/app/widgets/plots/image.js b/src/client/app/widgets/plots/image.js index 5477b15a..57997036 100644 --- a/src/client/app/widgets/plots/image.js +++ b/src/client/app/widgets/plots/image.js @@ -1,9 +1,10 @@ var Widget = require('../common/widget'), ipc = require('../../ipc'), html = require('nanohtml'), - {urlParser} = require('../utils') + {urlParser} = require('../utils'), + StaticProperties = require('../mixins/static_properties') -module.exports = class Image extends Widget { +module.exports = class Image extends StaticProperties(Widget, {bypass: true}) { static description() { diff --git a/src/client/app/widgets/plots/led.js b/src/client/app/widgets/plots/led.js index 6df69b01..ee109c88 100644 --- a/src/client/app/widgets/plots/led.js +++ b/src/client/app/widgets/plots/led.js @@ -1,8 +1,9 @@ var {mapToScale} = require('../utils'), Widget = require('../common/widget'), - html = require('nanohtml') + html = require('nanohtml'), + StaticProperties = require('../mixins/static_properties') -module.exports = class Led extends Widget { +module.exports = class Led extends StaticProperties(Widget, {bypass: true}) { static description() { diff --git a/src/client/app/widgets/plots/meter.js b/src/client/app/widgets/plots/meter.js index 4bf05dd9..91ff0b47 100644 --- a/src/client/app/widgets/plots/meter.js +++ b/src/client/app/widgets/plots/meter.js @@ -1,7 +1,8 @@ var Fader = require('../sliders/fader'), - Widget = require('../common/widget') + Widget = require('../common/widget'), + StaticProperties = require('../mixins/static_properties') -module.exports = class Meter extends Fader { +module.exports = class Meter extends StaticProperties(Fader, {bypass: true, compact: true, input: false}) { static description() { @@ -52,8 +53,6 @@ module.exports = class Meter extends Fader { options.props.value = '@{' + options.props.widgetId + '}' delete options.props.widgetId } - options.props.compact = true - options.props.input = false super(options) @@ -63,8 +62,4 @@ module.exports = class Meter extends Fader { } - sendValue() { - // disabled - } - } diff --git a/src/client/app/widgets/plots/rgbled.js b/src/client/app/widgets/plots/rgbled.js index f7215377..7141965c 100644 --- a/src/client/app/widgets/plots/rgbled.js +++ b/src/client/app/widgets/plots/rgbled.js @@ -1,8 +1,9 @@ var Widget = require('../common/widget'), {clip} = require('../utils'), - html = require('nanohtml') + html = require('nanohtml'), + StaticProperties = require('../mixins/static_properties') -module.exports = class Rbgled extends Widget { +module.exports = class Rbgled extends StaticProperties(Widget, {bypass: true}) { static description() { diff --git a/src/client/app/widgets/plots/svg.js b/src/client/app/widgets/plots/svg.js index 02e80676..5ed6b395 100644 --- a/src/client/app/widgets/plots/svg.js +++ b/src/client/app/widgets/plots/svg.js @@ -1,9 +1,10 @@ var Widget = require('../common/widget'), morph = require('nanomorph'), - html = require('nanohtml') + html = require('nanohtml'), + StaticProperties = require('../mixins/static_properties') -class Svg extends Widget { +class Svg extends StaticProperties(Widget, {bypass: true}) { static description() { diff --git a/src/client/app/widgets/plots/text.js b/src/client/app/widgets/plots/text.js index 533b737f..f6aa4fc0 100644 --- a/src/client/app/widgets/plots/text.js +++ b/src/client/app/widgets/plots/text.js @@ -1,8 +1,9 @@ var {iconify} = require('../../ui/utils'), Widget = require('../common/widget'), - html = require('nanohtml') + html = require('nanohtml'), + StaticProperties = require('../mixins/static_properties') -module.exports = class Text extends Widget { +module.exports = class Text extends StaticProperties(Widget, {bypass: true}) { static description() {