diff -r abb487b56911 -r 677764fba71d svghmi/gen_index_xhtml.xslt
--- a/svghmi/gen_index_xhtml.xslt Tue Dec 29 15:39:48 2020 +0100
+++ b/svghmi/gen_index_xhtml.xslt Tue Dec 29 15:53:30 2020 +0100
@@ -59,26 +59,6 @@
- var hmitree_paths = [
-
-
- /*
-
-
-
- */ "
-
- "
-
- ,
-
-
-
-
- ];
-
-
-
@@ -978,35 +958,50 @@
" in HMI tree
undefined
-
- ,
-
"
"
-
- ,
-
hmi_local_index("
")
-
- ,
-
+
+
+ Internal error while processing widget's non indexed HMI tree path : unknown type
+
+
-
- ,
-
+
+ ,
+
+
+
+
+
+
+
+ [
+
+ ,
+
+ ]
+
+
+ undefined
+
+
+
+ ,
+
"
@@ -1019,6 +1014,8 @@
],[
+ ],[
+
],{
@@ -1178,7 +1175,7 @@
- constructor(elt_id,args,indexes,members){
+ constructor(elt_id,args,indexes,minmaxes,members){
this.element_id = elt_id;
@@ -1188,6 +1185,8 @@
this.indexes = indexes;
+ this.minmaxes = minmaxes;
+
Object.keys(members).forEach(prop => this[prop]=members[prop]);
}
@@ -1276,8 +1275,6 @@
if(typeof(index) == "string"){
- /* XXX return index as path */
-
index = page_local_index(index, this.container_id);
} else {
@@ -1288,8 +1285,6 @@
}
- /* XXX check for hmi_paths and return path */
-
}
return index;
@@ -1298,6 +1293,54 @@
+ overshot(new_val, max) {
+
+ // TODO: use a Toast
+
+ }
+
+
+
+ undershot(new_val, min) {
+
+ // TODO: use a Toast
+
+ }
+
+
+
+ clip_min_max(index, new_val) {
+
+ let minmax = this.minmaxes[index];
+
+ if(minmax !== undefined && typeof new_val == "number") {
+
+ let [min,max] = minmax;
+
+ if(new_val < min){
+
+ this.undershot(new_val, min);
+
+ return min;
+
+ }
+
+ if(new_val > max){
+
+ this.overshot(new_val, max);
+
+ return max;
+
+ }
+
+ }
+
+ return new_val;
+
+ }
+
+
+
change_hmi_value(index, opstr) {
let realindex = this.get_variable_index(index);
@@ -1308,6 +1351,8 @@
let new_val = eval_operation_string(old_val, opstr);
+ new_val = this.clip_min_max(index, new_val);
+
return apply_hmi_value(realindex, new_val);
}
@@ -1320,6 +1365,8 @@
if(realindex == undefined) return undefined;
+ new_val = this.clip_min_max(index, new_val);
+
return apply_hmi_value(realindex, new_val);
}
@@ -4068,6 +4115,30 @@
}
+
+
+ overshot(new_val, max) {
+
+ this.last_display = "max: "+max;
+
+ this.request_animate();
+
+ }
+
+
+
+ undershot(new_val, min) {
+
+ this.last_display = "min: "+min;
+
+ this.request_animate();
+
+ }
+
+
+
+
+
}
@@ -4116,11 +4187,21 @@
- this.value_elt.textContent = String(value);
+ this.last_display = value;
+
+ this.request_animate();
},
+
+ animate: function(){
+
+ this.value_elt.textContent = String(this.last_display);
+
+ },
+
+
init: function() {
@@ -5139,7 +5220,7 @@
}
- if(this.shift != this._shift){
+ if(this.Shift_sub && this.shift != this._shift){
this._shift = this.shift;
@@ -5147,7 +5228,7 @@
}
- if(this.caps != this._caps){
+ if(this.CapsLock_sub && this.caps != this._caps){
this._caps = this.caps;