From 39b4468c2757d6d7a9416099b21030b09f850280 Mon Sep 17 00:00:00 2001 From: Florrie Date: Sat, 9 Dec 2017 11:39:29 -0400 Subject: Hide items which are scrolled past in ListScrollForm --- ui/form/ListScrollForm.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ui/form/ListScrollForm.js b/ui/form/ListScrollForm.js index b23f973..7d2b083 100644 --- a/ui/form/ListScrollForm.js +++ b/ui/form/ListScrollForm.js @@ -20,11 +20,17 @@ module.exports = class ListScrollForm extends Form { // visible and we won't bother iterating over them. const itemsPastScroll = this.inputs.slice(this.scrollItems) + // We do need to hide them, though. + const itemsBeforeScroll = this.inputs.slice(0, this.scrollItems) + for (const item of itemsBeforeScroll) { + item.visible = false + } + // This variable stores how far along the respective axis (as defined by // posProp) the next element should be. let nextPos = 0 - for (let item of itemsPastScroll) { + for (const item of itemsPastScroll) { item[this.posProp] = nextPos nextPos += item[this.sizeProp] -- cgit 1.3.0-6-gf8a5