This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 542ae9c6bf663bab28095a8ee0d9cd31b70d8313 Author: Kevin Morin <morin@codelutin.com> Date: Mon Aug 7 17:16:29 2017 +0200 ajout d'un timer sur le tooltip pour eviter de recalculer des positions inutilement --- .../src/main/web/tag/poll/Votes.tag.html | 44 +++++++++++++--------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html index caf6fb1b..9cc46858 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Votes.tag.html @@ -394,31 +394,40 @@ require("../components/HumanInput.tag.html"); this.update(); }; + this.tooltipTimeout = null; + this.showTooltip = (vote, choice) => (e) => { e.preventDefault(); e.stopPropagation(); - this.voteTooltip = { - choice: choice, - vote: vote, - show: choice || !vote || !vote.anonymous - }; - this.update(); - if (this.voteTooltip.show) { - let voteTooltip = this.refs.voteTooltip; - voteTooltip.style.top = (e.target.offsetTop + e.target.offsetHeight + 10) + "px"; - voteTooltip.style.left = (e.target.offsetLeft + (e.target.offsetWidth - voteTooltip.offsetWidth) / 2) + "px"; - } + + this.tooltipTimeout = setTimeout(() => { + this.voteTooltip = { + choice: choice, + vote: vote, + show: choice || !vote || !vote.anonymous + }; + this.update(); + if (this.voteTooltip.show) { + let voteTooltip = this.refs.voteTooltip; + voteTooltip.style.top = (e.target.offsetTop + e.target.offsetHeight + 10) + "px"; + voteTooltip.style.left = (e.target.offsetLeft + (e.target.offsetWidth - voteTooltip.offsetWidth) / 2) + "px"; + } + }, 500); }; this.hideTooltip = (e) => { e.preventDefault(); e.stopPropagation(); - this.voteTooltip = { - choice: null, - vote: null, - show: false - }; - this.update(); + clearTimeout(this.tooltipTimeout); + this.tooltipTimeout = null; + if (this.voteTooltip.show) { + this.voteTooltip = { + choice: null, + vote: null, + show: false + }; + this.update(); + } }; </script> @@ -609,6 +618,7 @@ require("../components/HumanInput.tag.html"); box-shadow: 0px 0px 10px var(--shadow); opacity: 0.8; text-align: center; + z-index: 9999; } .voters .vote-tooltip:after { -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.