diff options
author | Florrie <towerofnix@gmail.com> | 2017-12-09 11:39:29 -0400 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2017-12-09 11:39:29 -0400 |
commit | 39b4468c2757d6d7a9416099b21030b09f850280 (patch) | |
tree | f2b5eb56c4430d74ac8faed09895a1b6113a93b3 /ui/form | |
parent | dbdf9cc8f4dbc138766bf8b0ea756cbe6fd6ba32 (diff) |
Hide items which are scrolled past in ListScrollForm
Diffstat (limited to 'ui/form')
-rw-r--r-- | ui/form/ListScrollForm.js | 8 |
1 files changed, 7 insertions, 1 deletions
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] |