Refactoring menu scroll: some items was not fully displayed (user list in mentions, page size in [de])

This commit is contained in:
Julia Radzhabova 2019-10-16 17:27:33 +03:00
parent a505981d89
commit d8da495bc8
2 changed files with 13 additions and 5 deletions

View file

@ -380,9 +380,15 @@ define([
onAfterShowMenu: function(e) { onAfterShowMenu: function(e) {
this.trigger('show:after', this, e); this.trigger('show:after', this, e);
if (this.scroller) { if (this.scroller) {
this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible}); var menuRoot = this.menuRoot;
var menuRoot = this.menuRoot, if (this.wheelSpeed===undefined) {
$selected = menuRoot.find('> li .checked'); var item = menuRoot.find('> li:first'),
itemHeight = (item.length) ? item.outerHeight() : 1;
this.wheelSpeed = Math.min((Math.floor(menuRoot.height()/itemHeight) * itemHeight)/10, 20);
}
this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible, wheelSpeed: this.wheelSpeed});
var $selected = menuRoot.find('> li .checked');
if ($selected.length) { if ($selected.length) {
var itemTop = $selected.position().top, var itemTop = $selected.position().top,
itemHeight = $selected.height(), itemHeight = $selected.height(),
@ -469,7 +475,7 @@ define([
this._search.index = idxCandidate; this._search.index = idxCandidate;
var item = itemCandidate.cmpEl.find('a'); var item = itemCandidate.cmpEl.find('a');
if (this.scroller) { if (this.scroller) {
this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible}); this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible, wheelSpeed: this.wheelSpeed});
var itemTop = item.position().top, var itemTop = item.position().top,
itemHeight = item.height(), itemHeight = item.height(),
listHeight = this.menuRoot.height(); listHeight = this.menuRoot.height();
@ -552,8 +558,10 @@ define([
suppressScrollX: true, suppressScrollX: true,
alwaysVisibleY: this.scrollAlwaysVisible alwaysVisibleY: this.scrollAlwaysVisible
})); }));
this.wheelSpeed = undefined;
} else if ( top + menuH < docH && menuRoot.height() < this.options.restoreHeight) { } else if ( top + menuH < docH && menuRoot.height() < this.options.restoreHeight) {
menuRoot.css('max-height', (Math.min(docH - top, this.options.restoreHeight)) + 'px'); menuRoot.css('max-height', (Math.min(docH - top, this.options.restoreHeight)) + 'px');
this.wheelSpeed = undefined;
} }
} }
} else { } else {

View file

@ -469,7 +469,7 @@ define([
}); });
this.emailMenu = new Common.UI.Menu({ this.emailMenu = new Common.UI.Menu({
maxHeight: 190, maxHeight: 200,
cyclic: false, cyclic: false,
items: [] items: []
}).on('render:after', function(mnu) { }).on('render:after', function(mnu) {