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) {
this.trigger('show:after', this, e);
if (this.scroller) {
this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible});
var menuRoot = this.menuRoot,
$selected = menuRoot.find('> li .checked');
var menuRoot = this.menuRoot;
if (this.wheelSpeed===undefined) {
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) {
var itemTop = $selected.position().top,
itemHeight = $selected.height(),
@ -469,7 +475,7 @@ define([
this._search.index = idxCandidate;
var item = itemCandidate.cmpEl.find('a');
if (this.scroller) {
this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible});
this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible, wheelSpeed: this.wheelSpeed});
var itemTop = item.position().top,
itemHeight = item.height(),
listHeight = this.menuRoot.height();
@ -552,8 +558,10 @@ define([
suppressScrollX: true,
alwaysVisibleY: this.scrollAlwaysVisible
}));
this.wheelSpeed = undefined;
} else if ( top + menuH < docH && menuRoot.height() < this.options.restoreHeight) {
menuRoot.css('max-height', (Math.min(docH - top, this.options.restoreHeight)) + 'px');
this.wheelSpeed = undefined;
}
}
} else {

View file

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