Merge pull request #6 from juliandescottes/add-sliderforfps

Use slider for choosing FPS
This commit is contained in:
Julian Descottes 2012-08-29 08:43:41 -07:00
commit 184f6bf825
3 changed files with 8 additions and 2 deletions

View File

@ -134,6 +134,10 @@ ul, li {
margin : 5px;
}
#preview-fps {
width : 200px;
}
/* Force apparition of scrollbars on leopard */
::-webkit-scrollbar {
-webkit-appearance: none;

View File

@ -33,7 +33,8 @@
<div class="canvas-background"></div>
</div>
<div>
<label>Preview FPS:</label><input id="preview-fps" type="text" value="12" />
<input id="preview-fps" type="range" min="1" max="24" value="12" style="width:200px;"/>
<span id="display-fps">12 fps</span>
</div>
</div>
</div>

View File

@ -149,7 +149,7 @@
};
var refreshUpdater = startPreviewRefresh();
animFPSTuner.addEventListener('keyup', function(evt) {
animFPSTuner.addEventListener('change', function(evt) {
window.clearInterval(refreshUpdater);
animPreviewFPS = parseInt(animFPSTuner.value, 10);
if(isNaN(animPreviewFPS)) {
@ -167,6 +167,7 @@
if(animPreviewFPS > 100) {
animPreviewFPS = 100;
}
$("display-fps").innerHTML = animPreviewFPS + " fps";
animFPSTuner.value = animPreviewFPS;
refreshUpdater = startPreviewRefresh();
});