Skip to content

Commit

Permalink
Merge pull request #52 from martinRenou/threshold_inclusive_option
Browse files Browse the repository at this point in the history
Threshold: Add inclusive option
  • Loading branch information
martinRenou committed Sep 18, 2020
2 parents 5384e78 + a0efac2 commit 89adf13
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions ipygany/ipygany.py
Expand Up @@ -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):
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -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"
},
Expand Down
11 changes: 10 additions & 1 deletion src/widget.ts
Expand Up @@ -553,6 +553,7 @@ class ThresholdModel extends EffectModel {
min: 0.,
max: 0.,
dynamic: false,
inclusive: true,
};
}

Expand All @@ -568,21 +569,29 @@ class ThresholdModel extends EffectModel {
return this.get('dynamic');
}

get inclusive (): boolean {
return this.get('inclusive');
}

get input () {
const input = this.get('input');

return typeof input == 'string' ? input : [input];
}

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 {
super.initEventListeners();

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;
Expand Down

0 comments on commit 89adf13

Please sign in to comment.