Use slider for choosing FPS

This commit is contained in:
juliandescottes 2012-08-29 13:46:57 +02:00
parent ddd6b45f9c
commit 6d2b1944fa
3 changed files with 8 additions and 2 deletions

View File

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

View File

@ -33,7 +33,8 @@
<div class="canvas-background"></div> <div class="canvas-background"></div>
</div> </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> </div>
</div> </div>

View File

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