From 80193568d3a3b11b5f3a66ded1854773238d89f7 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 25 Oct 2016 18:47:38 +0200 Subject: [PATCH] multiXy: added `pointSize` option; made default size bigger; points don't overflow the pad anymore --- CHANGELOG.md | 6 +++++- .../docs/user-guide/widgets-specifics/pads.md | 11 +++++++++- src/browser/js/app/widgets/pads/multixy.js | 17 +++++++++++----- src/browser/scss/widgets/_pads.scss | 20 ++++++++++++------- 4 files changed, 40 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54fc56a3..6ae112a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,11 @@ # Changelog -## 0.9.0 +## next +- widgets + - multiXy: added `pointSize` option; made default size bigger; points don't overflow the pad anymore + +## 0.9.0 - widgets - **new** `multixy` pad diff --git a/resources/docs/user-guide/widgets-specifics/pads.md b/resources/docs/user-guide/widgets-specifics/pads.md index 9c4930e7..cde99b5c 100644 --- a/resources/docs/user-guide/widgets-specifics/pads.md +++ b/resources/docs/user-guide/widgets-specifics/pads.md @@ -48,7 +48,7 @@ Pads are multidimensional widgets that output multiple values. - usage: - set to `true` to send separate osc messages for `x` and `y` axis. The `path` will be the same as the widget's with `/x` or `/y` appended to it - can be set as an object to specify a different `path` : `{x:'/osc_path_x', y:'/osc_path_y'}` -- note: the widget will only respond to its original osc path, not to the splitted version +- note: the widget will only respond to its original osc path, not to the splitted version ---- @@ -61,6 +61,15 @@ Pads are multidimensional widgets that output multiple values. } ``` +#### `points` +- type: `integer` +- default: `2` +- usage: defines the number of points on the pad + +#### `pointSize` +- type: `integer` +- default: `15` +- usage: defines the points's size #### `rangeX` - type: `object` diff --git a/src/browser/js/app/widgets/pads/multixy.js b/src/browser/js/app/widgets/pads/multixy.js index 8834e692..9ab0d362 100644 --- a/src/browser/js/app/widgets/pads/multixy.js +++ b/src/browser/js/app/widgets/pads/multixy.js @@ -10,6 +10,7 @@ module.exports.options = { separator1:'multi xy', points: 2, + pointSize: 15, separator2:'style', @@ -38,6 +39,9 @@ var MultiXy = module.exports.MultiXy = function(widgetData) { _pads_base.apply(this,arguments) + this.pointSize = parseInt(this.widgetData.pointSize) + this.widget[0].style.setProperty("--point-size",this.pointSize + 'rem') + this.split = this.widgetData.split? typeof this.widgetData.split == 'object'? this.widgetData.split @@ -105,6 +109,9 @@ var MultiXy = module.exports.MultiXy = function(widgetData) { } this.setValue(v) + this.draw() + this.updateHandlesPosition() + } @@ -121,8 +128,8 @@ MultiXy.prototype.resizeHandle = function(){ MultiXy.prototype.updateHandlesPosition = function(){ for (var i=0;i .pad { + --point-size:10rem; > .wrapper { + padding: calc(var(--point-size) + 1rem); + > canvas { + top:0; + left:0; + } > .pad { position: absolute; - width:100%; - height:100%; + width:calc(100% - calc(var(--point-size) * 2 + 2rem)); + height:calc(100% - calc(var(--point-size) * 2 + 2rem)); pointer-events: none; .wrapper { background: transparent; @@ -116,12 +122,12 @@ position: absolute; left:0; bottom:0; - width:24rem; - height: 24rem; - margin:0 0 -12rem -12rem; + width:calc(var(--point-size) * 2 + 4rem); + height: calc(var(--point-size) * 2 + 4rem); + margin:0 0 calc(-1 * var(--point-size) - 2rem) calc(-1 * var(--point-size) - 2rem); text-align: center; - line-height: 24rem; - border-radius: 24rem; + line-height: calc(var(--point-size) * 2 + 4rem); + border-radius: calc(var(--point-size) * 2 + 4rem); cursor: -webkit-grab; opacity: 0; }