svghmi/svghmi.js
branchsvghmi
changeset 3024 0a9f6f29b7dd
parent 3022 f6fe42b7ce60
parent 3019 497aac6522a3
child 3035 d1fc8c55c1d3
equal deleted inserted replaced
3023:407a0205405a 3024:0a9f6f29b7dd
    73     }
    73     }
    74 
    74 
    75     if(jumps_need_update) update_jumps();
    75     if(jumps_need_update) update_jumps();
    76 
    76 
    77     apply_updates();
    77     apply_updates();
       
    78 
       
    79     pending_widget_animates.forEach(widget => widget._animate());
       
    80     pending_widget_animates = [];
       
    81 
    78     requestAnimationFrameID = null;
    82     requestAnimationFrameID = null;
    79 }
    83 }
    80 
    84 
    81 function requestHMIAnimation() {
    85 function requestHMIAnimation() {
    82     if(requestAnimationFrameID == null){
    86     if(requestAnimationFrameID == null){
   407 
   411 
   408 };
   412 };
   409 
   413 
   410 var xmlns = "http://www.w3.org/2000/svg";
   414 var xmlns = "http://www.w3.org/2000/svg";
   411 var edit_callback;
   415 var edit_callback;
   412 function edit_value(path, valuetype, callback, initial) {
   416 function edit_value(path, valuetype, callback, initial, size) {
   413 
   417 
   414     let [keypadid, xcoord, ycoord] = keypads[valuetype];
   418     let [keypadid, xcoord, ycoord] = keypads[valuetype];
   415     console.log('XXX TODO : Edit value', path, valuetype, callback, initial, keypadid);
   419     console.log('XXX TODO : Edit value', path, valuetype, callback, initial, keypadid);
   416     edit_callback = callback;
   420     edit_callback = callback;
   417     let widget = hmi_widgets[keypadid];
   421     let widget = hmi_widgets[keypadid];
   418     widget.start_edit(path, valuetype, callback, initial);
   422     widget.start_edit(path, valuetype, callback, initial, size);
   419 };
   423 };
   420 
   424 
   421 var current_modal; /* TODO stack ?*/
   425 var current_modal; /* TODO stack ?*/
   422 
   426 
   423 function show_modal() {
   427 function show_modal(size) {
   424     let [element, parent] = detachable_elements[this.element.id];
   428     let [element, parent] = detachable_elements[this.element.id];
   425 
   429 
   426     tmpgrp = document.createElementNS(xmlns,"g");
   430     tmpgrp = document.createElementNS(xmlns,"g");
   427     tmpgrpattr = document.createAttribute("transform");
   431     tmpgrpattr = document.createAttribute("transform");
   428 
       
   429     let [xcoord,ycoord] = this.coordinates;
   432     let [xcoord,ycoord] = this.coordinates;
   430     let [xdest,ydest] = page_desc[current_visible_page].bbox;
   433     let [xdest,ydest] = page_desc[current_visible_page].bbox;
   431     tmpgrpattr.value = "translate("+String(xdest-xcoord)+","+String(ydest-ycoord)+")";
   434     if (typeof size === 'undefined'){
       
   435         tmpgrpattr.value = "translate("+String(xdest-xcoord)+","+String(ydest-ycoord)+")";
       
   436     }
       
   437     else{
       
   438         tmpgrpattr.value = "translate("+String(xdest-xcoord+size.x)+","+String(ydest-ycoord+size.y)+")";
       
   439     }
       
   440 
   432     tmpgrp.setAttributeNode(tmpgrpattr);
   441     tmpgrp.setAttributeNode(tmpgrpattr);
   433 
   442 
   434     tmpgrp.appendChild(element);
   443     tmpgrp.appendChild(element);
   435     parent.appendChild(tmpgrp);
   444     parent.appendChild(tmpgrp);
   436 
   445