Skip to content

Commit

Permalink
Revert Beholder FPS slider to allow setting to 0 (#1079)
Browse files Browse the repository at this point in the history
This restores the 0 value minimum setting of the FPS slider, which is a documented Beholder feature that allows "pausing" the video generation. It also adds logic to the tf-beholder-video and tf-beholder-info elements so that they don't send any XHRs when the FPS value is set to 0.
  • Loading branch information
nfelt committed Mar 27, 2018
1 parent b22d92e commit 6b9c600
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
value="{{_FPS}}"
type="number"
step="1"
min="1"
min="0"
max="30"
pin="true"
disabled="[[_controls_disabled]]">
Expand Down Expand Up @@ -213,7 +213,7 @@ <h3>No Beholder data was found.</h3>
</template>

<template is="dom-if" if="[[_is_active]]">
<tf-beholder-video id="video"></tf-beholder-video>
<tf-beholder-video id="video" fps="[[_FPS]]"></tf-beholder-video>

<template is="dom-if" if="[[_valuesNotFrame(_values)]]">
<tf-beholder-info
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
fps: { // Not actually FPS!
type: Number,
value: 10,
observer: '_fpsChanged',
},

xhrTimeout: {
Expand Down Expand Up @@ -124,6 +125,13 @@
}
},

_fpsChanged(newValue, oldValue) {
if (newValue == 0) {
this._clear();
} else if (oldValue == 0) {
this._load();
}
},
});
})();
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@
Polymer({
is: "tf-beholder-video",
properties: {
// Only used for determining ping frequency.
fps: {
type: Number,
value: 10,
observer: '_fpsChanged',
},

pingSleep: {
type: Number,
value: 1000,
Expand Down Expand Up @@ -90,7 +97,7 @@
const response = JSON.parse(this._xhr.responseText);
this._onPing(response['status'] == 'alive', this.pingSleep);
return;
}
}
this._onPing(false, this.pingSleep);
},

Expand All @@ -115,6 +122,13 @@
}
},

_fpsChanged(newValue, oldValue) {
if (newValue == 0) {
this._clear();
} else if (oldValue == 0) {
this._ping();
}
},
});

})();
Expand Down

0 comments on commit 6b9c600

Please sign in to comment.