This is an automated email from the git hooks/post-receive script. New commit to branch hotfix/3.1.5 in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 95fbf029c365b81254bfa07c8116eb835b19b586 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Fri Jun 1 17:38:02 2018 +0200 ref #214 : Si la fénétre permet de voir plus d'une page de donné chargé la page suivant dans la foulé --- .../src/main/web/tag/components/LazyLoad.tag.html | 30 ++++++++++++++-------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/pollen-ui-riot-js/src/main/web/tag/components/LazyLoad.tag.html b/pollen-ui-riot-js/src/main/web/tag/components/LazyLoad.tag.html index 8a2e2eeb..0d547c5f 100644 --- a/pollen-ui-riot-js/src/main/web/tag/components/LazyLoad.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/components/LazyLoad.tag.html @@ -51,38 +51,48 @@ this.nbNextGroup = Math.min(this.opts.loadSize, this.nbNext); this.loading = false; this.update(); + if (this.nbNext > 0 && this.checkLoading()) { + return this.loadNext(); + } return Promise.resolve(); }); } return Promise.reject(); }; - this.onscroll = e => { + this.checkLoading = () => { + let check; if (this.opts.scrollTarget) { // this.logger.info("scroll window : " + e.currentTarget.scrollTop + // " - height window : " + e.currentTarget.clientHeight + // " - top loading : " + this.refs.loading.offsetTop); - if (e.currentTarget.scrollTop + e.currentTarget.clientHeight > this.refs.loading.offsetTop) { - this.loadNext().then(() => {}, () => {}); - } + check = this.scrollTarget.scrollTop + this.scrollTarget.clientHeight > this.refs.loading.offsetTop; } else { let absolutTop = this.refs.loading.getBoundingClientRect().top; // this.logger.info("absolutTop : " + absolutTop + - // " - height : " + e.currentTarget.innerHeight); - if (0 < absolutTop && absolutTop < e.currentTarget.innerHeight) { - this.loadNext().then(() => {}, () => {}); - } + // " - height : " + this.scrollTarget.innerHeight); + check = 0 < absolutTop && absolutTop < this.scrollTarget.innerHeight; } + return check; }; - (this.opts.scrollTarget || window).addEventListener("scroll", this.onscroll); + this.onscroll = () => { + if (this.checkLoading()) { + this.loadNext().then(() => {}, () => {}); + } + }; + + this.scrollTarget = this.opts.scrollTarget || window; + + // TODO 01/06/2018 bavencoff pour la 3.2.0 ajouté un déclancheur aussi pour le resize + this.scrollTarget.addEventListener("scroll", this.onscroll); if (!this.opts.notLoadOnStart) { this.reload().catch(() => {}); } this.on("unmount", () => { - (this.opts.scrollTarget || window).removeEventListener("scroll", this.onscroll); + this.scrollTarget.removeEventListener("scroll", this.onscroll); }); </script> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.