Merge pull request #123 from VE-FORBRYDERNE/settings

Prevent the settings throttle from lagging the sliders
This commit is contained in:
henk717 2022-04-27 03:17:53 +02:00 committed by GitHub
commit 716951f059
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View File

@ -118,7 +118,7 @@ var adventure = false;
// Chatmode // Chatmode
var chatmode = false; var chatmode = false;
var sliders_throttle = getThrottle(40); var sliders_throttle = getThrottle(200);
//=================================================================// //=================================================================//
// METHODS // METHODS
@ -174,12 +174,10 @@ function addSetting(ob) {
window["label_"+ob.id] = reflb; // Is this still needed? window["label_"+ob.id] = reflb; // Is this still needed?
// Add event function to input // Add event function to input
var send = function () { var send = function () {
var that = refin;
sliders_throttle(ob.id, function () { sliders_throttle(ob.id, function () {
socket.send({'cmd': $(that).attr('id'), 'data': $(that).val()}); socket.send({'cmd': $(refin).attr('id'), 'data': $(refin).val()});
refin.val(parseFloat($(that).val()));
reflb.html($(that).val());
}); });
reflb.val($(refin).val());
} }
refin.on("input", send); refin.on("input", send);
reflb.on("change", function (event) { reflb.on("change", function (event) {

View File

@ -17,7 +17,7 @@
<script src="static/bootstrap.min.js"></script> <script src="static/bootstrap.min.js"></script>
<script src="static/bootstrap-toggle.min.js"></script> <script src="static/bootstrap-toggle.min.js"></script>
<script src="static/rangy-core.min.js"></script> <script src="static/rangy-core.min.js"></script>
<script src="static/application.js?ver=1.17d"></script> <script src="static/application.js?ver=1.17e"></script>
</head> </head>
<body> <body>
<input type="file" id="remote-save-select" accept="application/json" style="display:none"> <input type="file" id="remote-save-select" accept="application/json" style="display:none">