# HG changeset patch
# User Edouard Tisserant
# Date 1585141755 -3600
# Node ID f1baf2d0552c84edfdaf8b170888da5a1f78c496
# Parent a2910281fcb52a9cc443a954de0a0f627c8a8ed6
SVGHMI: ForEach Widget now has a better wrap-around when scrolling : hit the boundary systematically before wrapping
diff -r a2910281fcb5 -r f1baf2d0552c svghmi/gen_index_xhtml.xslt
--- a/svghmi/gen_index_xhtml.xslt Wed Mar 25 13:56:04 2020 +0100
+++ b/svghmi/gen_index_xhtml.xslt Wed Mar 25 14:09:15 2020 +0100
@@ -1833,11 +1833,23 @@
if(new_item_offset + this.items.length > this.index_pool.length) {
- new_item_offset = 0;
+ if(this.item_offset + this.items.length == this.index_pool.length)
+
+ new_item_offset = 0;
+
+ else
+
+ new_item_offset = this.index_pool.length - this.items.length;
} else if(new_item_offset < 0) {
- new_item_offset = this.index_pool.length - this.items.length;
+ if(this.item_offset == 0)
+
+ new_item_offset = this.index_pool.length - this.items.length;
+
+ else
+
+ new_item_offset = 0;
}
diff -r a2910281fcb5 -r f1baf2d0552c svghmi/svghmi.js
--- a/svghmi/svghmi.js Wed Mar 25 13:56:04 2020 +0100
+++ b/svghmi/svghmi.js Wed Mar 25 14:09:15 2020 +0100
@@ -347,9 +347,15 @@
function foreach_onclick(opstr, evt) {
new_item_offset = eval(String(this.item_offset)+opstr)
if(new_item_offset + this.items.length > this.index_pool.length) {
- new_item_offset = 0;
+ if(this.item_offset + this.items.length == this.index_pool.length)
+ new_item_offset = 0;
+ else
+ new_item_offset = this.index_pool.length - this.items.length;
} else if(new_item_offset < 0) {
- new_item_offset = this.index_pool.length - this.items.length;
+ if(this.item_offset == 0)
+ new_item_offset = this.index_pool.length - this.items.length;
+ else
+ new_item_offset = 0;
}
this.item_offset = new_item_offset;
off = this.offset;