mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
fixed fps slider
This commit is contained in:
parent
d3d9ee5361
commit
70ad2760df
19
js/piskel.js
19
js/piskel.js
@ -218,7 +218,7 @@
|
|||||||
|
|
||||||
startAnimation : function () {
|
startAnimation : function () {
|
||||||
var scope = this;
|
var scope = this;
|
||||||
var animFPSTuner = document.getElementById("preview-fps");
|
var animFPSTuner = $("preview-fps");
|
||||||
var animPreviewFPS = parseInt(animFPSTuner.value, 10);
|
var animPreviewFPS = parseInt(animFPSTuner.value, 10);
|
||||||
var startPreviewRefresh = function() {
|
var startPreviewRefresh = function() {
|
||||||
return setInterval(scope.refreshAnimatedPreview, 1000/animPreviewFPS);
|
return setInterval(scope.refreshAnimatedPreview, 1000/animPreviewFPS);
|
||||||
@ -228,24 +228,7 @@
|
|||||||
animFPSTuner.addEventListener('change', 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)) {
|
|
||||||
animPreviewFPS = 1;
|
|
||||||
}
|
|
||||||
if(evt.keyCode == 38) {
|
|
||||||
animPreviewFPS++;
|
|
||||||
}
|
|
||||||
else if (evt.keyCode == 40) {
|
|
||||||
animPreviewFPS--;
|
|
||||||
}
|
|
||||||
if(animPreviewFPS < 1) {
|
|
||||||
animPreviewFPS = 1;
|
|
||||||
}
|
|
||||||
if(animPreviewFPS > 100) {
|
|
||||||
animPreviewFPS = 100;
|
|
||||||
}
|
|
||||||
$("display-fps").innerHTML = animPreviewFPS + " fps";
|
$("display-fps").innerHTML = animPreviewFPS + " fps";
|
||||||
animFPSTuner.value = animPreviewFPS;
|
|
||||||
$("fps-value").innerHTML = animPreviewFPS + " fps";
|
|
||||||
refreshUpdater = startPreviewRefresh();
|
refreshUpdater = startPreviewRefresh();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user