diff -r 9179cbc6fc49 -r 41edcb8e0a01 svghmi/gen_index_xhtml.xslt --- a/svghmi/gen_index_xhtml.xslt Tue Apr 14 17:16:25 2020 +0200 +++ b/svghmi/gen_index_xhtml.xslt Tue Apr 14 17:17:35 2020 +0200 @@ -859,6 +859,8 @@ this.opened = false; + this.bound_inhibit_click_elsewhere = this.inhibit_click_elsewhere.bind(this); + }, on_selection_click: function(selection) { @@ -867,7 +869,11 @@ this.close(); - this.set_selection(selection); + let orig = this.indexes[0]; + + let idx = this.offset ? orig - this.offset : orig; + + apply_hmi_value(idx, selection); }, @@ -963,6 +969,18 @@ }, + inhibit_click_elsewhere: function(e) { + + console.log("inhibit", e); + + console.log(e.target.parentNode, this.text_elt); + + if(e.target.parentNode !== this.text_elt) + + e.stopPropagation(); + + }, + close: function(){ this.reset_text(); @@ -971,6 +989,10 @@ this.element.appendChild(this.button_elt); + this.apply_cache(); + + document.removeEventListener("click", this.bound_inhibit_click_elsewhere, true); + this.opened = false; }, @@ -1103,7 +1125,11 @@ this.element.removeChild(this.button_elt); - /* TODO disable interaction with background */ + this.element.parentNode.appendChild(this.element.parentNode.removeChild(this.element)); + + // disable interaction with background + + document.addEventListener("click", this.bound_inhibit_click_elsewhere, true); this.opened = true; @@ -1327,7 +1353,11 @@ on_op_click: function(opstr) { - let new_val = change_hmi_value(this.indexes[0], opstr); + let orig = this.indexes[0]; + + let idx = this.offset ? orig - this.offset : orig; + + let new_val = change_hmi_value(idx, opstr); }, @@ -1343,7 +1373,11 @@ edit_callback: function(new_val) { - apply_hmi_value(this.indexes[0], new_val); + let orig = this.indexes[0]; + + let idx = this.offset ? orig - this.offset : orig; + + apply_hmi_value(idx, new_val); },