Allow pinned top box part without a shadow.

This commit is contained in:
John Preston 2023-09-29 21:51:08 +04:00
parent dc6a4e976c
commit ae7409b062
3 changed files with 9 additions and 13 deletions

View file

@ -321,18 +321,20 @@ void BoxContent::updateInnerVisibleTopBottom() {
} }
} }
void BoxContent::updateShadowsVisibility() { void BoxContent::updateShadowsVisibility(anim::type animated) {
if (!_scroll) { if (!_scroll) {
return; return;
} }
const auto top = _scroll->scrollTop(); const auto top = _scroll->scrollTop();
_topShadow->toggle( _topShadow->toggle(
(top > 0 || _innerTopSkip > 0), ((top > 0)
anim::type::normal); || (_innerTopSkip > 0
&& !getDelegate()->style().shadowIgnoreTopSkip)),
animated);
_bottomShadow->toggle( _bottomShadow->toggle(
(top < _scroll->scrollTopMax() || _innerBottomSkip > 0), (top < _scroll->scrollTopMax() || _innerBottomSkip > 0),
anim::type::normal); animated);
} }
void BoxContent::setDimensionsToContent( void BoxContent::setDimensionsToContent(
@ -419,14 +421,7 @@ void BoxContent::updateScrollAreaGeometry() {
height() - _innerBottomSkip - st::lineWidth); height() - _innerBottomSkip - st::lineWidth);
if (changed) { if (changed) {
updateInnerVisibleTopBottom(); updateInnerVisibleTopBottom();
updateShadowsVisibility(anim::type::instant);
const auto top = _scroll->scrollTop();
_topShadow->toggle(
(top > 0 || _innerTopSkip > 0),
anim::type::instant);
_bottomShadow->toggle(
(top < _scroll->scrollTopMax() || _innerBottomSkip > 0),
anim::type::instant);
} }
} }

View file

@ -294,7 +294,7 @@ private:
void setInner(object_ptr<TWidget> inner, const style::ScrollArea &st); void setInner(object_ptr<TWidget> inner, const style::ScrollArea &st);
void updateScrollAreaGeometry(); void updateScrollAreaGeometry();
void updateInnerVisibleTopBottom(); void updateInnerVisibleTopBottom();
void updateShadowsVisibility(); void updateShadowsVisibility(anim::type animated = anim::type::normal);
object_ptr<TWidget> doTakeInnerWidget(); object_ptr<TWidget> doTakeInnerWidget();
BoxContentDelegate *_delegate = nullptr; BoxContentDelegate *_delegate = nullptr;

View file

@ -29,6 +29,7 @@ Box {
title: FlatLabel; title: FlatLabel;
bg: color; bg: color;
titleAdditionalFg: color; titleAdditionalFg: color;
shadowIgnoreTopSkip: bool;
} }
boxDuration: 200; boxDuration: 200;