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 ) { if ( $active && $active.length ) {
var _maxright = $active.parents('.box-controls').width(); var _maxright = $active.parents('.box-controls').width();
var data = $active.data(), var data = $active.data(),
_rightedge = data.rightedge; _rightedge = data.rightedge,
_btns = data.buttons,
_flex = data.flex;
if ( !_rightedge ) { if ( !_rightedge ) {
_rightedge = $active.get(0).getBoundingClientRect().right; _rightedge = $active.get(0).getBoundingClientRect().right;
} }
if ( !_btns ) {
if ( _rightedge > _maxright ) { _btns = [];
if ( !$active.hasClass('compactwidth') ) { _.each($active.find('.btn-slot .x-huge'), function(item) {
$active.addClass('compactwidth'); _btns.push($(item).closest('.btn-slot'));
data.rightedge = _rightedge; });
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 { } else {
if ($active.hasClass('compactwidth')) { for (var i=0; i<_btns.length; i++) {
$active.removeClass('compactwidth'); 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 */ /* ##adopt-panel-width */
.panel.compactwidth:not(#plugns-panel) { .panel:not(#plugns-panel) .compactwidth {
.btn-group, .btn-toolbar { .btn-group, .btn-toolbar {
&.x-huge { &.x-huge {
.caption { .caption {

View file

@ -96,7 +96,7 @@
<span class="btn-slot split" id="slot-btn-slidesize"></span> <span class="btn-slot split" id="slot-btn-slidesize"></span>
</div> </div>
</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>
<section class="panel" data-tab="ins"> <section class="panel" data-tab="ins">
<div class="group"> <div class="group">

View file

@ -87,7 +87,7 @@ define([
'<span class="btn-slot text" id="slot-chk-banded-column"></span>' + '<span class="btn-slot text" id="slot-chk-banded-column"></span>' +
'</div>' + '</div>' +
'</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>' + '</div>' +
'</section>'; '</section>';