From cbcf44ac8506d316d57a7e0bb30baad258618bdb Mon Sep 17 00:00:00 2001 From: Reed Garmsen Date: Tue, 14 Jul 2015 20:14:23 -0700 Subject: Minor changes to scroll 'feel' and logic flow --- web/react/components/mention_list.jsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'web') diff --git a/web/react/components/mention_list.jsx b/web/react/components/mention_list.jsx index 17c513714..1852a3ebc 100644 --- a/web/react/components/mention_list.jsx +++ b/web/react/components/mention_list.jsx @@ -41,7 +41,7 @@ module.exports = React.createClass({ self.setState({ selectedMention: tempSelectedMention - 1, selectedUsername: self.refs['mention' + (tempSelectedMention - 1)].props.username }); } } - else { + else if (e.which === 40) { if (self.getSelection(self.state.selectedMention + 1)) self.setState({ selectedMention: self.state.selectedMention + 1, selectedUsername: self.refs['mention' + (self.state.selectedMention + 1)].props.username }); else @@ -82,12 +82,12 @@ module.exports = React.createClass({ break; } } - if (this.refs.mention0 != undefined && !foundMatch) { + if (this.getSelection(0) && !foundMatch) { this.refs.mention0.select(); this.setState({ selectedMention: 0, selectedUsername: this.refs.mention0.props.username }); } } - else if (this.refs['mention' + this.state.selectedMention] != undefined) { + else if (this.getSelection(this.state.selectedMention)) { this.refs['mention' + this.state.selectedMention].select(); } } @@ -144,7 +144,7 @@ module.exports = React.createClass({ var scrollAmount = 0; if (direction === "up" && ifLoopUp !== -1) - scrollAmount = $("#mentionsbox").innerHeight() + 10000000; //innerHeight is not the real height of the box in the RHS sometimes; this compensates as it should always go to the bottom anyway + scrollAmount = $("#mentionsbox").height() * 100; //Makes sure that it scrolls all the way to the bottom else if (direction === "down" && this.refs['mention' + this.state.selectedMention].props.listId === 0) scrollAmount = 0; else if (direction === "up") @@ -154,7 +154,7 @@ module.exports = React.createClass({ $("#mentionsbox").animate({ scrollTop: scrollAmount - }, 50); + }, 75); }, alreadyMentioned: function(username) { var excludeUsers = this.state.excludeUsers; -- cgit v1.2.3-1-g7c22