svghmi/widget_button.ysl2
changeset 3520 b27e50143083
parent 3419 76995a304fe0
child 3596 9c725829d8f0
equal deleted inserted replaced
3519:43b2bff95289 3520:b27e50143083
   181     |     }
   181     |     }
   182 
   182 
   183     apply "$fsm", mode="actions";
   183     apply "$fsm", mode="actions";
   184 
   184 
   185     |     animate(){
   185     |     animate(){
   186     |         if (this.active_elt && this.inactive_elt) {
   186     |         this.set_activation_state(this.display == "active");
   187     foreach "str:split('active inactive')" {
       
   188     |             if(this.display == "«.»")
       
   189     |                 this.«.»_elt.style.display = "";
       
   190     |             else
       
   191     |                 this.«.»_elt.style.display = "none";
       
   192     }
       
   193     |         }
       
   194     |     }
   187     |     }
   195 
   188 
   196     |     init() {
   189     |     init() {
   197     |         this.bound_onmouseup = this.onmouseup.bind(this);
   190     |         this.bound_onmouseup = this.onmouseup.bind(this);
   198     |         this.element.addEventListener("pointerdown", this.onmousedown.bind(this));
   191     |         this.element.addEventListener("pointerdown", this.onmousedown.bind(this));
       
   192     |         this.set_activation_state(undefined);
   199     |     }
   193     |     }
   200 }
   194 }
   201 
   195 
   202 
   196 
   203 widget_class("Button"){
   197 widget_class("Button"){
   205     const "fsm","exsl:node-set($_button_fsm)";
   199     const "fsm","exsl:node-set($_button_fsm)";
   206     call "generated_button_class" with "fsm", "$fsm";
   200     call "generated_button_class" with "fsm", "$fsm";
   207 }
   201 }
   208 
   202 
   209 widget_defs("Button") {
   203 widget_defs("Button") {
   210     optional_labels("active inactive");
   204     activable();
   211 }
   205 }
   212 
   206 
   213 widget_class("PushButton"){
   207 widget_class("PushButton"){
   214     |     frequency = 20;
   208     |     frequency = 20;
   215     const "fsm","exsl:node-set($_push_button_fsm)";
   209     const "fsm","exsl:node-set($_push_button_fsm)";
   216     call "generated_button_class" with "fsm", "$fsm";
   210     call "generated_button_class" with "fsm", "$fsm";
   217 }
   211 }
   218 
   212 
   219 widget_defs("PushButton") {
   213 widget_defs("PushButton") {
   220     optional_labels("active inactive");
   214     activable();
   221 }
   215 }
   222 
   216