svghmi/svghmi.js
changeset 3385 18621ce81f5f
parent 3381 3a0908b0319d
child 3413 2e84a2782295
equal deleted inserted replaced
3384:bd337d21f686 3385:18621ce81f5f
   208         }
   208         }
   209     });
   209     });
   210 }
   210 }
   211 
   211 
   212 // subscribe to per instance current page hmi variable
   212 // subscribe to per instance current page hmi variable
       
   213 // PLC must prefix page name with "!" for page switch to happen
   213 subscribers(current_page_var_index).add({
   214 subscribers(current_page_var_index).add({
   214     frequency: 1,
   215     frequency: 1,
   215     indexes: [current_page_var_index],
   216     indexes: [current_page_var_index],
   216     new_hmi_value: function(index, value, oldval) {
   217     new_hmi_value: function(index, value, oldval) {
   217         switch_page(value);
   218         if(value.startsWith("!"))
       
   219             switch_page(value.slice(1));
   218     }
   220     }
   219 });
   221 });
   220 
   222 
   221 function svg_text_to_multiline(elt) {
   223 function svg_text_to_multiline(elt) {
   222     return(Array.prototype.map.call(elt.children, x=>x.textContent).join("\\\\n")); 
   224     return(Array.prototype.map.call(elt.children, x=>x.textContent).join("\\\\n")); 
   465     requestHMIAnimation();
   467     requestHMIAnimation();
   466     jump_history.push([page_name, page_index]);
   468     jump_history.push([page_name, page_index]);
   467     if(jump_history.length > 42)
   469     if(jump_history.length > 42)
   468         jump_history.shift();
   470         jump_history.shift();
   469 
   471 
   470     apply_hmi_value(current_page_var_index,
   472     apply_hmi_value(current_page_var_index, page_index == undefined
   471                     page_index == undefined
   473         ? page_name
   472                         ? page_name
   474         : page_name + "@" + hmitree_paths[page_index]);
   473                         : page_name + "@" + hmitree_paths[page_index]);
       
   474 
   475 
   475     return true;
   476     return true;
   476 };
   477 };
   477 
   478 
   478 function switch_visible_page(page_name) {
   479 function switch_visible_page(page_name) {