Allow hiding shadow in boxes with skip

This commit is contained in:
Eric Kotato 2021-04-16 18:02:35 +03:00
parent ac04800962
commit 68ca7c4be9
2 changed files with 17 additions and 4 deletions

View file

@ -132,10 +132,12 @@ void BoxContent::updateShadowsVisibility() {
auto top = _scroll->scrollTop();
_topShadow->toggle(
(top > 0 || _innerTopSkip > 0),
(top > 0
|| (_innerTopSkip > 0 && !_topShadowWithSkip)),
anim::type::normal);
_bottomShadow->toggle(
(top < _scroll->scrollTopMax() || _innerBottomSkip > 0),
(top < _scroll->scrollTopMax()
|| (_innerBottomSkip > 0 && !_bottomShadowWithSkip)),
anim::type::normal);
}
@ -229,10 +231,12 @@ void BoxContent::updateScrollAreaGeometry() {
auto top = _scroll->scrollTop();
_topShadow->toggle(
(top > 0 || _innerTopSkip > 0),
(top > 0
|| (_innerTopSkip > 0 && !_topShadowWithSkip)),
anim::type::instant);
_bottomShadow->toggle(
(top < _scroll->scrollTopMax() || _innerBottomSkip > 0),
(top < _scroll->scrollTopMax()
|| (_innerBottomSkip > 0 && !_bottomShadowWithSkip)),
anim::type::instant);
}
}

View file

@ -207,6 +207,13 @@ protected:
getDelegate()->setLayerType(layerType);
}
void setTopShadowWithSkip(bool enabled) {
_topShadowWithSkip = enabled;
}
void setBottomShadowWithSkip(bool enabled) {
_bottomShadowWithSkip = enabled;
}
void setDimensions(
int newWidth,
int maxHeight,
@ -281,6 +288,8 @@ private:
bool _preparing = false;
bool _noContentMargin = false;
bool _closeByEscape = true;
bool _topShadowWithSkip = false;
bool _bottomShadowWithSkip = false;
int _innerTopSkip = 0;
int _innerBottomSkip = 0;
object_ptr<ScrollArea> _scroll = { nullptr };