mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Prevent some accidental story closing.
This commit is contained in:
parent
aa2cf2f6ca
commit
aff094f278
5 changed files with 18 additions and 1 deletions
|
@ -505,6 +505,15 @@ ContentLayout Controller::contentLayout() const {
|
|||
};
|
||||
}
|
||||
|
||||
bool Controller::closeByClickAt(QPoint position) const {
|
||||
const auto ¤t = _layout.current();
|
||||
Assert(current.has_value());
|
||||
|
||||
return (position.x() < current->content.x() - st::storiesControlSize)
|
||||
|| (position.x() > current->content.x() + current->content.width()
|
||||
+ st::storiesControlSize);
|
||||
}
|
||||
|
||||
Data::FileOrigin Controller::fileOrigin() const {
|
||||
return Data::FileOriginStory(_shown.peer, _shown.story);
|
||||
}
|
||||
|
|
|
@ -101,6 +101,7 @@ public:
|
|||
[[nodiscard]] Layout layout() const;
|
||||
[[nodiscard]] rpl::producer<Layout> layoutValue() const;
|
||||
[[nodiscard]] ContentLayout contentLayout() const;
|
||||
[[nodiscard]] bool closeByClickAt(QPoint position) const;
|
||||
[[nodiscard]] Data::FileOrigin fileOrigin() const;
|
||||
[[nodiscard]] TextWithEntities captionText() const;
|
||||
void showFullCaption();
|
||||
|
|
|
@ -51,6 +51,10 @@ ContentLayout View::contentLayout() const {
|
|||
return _controller->contentLayout();
|
||||
}
|
||||
|
||||
bool View::closeByClickAt(QPoint position) const {
|
||||
return _controller->closeByClickAt(position);
|
||||
}
|
||||
|
||||
void View::updatePlayback(const Player::TrackState &state) {
|
||||
_controller->updateVideoPlayback(state);
|
||||
}
|
||||
|
|
|
@ -60,6 +60,7 @@ public:
|
|||
[[nodiscard]] QRect finalShownGeometry() const;
|
||||
[[nodiscard]] rpl::producer<QRect> finalShownGeometryValue() const;
|
||||
[[nodiscard]] ContentLayout contentLayout() const;
|
||||
[[nodiscard]] bool closeByClickAt(QPoint position) const;
|
||||
[[nodiscard]] SiblingView sibling(SiblingType type) const;
|
||||
[[nodiscard]] Data::FileOrigin fileOrigin() const;
|
||||
[[nodiscard]] TextWithEntities captionText() const;
|
||||
|
|
|
@ -5576,7 +5576,9 @@ void OverlayWidget::handleMouseRelease(
|
|||
|| documentContentShown()
|
||||
|| !documentBubbleShown()
|
||||
|| !_docRect.contains(position)) {
|
||||
close();
|
||||
if (!_stories || _stories->closeByClickAt(position)) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
}
|
||||
_pressed = false;
|
||||
|
|
Loading…
Add table
Reference in a new issue