diff --git a/apps/common/main/resources/less/toolbar.less b/apps/common/main/resources/less/toolbar.less index 23cf89c5b..f0a9cf0d9 100644 --- a/apps/common/main/resources/less/toolbar.less +++ b/apps/common/main/resources/less/toolbar.less @@ -214,7 +214,7 @@ padding: 12px 10px 7px 0; border-radius: 0; z-index:999; - overflow: hidden; + overflow: auto; .compactwidth { .btn-group, .btn-toolbar { &.x-huge { diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index 4fc5381db..a294b8338 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -1515,11 +1515,17 @@ define([ menu.menuAlignEl = cmp.cmpEl; menu.menuAlign = 'tl-tl'; - var offset = cmp.cmpEl.width() - cmp.openButton.$el.width() - columnCount * (itemMargin + _width) - 1; + var menuWidth = columnCount * (itemMargin + _width), + buttonOffsetLeft = cmp.openButton.$el.offset().left; + // if (menuWidth>buttonOffsetLeft) + // menuWidth = Math.max(Math.floor(buttonOffsetLeft/(itemMargin + _width)), 2) * (itemMargin + _width); + if (menuWidth>Common.Utils.innerWidth()) + menuWidth = Math.max(Math.floor(Common.Utils.innerWidth()/(itemMargin + _width)), 2) * (itemMargin + _width); + var offset = cmp.cmpEl.width() - cmp.openButton.$el.width() - Math.min(menuWidth, buttonOffsetLeft) - 1; menu.setOffset(Math.min(offset, 0)); menu.cmpEl.css({ - 'width': columnCount * (_width + itemMargin), + 'width': menuWidth, 'min-height': cmp.cmpEl.height() }); } diff --git a/apps/presentationeditor/main/app/view/Toolbar.js b/apps/presentationeditor/main/app/view/Toolbar.js index de669b96c..41ff4c21f 100644 --- a/apps/presentationeditor/main/app/view/Toolbar.js +++ b/apps/presentationeditor/main/app/view/Toolbar.js @@ -1088,11 +1088,17 @@ define([ menu.menuAlignEl = cmp.cmpEl; menu.menuAlign = 'tl-tl'; - var offset = cmp.cmpEl.width() - cmp.openButton.$el.width() - columnCount * (itemMargin + itemWidth) - 1; + var menuWidth = columnCount * (itemMargin + itemWidth), + buttonOffsetLeft = cmp.openButton.$el.offset().left; + // if (menuWidth>buttonOffsetLeft) + // menuWidth = Math.max(Math.floor(buttonOffsetLeft/(itemMargin + itemWidth)), 2) * (itemMargin + itemWidth); + if (menuWidth>Common.Utils.innerWidth()) + menuWidth = Math.max(Math.floor(Common.Utils.innerWidth()/(itemMargin + itemWidth)), 2) * (itemMargin + itemWidth); + var offset = cmp.cmpEl.width() - cmp.openButton.$el.width() - Math.min(menuWidth, buttonOffsetLeft) - 1; menu.setOffset(Math.min(offset, 0)); menu.cmpEl.css({ - 'width': columnCount * (itemWidth + itemMargin), + 'width': menuWidth, 'min-height': cmp.cmpEl.height() }); } diff --git a/apps/spreadsheeteditor/main/app/view/PivotTable.js b/apps/spreadsheeteditor/main/app/view/PivotTable.js index f5c4396be..94d66261a 100644 --- a/apps/spreadsheeteditor/main/app/view/PivotTable.js +++ b/apps/spreadsheeteditor/main/app/view/PivotTable.js @@ -79,7 +79,6 @@ define([ '' + '' + '' + - '' + '
' + '
' + '' + @@ -88,7 +87,6 @@ define([ '' + '
' + '
' + - '' + '
' + '
' + ''; @@ -281,10 +279,29 @@ define([ lock : [_set.lostConnect, _set.coAuth, _set.noPivot, _set.selRangeEdit, _set.pivotLock, _set['FormatCells'], _set['PivotTables']], beforeOpenHandler: function(e) { var cmp = this, - menu = cmp.openButton.menu; + menu = cmp.openButton.menu, + columnCount = 4; + if (menu.cmpEl) { - var offset = cmp.cmpEl.width() - cmp.openButton.$el.width() - menu.cmpEl.outerWidth() - 1; + var itemEl = $(cmp.cmpEl.find('.dataview.inner .style').get(0)).parent(); + var itemMargin = 8; + var itemWidth = itemEl.is(':visible') ? parseFloat(itemEl.css('width')) : + (cmp.itemWidth + parseFloat(itemEl.css('padding-left')) + parseFloat(itemEl.css('padding-right')) + + parseFloat(itemEl.css('border-left-width')) + parseFloat(itemEl.css('border-right-width'))); + + menu.menuAlignEl = cmp.cmpEl; + menu.menuAlign = 'tl-tl'; + var menuWidth = columnCount * (itemMargin + itemWidth) + 17, // for scroller + buttonOffsetLeft = cmp.openButton.$el.offset().left; + if (menuWidth>Common.Utils.innerWidth()) + menuWidth = Math.max(Math.floor((Common.Utils.innerWidth()-17)/(itemMargin + itemWidth)), 2) * (itemMargin + itemWidth) + 17; + var offset = cmp.cmpEl.width() - cmp.openButton.$el.width() - Math.min(menuWidth, buttonOffsetLeft) - 1; menu.setOffset(Math.min(offset, 0)); + + menu.cmpEl.css({ + 'width': menuWidth, + 'min-height': cmp.cmpEl.height() + }); } }, dataHint: '1', @@ -375,10 +392,6 @@ define([ this.btnPivotSubtotals.render(this.$el.find('#slot-btn-pivot-subtotals')); this.btnPivotGrandTotals.render(this.$el.find('#slot-btn-pivot-grand-totals')); this.pivotStyles.render(this.$el.find('#slot-field-pivot-styles')); - this.pivotStyles.openButton.menu.cmpEl.css({ - 'min-width': 293, - 'max-width': 293 - }); return this.$el; }, diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index c527f6721..429ef8dea 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -1330,11 +1330,17 @@ define([ menu.menuAlignEl = cmp.cmpEl; menu.menuAlign = 'tl-tl'; - var offset = cmp.cmpEl.width() - cmp.openButton.$el.width() - columnCount * (itemMargin + itemWidth) - 1; + var menuWidth = columnCount * (itemMargin + itemWidth), + buttonOffsetLeft = cmp.openButton.$el.offset().left; + // if (menuWidth>buttonOffsetLeft) + // menuWidth = Math.max(Math.floor(buttonOffsetLeft/(itemMargin + itemWidth)), 2) * (itemMargin + itemWidth); + if (menuWidth>Common.Utils.innerWidth()) + menuWidth = Math.max(Math.floor(Common.Utils.innerWidth()/(itemMargin + itemWidth)), 2) * (itemMargin + itemWidth); + var offset = cmp.cmpEl.width() - cmp.openButton.$el.width() - Math.min(menuWidth, buttonOffsetLeft) - 1; menu.setOffset(Math.min(offset, 0)); menu.cmpEl.css({ - 'width' : columnCount * (itemWidth + itemMargin), + 'width': menuWidth, 'min-height': cmp.cmpEl.height() }); }