mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-01-10 08:51:12 +00:00
Clip intro animation by Next button.
This commit is contained in:
parent
66961dce83
commit
524d64a462
@ -233,6 +233,9 @@ bool Step::paintAnimated(Painter &p, QRect clip) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (!_coverAnimation.clipping.isEmpty()) {
|
||||
p.setClipRect(_coverAnimation.clipping);
|
||||
}
|
||||
|
||||
auto progress = (hasCover() ? anim::easeOutCirc(1., dt) : anim::linear(1., dt));
|
||||
auto arrivingAlpha = progress;
|
||||
@ -451,6 +454,10 @@ void Step::showAnimated(Direction direction) {
|
||||
}
|
||||
}
|
||||
|
||||
void Step::setShowAnimationClipping(QRect clipping) {
|
||||
_coverAnimation.clipping = clipping;
|
||||
}
|
||||
|
||||
void Step::setGoCallback(Fn<void(Step *step, Direction direction)> callback) {
|
||||
_goCallback = std::move(callback);
|
||||
}
|
||||
|
@ -64,6 +64,7 @@ public:
|
||||
void showAnimated(Direction direction);
|
||||
void showFast();
|
||||
[[nodiscard]] bool animating() const;
|
||||
void setShowAnimationClipping(QRect clipping);
|
||||
|
||||
[[nodiscard]] bool hasCover() const;
|
||||
[[nodiscard]] virtual bool hasBack() const;
|
||||
@ -142,6 +143,8 @@ private:
|
||||
// From content top till the next button top.
|
||||
QPixmap contentSnapshotWas;
|
||||
QPixmap contentSnapshotNow;
|
||||
|
||||
QRect clipping;
|
||||
};
|
||||
void updateLabelsPosition();
|
||||
void paintContentSnapshot(
|
||||
|
@ -639,6 +639,9 @@ void Widget::updateControlsGeometry() {
|
||||
nextTop,
|
||||
shownAmount);
|
||||
_next->moveToLeft((width() - _next->width()) / 2, realNextTop);
|
||||
getStep()->setShowAnimationClipping(shownAmount > 0
|
||||
? QRect(0, 0, width(), realNextTop)
|
||||
: QRect());
|
||||
if (_changeLanguage) {
|
||||
_changeLanguage->moveToLeft((width() - _changeLanguage->width()) / 2, _next->y() + _next->height() + _changeLanguage->height());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user