svghmi/widgets_common.ysl2
changeset 3603 f1a00aa8cb3b
parent 3600 c9ecf7d50888
child 3623 0237c28cd172
equal deleted inserted replaced
3602:1bd8e077894e 3603:f1a00aa8cb3b
   341                 if(deafened != undefined){
   341                 if(deafened != undefined){
   342                     clearTimeout(deafened);
   342                     clearTimeout(deafened);
   343                     this.lastdispatch[i] = undefined;
   343                     this.lastdispatch[i] = undefined;
   344                     this.undeafen(i);
   344                     this.undeafen(i);
   345                 }
   345                 }
   346                 let index = this.indexes[i];
   346                 let index = this.get_variable_index(i);
   347                 if(this.relativeness[i])
       
   348                     index += this.offset;
       
   349                 subscribers(index).delete(this);
   347                 subscribers(index).delete(this);
   350             }
   348             }
   351             this.offset = 0;
   349             this.offset = 0;
   352             this.relativeness = undefined;
   350             this.relativeness = undefined;
   353         }
   351         }
   360             for(let i = 0; i < this.indexes_length; i++) {
   358             for(let i = 0; i < this.indexes_length; i++) {
   361                 let index = this.get_variable_index(i);
   359                 let index = this.get_variable_index(i);
   362                 if(index == undefined) continue;
   360                 if(index == undefined) continue;
   363                 subscribers(index).add(this);
   361                 subscribers(index).add(this);
   364             }
   362             }
   365             need_cache_apply.push(this); 
   363             this.apply_cache(); 
   366         }
   364         }
   367 
   365 
   368         apply_cache() {
   366         apply_cache() {
   369             for(let index in this.indexes){
   367             for(let i = 0; i < this.indexes_length; i++) {
   370                 /* dispatch current cache in newly opened page widgets */
   368                 /* dispatch current cache in newly opened page widgets */
   371                 let realindex = this.get_variable_index(index);
   369                 let realindex = this.get_variable_index(i);
   372                 if(realindex == undefined) continue;
   370                 if(realindex == undefined) continue;
   373                 let cached_val = cache[realindex];
   371                 let cached_val = cache[realindex];
   374                 if(cached_val != undefined)
   372                 if(cached_val != undefined)
   375                     this.feed_data_for_dispatch(cached_val, cached_val, index);
   373                     this.feed_data_for_dispatch(cached_val, cached_val, i);
   376             }
   374             }
   377         }
   375         }
   378 
   376 
   379         get_variable_index(varnum) {
   377         get_variable_index(varnum) {
   380             let index = this.indexes[varnum];
   378             let index = this.indexes[varnum];