diff -r da51baea69cb -r 92101729f7b7 svghmi/gen_index_xhtml.xslt --- a/svghmi/gen_index_xhtml.xslt Tue Aug 25 14:34:49 2020 +0200 +++ b/svghmi/gen_index_xhtml.xslt Wed Aug 26 11:26:45 2020 +0200 @@ -1496,61 +1496,85 @@ - on_mouse_down(evt) { - - if (this.active_style && this.inactive_style) { - - this.active_elt.setAttribute("style", this.active_style); - - this.inactive_elt.setAttribute("style", "display:none"); - - } - - this.apply_hmi_value(0, 1); - - } - - - - on_mouse_up(evt) { - - if (this.active_style && this.inactive_style) { - - this.active_elt.setAttribute("style", "display:none"); - - this.inactive_elt.setAttribute("style", this.inactive_style); - - } - - this.apply_hmi_value(0, 0); - - } - - - - init() { - - this.active_style = this.active_elt ? this.active_elt.style.cssText : undefined; - - this.inactive_style = this.inactive_elt ? this.inactive_elt.style.cssText : undefined; - - + // TODO decouple update of DOM from event (i.e use animate()) + + + + + + // TODO State of the button should distinguish UI feedbak from current PLC value + + + + on_mouse_down(evt) { if (this.active_style && this.inactive_style) { + console.log("pressedi...") + + this.active_elt.setAttribute("style", this.active_style); + + this.inactive_elt.setAttribute("style", "display:none"); + + } + + this.apply_hmi_value(0, 1); + + console.log("pressed") + + // TODO inhibit all mouse/touch events except mouse up (in other word grab cursor) + + } + + + + on_mouse_up(evt) { + + if (this.active_style && this.inactive_style) { + + console.log("unpressedi...") + this.active_elt.setAttribute("style", "display:none"); this.inactive_elt.setAttribute("style", this.inactive_style); } - - - this.element.setAttribute("onmousedown", "hmi_widgets["+this.element_id+"].on_mouse_down(evt)"); - - this.element.setAttribute("onmouseup", "hmi_widgets["+this.element_id+"].on_mouse_up(evt)"); - - } + this.apply_hmi_value(0, 0); + + console.log("unpressed") + + // TODO release inhibited events + + } + + + + init() { + + // TODO : move to widget_defs so that we can have generated string literals directly + + this.active_style = this.active_elt ? this.active_elt.style.cssText : undefined; + + this.inactive_style = this.inactive_elt ? this.inactive_elt.style.cssText : undefined; + + + + if (this.active_style && this.inactive_style) { + + this.active_elt.setAttribute("style", "display:none"); + + this.inactive_elt.setAttribute("style", this.inactive_style); + + } + + + + this.element.setAttribute("onmousedown", "hmi_widgets[\""+this.element_id+"\"].on_mouse_down(evt)"); + + this.element.setAttribute("onmouseup", "hmi_widgets[\""+this.element_id+"\"].on_mouse_up(evt)"); + + } } @@ -1986,8 +2010,6 @@ this.fields[index] = value; - console.log(value, index); - this.element.textContent = this.args.length == 1 ? vsprintf(this.args[0],this.fields) : this.fields.join(' '); } @@ -2825,8 +2847,6 @@ } - console.log(this.menu_offset); - this.set_partial_text(); }, @@ -3359,7 +3379,9 @@ args: this.args, - vars: this.cache + vars: this.cache, + + visible: this.visible }; @@ -3389,8 +3411,6 @@ dispatch(value, oldval, index) { - console.log("mhooo", index); - this.cache[index] = value; this.do_http_request(); @@ -3586,11 +3606,69 @@ + + + obj_ + + _ + + try { + + + let + + + = + + ; + + if( + + + == undefined) { + + console.log(" + + + = + + "); + + throw null; + + } + + + + + + + + + + + + + + id(" + + ").setAttribute("style", " + + "); + - + + } catch(err) { + + id(" + + ").setAttribute("style", "display:none"); + + } + @@ -3608,7 +3686,15 @@ - spread_json_data: function(jdata) { + visible: + + , + + spread_json_data: function(janswer) { + + let [range,position,jdata] = janswer; + + console.log(range,position,jdata); @@ -5453,8 +5539,6 @@ if(index > last_remote_index){ - console.log("updated local variable ",index,value); - updates[index] = value; requestHMIAnimation(); @@ -5805,8 +5889,6 @@ let [keypadid, xcoord, ycoord] = keypads[valuetype]; - console.log('XXX TODO : Edit value', path, valuetype, callback, initial, keypadid); - edit_callback = callback; let widget = hmi_widgets[keypadid]; @@ -5895,8 +5977,6 @@ eltsub.active.setAttribute("style", eltsub.active_style); - console.log("active", eltsub); - }; function widget_inactive_activable(eltsub) { @@ -5911,8 +5991,6 @@ eltsub.inactive.setAttribute("style", eltsub.inactive_style); - console.log("inactive", eltsub); - };