SVGHMI: re-arrange Animate and data Dispath code paths.
--- a/svghmi/svghmi.js Fri Sep 09 10:34:23 2022 +0200
+++ b/svghmi/svghmi.js Mon Sep 12 11:56:52 2022 +0200
@@ -92,7 +92,6 @@
if(jumps_need_update) update_jumps();
- apply_updates();
pending_widget_animates.forEach(widget => widget._animate());
pending_widget_animates = [];
@@ -139,8 +138,9 @@
throw new Error("Unknown index "+index);
}
};
+
+ apply_updates();
// register for rendering on next frame, since there are updates
- requestHMIAnimation();
} catch(err) {
// 1003 is for "Unsupported Data"
// ws.close(1003, err.message);
@@ -348,14 +348,13 @@
function send_hmi_value(index, value) {
if(index > last_remote_index){
- updates.set(index, value);
+ dispatch_value(index, value);
if(persistent_indexes.has(index)){
let varname = persistent_indexes.get(index);
document.cookie = varname+"="+value+"; max-age=3153600000";
}
- requestHMIAnimation();
return;
}