svghmi/widget_image.ysl2
changeset 4056 4b2de1a0fbf9
equal deleted inserted replaced
4055:c325749651d1 4056:4b2de1a0fbf9
       
     1 // widget_image.ysl2
       
     2 
       
     3 widget_desc("Image") {
       
     4     longdesc
       
     5     ||
       
     6     If Image widget is a svg:image element, then href content is replaced by
       
     7     value of given variable.
       
     8     ||
       
     9 
       
    10     shortdesc > Image display
       
    11 }
       
    12 
       
    13 widget_class("Image")
       
    14     ||
       
    15         frequency = 5;
       
    16         dispatch(value, oldval, index) {
       
    17             if (index == 0) {
       
    18                 this.given_url = value;
       
    19                 this.ready = true;
       
    20                 this.request_animate();
       
    21             }
       
    22         }
       
    23     ||
       
    24 
       
    25 widget_defs("Image") {
       
    26     |     given_url: "",
       
    27     |     ready: false,
       
    28     |     animate: function(){
       
    29     |       this.element.setAttribute('href', this.given_url);
       
    30     |     },
       
    31     |
       
    32     |     init: function() {
       
    33     |       this.animate();
       
    34     |     },
       
    35 }