From a0efac2328a2c8cb225900b1f83e726d288b9e7e Mon Sep 17 00:00:00 2001 From: martinRenou Date: Fri, 18 Sep 2020 16:26:36 +0200 Subject: [PATCH] Threshold: Add inclusive option Signed-off-by: martinRenou --- ipygany/ipygany.py | 1 + package-lock.json | 6 +++--- package.json | 2 +- src/widget.ts | 11 ++++++++++- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ipygany/ipygany.py b/ipygany/ipygany.py index d2c6168..45dba81 100644 --- a/ipygany/ipygany.py +++ b/ipygany/ipygany.py @@ -458,6 +458,7 @@ class Threshold(Effect): min = CFloat(0.).tag(sync=True) max = CFloat(0.).tag(sync=True) dynamic = Bool(False).tag(sync=True) + inclusive = Bool(True).tag(sync=True) @default('input') def _default_input(self): diff --git a/package-lock.json b/package-lock.json index 8f24354..fa27424 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2745,9 +2745,9 @@ "dev": true }, "ganyjs": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/ganyjs/-/ganyjs-0.6.1.tgz", - "integrity": "sha512-xT2UBDFKe+R81b317FrInGMnR0F6iEwRmM26InMBbcLUFF8NCL1xcDyeEVjgWoBAimG+uHlyTm+rOJiiv2kEAg==", + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/ganyjs/-/ganyjs-0.6.2.tgz", + "integrity": "sha512-nuhlZV4vHBKmYeISq4bcAu5COclDml0RpZ9w2PQe/Snpl7hTZMYbMYhKWQb4mZ+YqZUzZ2QNLGqIi8V/ow1I/w==", "requires": { "backbone": "^1.4.0", "binary-search-tree": "^0.2.6", diff --git a/package.json b/package.json index a8e451a..3813d73 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "@jupyter-widgets/controls": "^2.0.0", "backbone": "^1.4.0", "binary-search-tree": "^0.2.6", - "ganyjs": "^0.6.1", + "ganyjs": "^0.6.2", "three": "^0.118.0", "uuid": "^3.3.3" }, diff --git a/src/widget.ts b/src/widget.ts index 303fb7f..566cd44 100644 --- a/src/widget.ts +++ b/src/widget.ts @@ -553,6 +553,7 @@ class ThresholdModel extends EffectModel { min: 0., max: 0., dynamic: false, + inclusive: true, }; } @@ -568,6 +569,10 @@ class ThresholdModel extends EffectModel { return this.get('dynamic'); } + get inclusive (): boolean { + return this.get('inclusive'); + } + get input () { const input = this.get('input'); @@ -575,7 +580,10 @@ class ThresholdModel extends EffectModel { } createBlock () { - return new Threshold(this.parent.block, this.input, {min: this.min, max: this.max, dynamic: this.dynamic}); + return new Threshold(this.parent.block, this.input, { + min: this.min, max: this.max, + dynamic: this.dynamic, inclusive: this.inclusive + }); } initEventListeners () : void { @@ -583,6 +591,7 @@ class ThresholdModel extends EffectModel { this.on('change:min', () => { this.block.min = this.min }); this.on('change:max', () => { this.block.max = this.max }); + this.on('change:inclusive', () => { this.block.inclusive = this.inclusive }); } block: Threshold;