diff -r 00825316ed00 -r 02ea529fd08c svghmi/gen_index_xhtml.xslt
--- a/svghmi/gen_index_xhtml.xslt Wed May 13 18:50:07 2020 +0200
+++ b/svghmi/gen_index_xhtml.xslt Wed May 13 22:22:13 2020 +0200
@@ -866,6 +866,10 @@
class Widget {
+ offset = 0;
+
+ frequency = 10; /* FIXME arbitrary default max freq. Obtain from config ? */
+
constructor(elt_id,args,indexes,members){
this.element_id = elt_id;
@@ -876,8 +880,6 @@
this.indexes = indexes;
- this.offset = 0;
-
Object.keys(members).forEach(prop => this[prop]=members[prop]);
}
@@ -1115,6 +1117,10 @@
init() {
+ // TODO : use attributes to allow interaction through svg:use
+
+ // TODO : deal with dragging
+
this.element.addEventListener(
"mousedown",
@@ -2592,34 +2598,34 @@
},
+
+ class SwitchWidget extends Widget{
+
+ frequency = 5;
+
+ dispatch(value) {
+
+ for(let choice of this.choices){
+
+ if(value != choice.value){
+
+ choice.elt.setAttribute("style", "display:none");
+
+ } else {
+
+ choice.elt.setAttribute("style", choice.style);
+
+ }
+
+ }
+
+ }
+
+ }
+
+
- frequency: 5,
-
- dispatch: function(value) {
-
- for(let choice of this.choices){
-
- if(value != choice.value){
-
- choice.elt.setAttribute("style", "display:none");
-
- } else {
-
- choice.elt.setAttribute("style", choice.style);
-
- }
-
- }
-
- },
-
- init: function() {
-
- // Hello Switch
-
- },
-
choices: [