[DE][PE][SSE] Add scroll to context menu

This commit is contained in:
Julia Radzhabova 2022-02-09 22:51:43 +03:00
parent 9ee95bab6e
commit cc2b1309b7
4 changed files with 30 additions and 2 deletions

View file

@ -651,7 +651,28 @@ define([
if (left < 0)
left = 0;
if (this.options.restoreHeight) {
if (this.options.restoreHeightAndTop) { // can change top position, if top<0 - then change menu height
var cg = Common.Utils.croppedGeometry();
docH = cg.height - 10;
menuRoot.css('max-height', 'none');
menuH = menuRoot.outerHeight();
if (top + menuH > docH + cg.top) {
top = docH - menuH;
}
if (top < cg.top)
top = cg.top;
if (top + menuH > docH + cg.top) {
menuRoot.css('max-height', (docH - top) + 'px');
(!this.scroller) && (this.scroller = new Common.UI.Scroller({
el: this.$el.find('.dropdown-menu '),
minScrollbarLength: 30,
suppressScrollX: true,
alwaysVisibleY: this.scrollAlwaysVisible
}));
this.wheelSpeed = undefined;
}
this.scroller && this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible});
} else if (this.options.restoreHeight) {
if (typeof (this.options.restoreHeight) == "number") {
if (top + menuH > docH) {
menuRoot.css('max-height', (docH - top) + 'px');

View file

@ -2671,6 +2671,7 @@ define([
this.pictureMenu = new Common.UI.Menu({
cls: 'shifted-right',
restoreHeightAndTop: true,
initMenu: function(value){
if (_.isUndefined(value.imgProps))
return;
@ -3283,7 +3284,7 @@ define([
this.tableMenu = new Common.UI.Menu({
cls: 'shifted-right',
// maxHeight: 610,
restoreHeightAndTop: true,
initMenu: function(value){
// table properties
if (_.isUndefined(value.tableProps))
@ -4004,6 +4005,7 @@ define([
this.textMenu = new Common.UI.Menu({
cls: 'shifted-right',
restoreHeightAndTop: true,
initMenu: function(value){
var isInShape = (value.imgProps && value.imgProps.value && !_.isNull(value.imgProps.value.get_ShapeProperties()));
var isInChart = (value.imgProps && value.imgProps.value && !_.isNull(value.imgProps.value.get_ChartProperties()));

View file

@ -2056,6 +2056,7 @@ define([
me.slideMenu = new Common.UI.Menu({
cls: 'shifted-right',
restoreHeightAndTop: true,
initMenu: function(value) {
var selectedLast = me.api.asc_IsLastSlideSelected(),
selectedFirst = me.api.asc_IsFirstSlideSelected();
@ -3342,6 +3343,7 @@ define([
me.tableMenu = new Common.UI.Menu({
cls: 'shifted-right',
restoreHeightAndTop: true,
initMenu: function(value){
// table properties
if (_.isUndefined(value.tableProps))
@ -3555,6 +3557,7 @@ define([
me.pictureMenu = new Common.UI.Menu({
cls: 'shifted-right',
restoreHeightAndTop: true,
initMenu: function(value){
if (me.api) {
mnuUnGroupImg.setDisabled(!me.api.canUnGroup());

View file

@ -552,6 +552,7 @@ define([
me.ssMenu = new Common.UI.Menu({
cls: 'shifted-right',
restoreHeightAndTop: true,
id : 'id-context-menu-cell',
items : [
me.pmiCut,
@ -831,6 +832,7 @@ define([
this.imgMenu = new Common.UI.Menu({
cls: 'shifted-right',
restoreHeightAndTop: true,
items: [
me.pmiImgCut,
me.pmiImgCopy,