Merge branch 'feature/toolbar-resize' into develop

This commit is contained in:
Julia Radzhabova 2020-04-13 22:45:20 +03:00
commit 39892cb54a
4 changed files with 57 additions and 10 deletions

View file

@ -374,20 +374,67 @@ define([
if ( $active && $active.length ) {
var _maxright = $active.parents('.box-controls').width();
var data = $active.data(),
_rightedge = data.rightedge;
_rightedge = data.rightedge,
_btns = data.buttons,
_flex = data.flex;
if ( !_rightedge ) {
_rightedge = $active.get(0).getBoundingClientRect().right;
}
if ( _rightedge > _maxright ) {
if ( !$active.hasClass('compactwidth') ) {
$active.addClass('compactwidth');
data.rightedge = _rightedge;
if ( !_btns ) {
_btns = [];
_.each($active.find('.btn-slot .x-huge'), function(item) {
_btns.push($(item).closest('.btn-slot'));
});
data.buttons = _btns;
}
if (!_flex) {
_flex = [];
_.each($active.find('.group.flex'), function(item) {
_flex.push($(item));
});
data.flex = _flex;
}
if ( _rightedge > _maxright) {
if (_flex.length>0) {
for (var i=0; i<_flex.length; i++) {
var item = _flex[i];
if (item.outerWidth() > parseInt(item.css('min-width')))
return;
else
item.css('width', item.css('min-width'));
}
}
for (var i=_btns.length-1; i>=0; i--) {
var btn = _btns[i];
if ( !btn.hasClass('compactwidth') ) {
btn.addClass('compactwidth');
_rightedge = $active.get(0).getBoundingClientRect().right;
if (_rightedge <= _maxright)
break;
}
}
data.rightedge = _rightedge;
} else {
if ($active.hasClass('compactwidth')) {
$active.removeClass('compactwidth');
for (var i=0; i<_btns.length; i++) {
var btn = _btns[i];
if ( btn.hasClass('compactwidth') ) {
btn.removeClass('compactwidth');
_rightedge = $active.get(0).getBoundingClientRect().right;
if ( _rightedge > _maxright) {
btn.addClass('compactwidth');
_rightedge = $active.get(0).getBoundingClientRect().right;
break;
}
}
}
data.rightedge = _rightedge;
if (_flex.length>0 && $active.find('.btn-slot.compactwidth').length<1) {
for (var i=0; i<_flex.length; i++) {
var item = _flex[i];
item.css('width', item.css('max-width'));
}
}
}
}

View file

@ -175,7 +175,7 @@
}
/* ##adopt-panel-width */
.panel.compactwidth:not(#plugns-panel) {
.panel:not(#plugns-panel) .compactwidth {
.btn-group, .btn-toolbar {
&.x-huge {
.caption {

View file

@ -96,7 +96,7 @@
<span class="btn-slot split" id="slot-btn-slidesize"></span>
</div>
</div>
<div class="group" id="slot-field-styles" style="width: 100%; min-width: 148px;"></div>
<div class="group flex" id="slot-field-styles" style="width: 100%; min-width: 148px; max-width: 100%;"></div>
</section>
<section class="panel" data-tab="ins">
<div class="group">

View file

@ -87,7 +87,7 @@ define([
'<span class="btn-slot text" id="slot-chk-banded-column"></span>' +
'</div>' +
'</div>' +
'<div class="group" id="slot-field-pivot-styles" style="width: 336px;max-width: 336px;min-width: 115px;">' +
'<div class="group flex" id="slot-field-pivot-styles" style="width: 336px;max-width: 336px;min-width: 115px;">' +
'</div>' +
'</section>';