author | Edouard Tisserant |
Wed, 13 May 2020 14:47:17 +0200 | |
branch | svghmi |
changeset 2964 | a7b11c9f468e |
parent 2952 | 2adfce8908b4 |
child 2959 | ae549ba1a116 |
permissions | -rw-r--r-- |
2891
8927ae8326b2
SVGHMI: add widget_foreach.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
1 |
|
8927ae8326b2
SVGHMI: add widget_foreach.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
2 |
template "widget[@type='ForEach']", mode="widget_defs" { |
8927ae8326b2
SVGHMI: add widget_foreach.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
3 |
param "hmi_element"; |
2892
27dd409fba1d
SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2891
diff
changeset
|
4 |
const "widgets", "func:refered_elements($forEach_widgets)[not(@id = $forEach_widgets_ids)]"; |
2894
4cf9ad35e6d0
SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2893
diff
changeset
|
5 |
|
4cf9ad35e6d0
SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2893
diff
changeset
|
6 |
const "class","arg[1]/@value"; |
4cf9ad35e6d0
SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2893
diff
changeset
|
7 |
|
4cf9ad35e6d0
SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2893
diff
changeset
|
8 |
const "base_path","path/@value"; |
4cf9ad35e6d0
SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2893
diff
changeset
|
9 |
const "hmi_index_base", "$indexed_hmitree/*[@hmipath = $base_path]"; |
4cf9ad35e6d0
SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2893
diff
changeset
|
10 |
const "hmi_tree_base", "$hmitree/descendant-or-self::*[@path = $hmi_index_base/@path]"; |
4cf9ad35e6d0
SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2893
diff
changeset
|
11 |
const "hmi_tree_items", "$hmi_tree_base/*[@class = $class]"; |
4cf9ad35e6d0
SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2893
diff
changeset
|
12 |
const "hmi_index_items", "$indexed_hmitree/*[@path = $hmi_tree_items/@path]"; |
4cf9ad35e6d0
SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2893
diff
changeset
|
13 |
const "items_paths", "$hmi_index_items/@hmipath"; |
2893
d57a12b8f5db
SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents:
2892
diff
changeset
|
14 |
| index_pool: [ |
2894
4cf9ad35e6d0
SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2893
diff
changeset
|
15 |
foreach "$hmi_index_items" { |
4cf9ad35e6d0
SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2893
diff
changeset
|
16 |
| «@index»`if "position()!=last()" > ,` |
4cf9ad35e6d0
SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2893
diff
changeset
|
17 |
} |
2893
d57a12b8f5db
SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents:
2892
diff
changeset
|
18 |
| ], |
2896
99c5335ed59f
SVGHMI: Widget ForEach buttons now call corresponding methods.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2895
diff
changeset
|
19 |
| init: function() { |
2893
d57a12b8f5db
SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents:
2892
diff
changeset
|
20 |
const "prefix","concat($class,':')"; |
d57a12b8f5db
SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents:
2892
diff
changeset
|
21 |
const "buttons_regex","concat('^',$prefix,'[+\-][0-9]+')"; |
2896
99c5335ed59f
SVGHMI: Widget ForEach buttons now call corresponding methods.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2895
diff
changeset
|
22 |
const "buttons", "$hmi_element/*[regexp:test(@inkscape:label, $buttons_regex)]"; |
99c5335ed59f
SVGHMI: Widget ForEach buttons now call corresponding methods.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2895
diff
changeset
|
23 |
foreach "$buttons" { |
99c5335ed59f
SVGHMI: Widget ForEach buttons now call corresponding methods.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2895
diff
changeset
|
24 |
const "op","substring-after(@inkscape:label, $prefix)"; |
99c5335ed59f
SVGHMI: Widget ForEach buttons now call corresponding methods.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2895
diff
changeset
|
25 |
| id("«@id»").setAttribute("onclick", "hmi_widgets['«$hmi_element/@id»'].on_click('«$op»', evt)"); |
2893
d57a12b8f5db
SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents:
2892
diff
changeset
|
26 |
} |
2896
99c5335ed59f
SVGHMI: Widget ForEach buttons now call corresponding methods.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2895
diff
changeset
|
27 |
| |
2895
89c02b452717
SVGHMI: ForEach now has working (un)subscribe. Fixed PageSwitch that wasn't behaving when jumping to current page with another path.
Edouard Tisserant
parents:
2894
diff
changeset
|
28 |
| this.items = [ |
2893
d57a12b8f5db
SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents:
2892
diff
changeset
|
29 |
const "items_regex","concat('^',$prefix,'[0-9]+')"; |
d57a12b8f5db
SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents:
2892
diff
changeset
|
30 |
const "unordered_items","$hmi_element//*[regexp:test(@inkscape:label, $items_regex)]"; |
d57a12b8f5db
SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents:
2892
diff
changeset
|
31 |
foreach "$unordered_items" { |
d57a12b8f5db
SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents:
2892
diff
changeset
|
32 |
const "elt_label","concat($prefix, string(position()))"; |
d57a12b8f5db
SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents:
2892
diff
changeset
|
33 |
const "elt","$unordered_items[@inkscape:label = $elt_label]"; |
2894
4cf9ad35e6d0
SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2893
diff
changeset
|
34 |
const "pos","position()"; |
4cf9ad35e6d0
SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2893
diff
changeset
|
35 |
const "item_path", "$items_paths[$pos]"; |
2895
89c02b452717
SVGHMI: ForEach now has working (un)subscribe. Fixed PageSwitch that wasn't behaving when jumping to current page with another path.
Edouard Tisserant
parents:
2894
diff
changeset
|
36 |
| [ /* item="«$elt_label»" path="«$item_path»" */ |
2893
d57a12b8f5db
SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents:
2892
diff
changeset
|
37 |
if "count($elt)=0" error > Missing item labeled «$elt_label» in ForEach widget «$hmi_element/@id» |
d57a12b8f5db
SVGHMI: added func:get_hmi_tree_elt to match HMI tree node from path. Continue implementing ForEach widget : force order and completeness of items list. Now also collecting ForEach buttons.
Edouard Tisserant
parents:
2892
diff
changeset
|
38 |
foreach "func:refered_elements($elt)[@id = $hmi_elements/@id][not(@id = $elt/@id)]" { |
2894
4cf9ad35e6d0
SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2893
diff
changeset
|
39 |
if "not(func:is_descendant_path(func:widget(@id)/path/@value, $item_path))" |
2896
99c5335ed59f
SVGHMI: Widget ForEach buttons now call corresponding methods.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2895
diff
changeset
|
40 |
error > Widget id="«@id»" label="«@inkscape:label»" is having wrong path. Accroding to ForEach widget ancestor id="«$hmi_element/@id»", path should be descendant of "«$item_path»". |
2895
89c02b452717
SVGHMI: ForEach now has working (un)subscribe. Fixed PageSwitch that wasn't behaving when jumping to current page with another path.
Edouard Tisserant
parents:
2894
diff
changeset
|
41 |
| hmi_widgets["«@id»"]`if "position()!=last()" > ,` |
2892
27dd409fba1d
SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2891
diff
changeset
|
42 |
} |
2895
89c02b452717
SVGHMI: ForEach now has working (un)subscribe. Fixed PageSwitch that wasn't behaving when jumping to current page with another path.
Edouard Tisserant
parents:
2894
diff
changeset
|
43 |
| ]`if "position()!=last()" > ,` |
2892
27dd409fba1d
SVGHMI: ForEach knows its own widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2891
diff
changeset
|
44 |
} |
2895
89c02b452717
SVGHMI: ForEach now has working (un)subscribe. Fixed PageSwitch that wasn't behaving when jumping to current page with another path.
Edouard Tisserant
parents:
2894
diff
changeset
|
45 |
| ] |
89c02b452717
SVGHMI: ForEach now has working (un)subscribe. Fixed PageSwitch that wasn't behaving when jumping to current page with another path.
Edouard Tisserant
parents:
2894
diff
changeset
|
46 |
| }, |
89c02b452717
SVGHMI: ForEach now has working (un)subscribe. Fixed PageSwitch that wasn't behaving when jumping to current page with another path.
Edouard Tisserant
parents:
2894
diff
changeset
|
47 |
| item_offset: 0, |
2891
8927ae8326b2
SVGHMI: add widget_foreach.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
48 |
} |
8927ae8326b2
SVGHMI: add widget_foreach.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
49 |
|
2952
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
50 |
template "widget[@type='ForEach']", mode="widget_class" |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
51 |
|| |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
52 |
class ForEachWidget extends Widget{ |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
53 |
unsub(){ |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
54 |
for(let item of this.items){ |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
55 |
for(let widget of item) { |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
56 |
widget.unsub(); |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
57 |
} |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
58 |
} |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
59 |
this.offset = 0; |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
60 |
} |
2891
8927ae8326b2
SVGHMI: add widget_foreach.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
61 |
|
2952
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
62 |
foreach_widgets_do(new_offset, todo){ |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
63 |
this.offset = new_offset; |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
64 |
for(let i = 0; i < this.items.length; i++) { |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
65 |
let item = this.items[i]; |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
66 |
let orig_item_index = this.index_pool[i]; |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
67 |
let item_index = this.index_pool[i+this.item_offset]; |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
68 |
let item_index_offset = item_index - orig_item_index; |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
69 |
for(let widget of item) { |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
70 |
todo(widget).call(widget, new_offset + item_index_offset); |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
71 |
} |
2942
b07ad97e6019
SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2897
diff
changeset
|
72 |
} |
b07ad97e6019
SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2897
diff
changeset
|
73 |
} |
b07ad97e6019
SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2897
diff
changeset
|
74 |
|
2952
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
75 |
sub(new_offset=0){ |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
76 |
this.foreach_widgets_do(new_offset, w=>w.sub); |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
77 |
} |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
78 |
|
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
79 |
apply_cache() { |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
80 |
this.foreach_widgets_do(this.offset, w=>w.apply_cache); |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
81 |
} |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
82 |
|
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
83 |
on_click(opstr, evt) { |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
84 |
let new_item_offset = eval(String(this.item_offset)+opstr); |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
85 |
if(new_item_offset + this.items.length > this.index_pool.length) { |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
86 |
if(this.item_offset + this.items.length == this.index_pool.length) |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
87 |
new_item_offset = 0; |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
88 |
else |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
89 |
new_item_offset = this.index_pool.length - this.items.length; |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
90 |
} else if(new_item_offset < 0) { |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
91 |
if(this.item_offset == 0) |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
92 |
new_item_offset = this.index_pool.length - this.items.length; |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
93 |
else |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
94 |
new_item_offset = 0; |
2942
b07ad97e6019
SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2897
diff
changeset
|
95 |
} |
2952
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
96 |
this.item_offset = new_item_offset; |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
97 |
this.unsub(); |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
98 |
this.sub(this.offset); |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
99 |
update_subscriptions(); |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
100 |
need_cache_apply.push(this); |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
101 |
jumps_need_update = true; |
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
102 |
requestHMIAnimation(); |
2942
b07ad97e6019
SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2897
diff
changeset
|
103 |
} |
b07ad97e6019
SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2897
diff
changeset
|
104 |
} |
2952
2adfce8908b4
SVGHMI: apply per class overloading of sub/unsub to ForEach widget
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2943
diff
changeset
|
105 |
|| |
2942
b07ad97e6019
SVGHMI: moved JS code of foreach and jump widget in corresponding widget_*.ysl2. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2897
diff
changeset
|
106 |