Skip to content

Commit

Permalink
(#27) Hide filter params under the feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
rexim committed May 31, 2021
1 parent 6306a32 commit f924208
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions js/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
let feature_params = false;

const vertexAttribs = {
"meshPosition": 0
};
Expand Down Expand Up @@ -1160,7 +1162,9 @@ function FilterSelector() {

program = loadFilterProgram(gl, filterList_.selectedFilter$(), vertexAttribs);
program.paramsPanel.addEventListener('paramsChanged', syncParams);
root.appendChild(program.paramsPanel);
if (feature_params) {
root.appendChild(program.paramsPanel);
}
syncParams();

root.updateImage$ = function(newEmoteImage) {
Expand All @@ -1175,12 +1179,16 @@ function FilterSelector() {
if (program) {
gl.deleteProgram(program.id);
program.paramsPanel.removeEventListener('paramsChanged', syncParams);
root.removeChild(program.paramsPanel);
if (feature_params) {
root.removeChild(program.paramsPanel);
}
}

program = loadFilterProgram(gl, e.detail.filter, vertexAttribs);
program.paramsPanel.addEventListener('paramsChanged', syncParams);
root.appendChild(program.paramsPanel);
if (feature_params) {
root.appendChild(program.paramsPanel);
}
syncParams();
});

Expand Down Expand Up @@ -1293,6 +1301,8 @@ function FilterSelector() {
}

window.onload = () => {
feature_params = new URLSearchParams(document.location.search).has("feature-params");

const imageSelector = ImageSelector();
const filterSelector = FilterSelector();
imageSelector.addEventListener('imageSelected', function(e) {
Expand Down

0 comments on commit f924208

Please sign in to comment.