diff -r f058542d0caa -r e704b0487515 svghmi/gen_index_xhtml.xslt --- a/svghmi/gen_index_xhtml.xslt Mon Jan 25 14:02:08 2021 +0100 +++ b/svghmi/gen_index_xhtml.xslt Tue Jan 26 11:14:22 2021 +0100 @@ -264,9 +264,7 @@ " - [ - - ] + @@ -387,12 +385,16 @@ Home - No Home page defined! + + No Home page defined! + - No page defined! + + No page defined! + @@ -511,6 +513,13 @@ + + + HMI:Page + + is nested in another HMI:Page + + @@ -1549,7 +1558,7 @@ - + @@ -4219,16 +4228,6 @@ - - - - - key_pos - - - - - @@ -4280,27 +4279,11 @@ init: function() { - this.edit_elt.onclick = () => edit_value( - - " + this.edit_elt.onclick = () => edit_value(" ", " - ", - - this, this.last_val, - - - - this.key_pos_elt.getBBox() - - - - undefined - - - - ); + ", this, this.last_val); @@ -4983,154 +4966,6 @@ class KeypadWidget extends Widget{ - moving = undefined; - - click = undefined; - - offset = undefined; - - - - on_position_click(evt) { - - this.moving = true; - - - - // chatch window events - - window.addEventListener("touchmove", this.bound_on_drag, true); - - window.addEventListener("mousemove", this.bound_on_drag, true); - - - - window.addEventListener("mouseup", this.bound_on_release, true) - - window.addEventListener("touchend", this.bound_on_release, true); - - window.addEventListener("touchcancel", this.bound_on_release, true); - - - - // get click position offset from widget x,y and save it to variable - - var keypad_borders = this.position_elt.getBoundingClientRect(); - - var clickX = undefined; - - var clickY = undefined; - - if (evt.type == "touchstart"){ - - clickX = Math.ceil(evt.touches[0].clientX); - - clickY = Math.ceil(evt.touches[0].clientY); - - } - - else{ - - clickX = evt.pageX; - - clickY = evt.pageY; - - } - - this.offset=[clickX-keypad_borders.left,clickY-keypad_borders.top] - - } - - - - on_release(evt) { - - //relase binds - - window.removeEventListener("touchmove", this.bound_on_drag, true); - - window.removeEventListener("mousemove", this.bound_on_drag, true); - - - - window.removeEventListener("mouseup", this.bound_on_release, true) - - window.removeEventListener("touchend", this.bound_on_release, true); - - window.removeEventListener("touchcancel", this.bound_on_release, true); - - - - if(this.moving) - - this.moving = false; - - } - - - - on_drag(evt) { - - if(this.moving) - - //get mouse coordinates - - var clickX = undefined; - - var clickY = undefined; - - if (evt.type == "touchmove"){ - - clickX = Math.ceil(evt.touches[0].clientX); - - clickY = Math.ceil(evt.touches[0].clientY); - - } - - else{ - - clickX = evt.pageX; - - clickY = evt.pageY; - - } - - this.click = [clickX,clickY] - - - - //requeset redraw - - this.request_animate(); - - } - - - - animate(){ - - //get keyboard pos in html - - let [eltid, tmpgrp] = current_modal; - - let [xcoord,ycoord] = this.coordinates; - - let [clickX,clickY] = this.click; - - let [xdest,ydest,svgWidth,svgHeight] = page_desc[current_visible_page].bbox; - - - - //translate keyboard position - - let mouseX = ((clickX-this.offset[0])/window.innerWidth)*svgWidth; - - let mouseY = ((clickY-this.offset[1])/window.innerHeight)*svgHeight; - - tmpgrp.setAttribute("transform","translate("+String(xdest-xcoord+mouseX)+","+String(ydest-ycoord+mouseY)+")"); - - } - on_key_click(symbols) { @@ -5333,7 +5168,7 @@ - Sign Space NumDot position + Sign Space NumDot @@ -5371,20 +5206,6 @@ _click()"); - if(this.position_elt){ - - this.bound_on_release = this.on_release.bind(this); - - this.bound_on_drag = this.on_drag.bind(this); - - - - this.position_elt.setAttribute("onmousedown", "hmi_widgets['"+this.element_id+"'].on_position_click(evt)"); - - this.position_elt.setAttribute("ontouchstart", "hmi_widgets['"+this.element_id+"'].on_position_click(evt)"); - - } - }, @@ -7376,7 +7197,7 @@ const localtypes = {"PAGE_LOCAL":null, "HMI_LOCAL":null} - function edit_value(path, valuetype, callback, initial, size) { + function edit_value(path, valuetype, callback, initial) { if(valuetype in localtypes){ @@ -7390,7 +7211,7 @@ let widget = hmi_widgets[keypadid]; - widget.start_edit(path, valuetype, callback, initial, size); + widget.start_edit(path, valuetype, callback, initial); }; @@ -7400,7 +7221,7 @@ - function show_modal(size) { + function show_modal() { let [element, parent] = detachable_elements[this.element.id]; @@ -7414,17 +7235,7 @@ let [xdest,ydest] = page_desc[current_visible_page].bbox; - if (typeof size === 'undefined'){ - - tmpgrpattr.value = "translate("+String(xdest-xcoord)+","+String(ydest-ycoord)+")"; - - } - - else{ - - tmpgrpattr.value = "translate("+String(xdest-xcoord+size.x)+","+String(ydest-ycoord+size.y)+")"; - - } + tmpgrpattr.value = "translate("+String(xdest-xcoord)+","+String(ydest-ycoord)+")";