mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 07:33:52 +02:00
Fixed possible crashed on local zoom of charts in stats.
This commit is contained in:
parent
2a74736761
commit
d369d988b0
3 changed files with 11 additions and 5 deletions
|
@ -1275,9 +1275,13 @@ void ChartWidget::processLocalZoom(int xIndex) {
|
|||
if (_footer->isHidden()) {
|
||||
return;
|
||||
}
|
||||
_localZoomLifetime.destroy();
|
||||
const auto wasZoom = _footer->xPercentageLimits();
|
||||
|
||||
const auto header = Ui::CreateChild<Header>(this);
|
||||
const auto headerOwned
|
||||
= _localZoomLifetime.make_state<base::unique_qptr<Header>>(
|
||||
base::make_unique_q<Header>(this));
|
||||
const auto header = headerOwned->get();
|
||||
header->show();
|
||||
_header->geometryValue(
|
||||
) | rpl::start_with_next([=](const QRect &g) {
|
||||
|
@ -1290,7 +1294,8 @@ void ChartWidget::processLocalZoom(int xIndex) {
|
|||
setAttribute(Qt::WA_TransparentForMouseEvents, !value);
|
||||
};
|
||||
|
||||
const auto mouseTrackingLifetime = std::make_shared<rpl::lifetime>();
|
||||
const auto mouseTrackingLifetime
|
||||
= _localZoomLifetime.make_state<rpl::lifetime>();
|
||||
_chartView->setUpdateCallback([=] { _chartArea->update(); });
|
||||
const auto createMouseTracking = [=] {
|
||||
_chartArea->setMouseTracking(true);
|
||||
|
@ -1322,7 +1327,7 @@ void ChartWidget::processLocalZoom(int xIndex) {
|
|||
zoomOutButton->setTextTransform(
|
||||
Ui::RoundButton::TextTransform::NoTransform);
|
||||
zoomOutButton->setClickedCallback([=] {
|
||||
auto lifetime = std::make_shared<rpl::lifetime>();
|
||||
auto lifetime = _localZoomLifetime.make_state<rpl::lifetime>();
|
||||
const auto animation = lifetime->make_state<Ui::Animations::Simple>();
|
||||
const auto currentXPercentage = _footer->xPercentageLimits();
|
||||
animation->start([=](float64 value) {
|
||||
|
@ -1365,7 +1370,7 @@ void ChartWidget::processLocalZoom(int xIndex) {
|
|||
};
|
||||
|
||||
{
|
||||
auto lifetime = std::make_shared<rpl::lifetime>();
|
||||
auto lifetime = _localZoomLifetime.make_state<rpl::lifetime>();
|
||||
const auto animation = lifetime->make_state<Ui::Animations::Simple>();
|
||||
_chartView->maybeLocalZoom({ _chartData, Type::Prepare });
|
||||
animation->start([=](float64 value) {
|
||||
|
|
|
@ -175,6 +175,7 @@ private:
|
|||
rpl::event_stream<float64> _zoomRequests;
|
||||
|
||||
rpl::lifetime _waitingSizeLifetime;
|
||||
rpl::lifetime _localZoomLifetime;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 0b324ce83c219c817fdd3c94a23b55fec6fec637
|
||||
Subproject commit 369d8b5172b6f70a3a9b2363cfa0f4fc5f620f56
|
Loading…
Add table
Reference in a new issue