Skip to content

Commit

Permalink
Merge pull request #64 from tsoding/61
Browse files Browse the repository at this point in the history
(#61) Add support for param labels
  • Loading branch information
rexim authored Jun 7, 2021
2 parents a2560d4 + 6439af4 commit 717092c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions js/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,25 @@ const filters = {
"duration": "interval * 2",
// TODO(#62): when you have too many params the UI gets really cluttered
"params": {
// TODO(#65): filter params should have help tooltips associated with them
"interval": {
"label": "Interval",
"type": "float",
"init": 0.85,
"min": 0.01,
"max": 2.00,
"step": 0.01,
},
"ground": {
"label": "Ground",
"type": "float",
"init": 0.5,
"min": -1.0,
"max": 1.0,
"step": 0.01,
},
"scale": {
"label": "Scale",
"type": "float",
"init": 0.40,
"min": 0.0,
Expand All @@ -30,13 +34,15 @@ const filters = {
// TODO(#63): jump_height in the "Hop" filter does not make any sense
// If it's bigger the emote should jump higher. Right now it is the other way around.
"jump_height": {
"label": "Jump Height",
"type": "float",
"init": 4.0,
"min": 1.0,
"max": 10.0,
"step": 0.01,
},
"hops": {
"label": "Hops Count",
"type": "float",
"init": 2.0,
"min": 1.0,
Expand Down
7 changes: 6 additions & 1 deletion js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,13 @@ function loadFilterProgram(gl, filter, vertexAttribs) {
paramsPanel.dispatchEvent(new CustomEvent("paramsChanged"));
};

let label = paramName;
if (filter.params[paramName].label) {
label = filter.params[paramName].label;
}

paramsPanel.appendChild(div(
span(`${paramName}: `), valuePreview,
span(`${label}: `), valuePreview,
div(valueInput),
));
} break;
Expand Down

0 comments on commit 717092c

Please sign in to comment.