mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 23:53:58 +02:00
Kept point details widget while chart lines are filtering.
This commit is contained in:
parent
e6559276c0
commit
423d2293f9
2 changed files with 15 additions and 4 deletions
|
@ -792,8 +792,12 @@ Limits ChartWidget::ChartAnimationController::finalHeightLimits() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
float64 ChartWidget::ChartAnimationController::detailsProgress(
|
float64 ChartWidget::ChartAnimationController::detailsProgress(
|
||||||
crl::time now) const {
|
crl::time now,
|
||||||
return _animation.animating()
|
const Limits &appearedOnXLimits) const {
|
||||||
|
const auto xLimitsChanged = false
|
||||||
|
|| (appearedOnXLimits.min != _animationValueXMin.to())
|
||||||
|
|| (appearedOnXLimits.max != _animationValueXMax.to());
|
||||||
|
return (_animation.animating() && xLimitsChanged)
|
||||||
? std::clamp(
|
? std::clamp(
|
||||||
(now - _animation.started()) / float64(kExpandingDelay),
|
(now - _animation.started()) / float64(kExpandingDelay),
|
||||||
0.,
|
0.,
|
||||||
|
@ -892,13 +896,16 @@ void ChartWidget::setupChartArea() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto detailsAlpha = 1.
|
const auto detailsAlpha = 1.
|
||||||
- _animationController.detailsProgress(now);
|
- _animationController.detailsProgress(
|
||||||
|
now,
|
||||||
|
_details.appearedOnXLimits);
|
||||||
|
|
||||||
if (_details.widget) {
|
if (_details.widget) {
|
||||||
if (!detailsAlpha && _details.currentX) {
|
if (!detailsAlpha && _details.currentX) {
|
||||||
_details.widget->hide();
|
_details.widget->hide();
|
||||||
_details.widget->setXIndex(-1);
|
_details.widget->setXIndex(-1);
|
||||||
_details.currentX = 0;
|
_details.currentX = 0;
|
||||||
|
_details.appearedOnXLimits = {};
|
||||||
}
|
}
|
||||||
if (_details.currentX) {
|
if (_details.currentX) {
|
||||||
const auto lineRect = QRectF(
|
const auto lineRect = QRectF(
|
||||||
|
@ -1140,6 +1147,7 @@ void ChartWidget::setupDetails() {
|
||||||
currentXLimits.min,
|
currentXLimits.min,
|
||||||
currentXLimits.max,
|
currentXLimits.max,
|
||||||
*nearestXPercentageIt);
|
*nearestXPercentageIt);
|
||||||
|
_details.appearedOnXLimits = currentXLimits;
|
||||||
const auto xLeft = _details.currentX
|
const auto xLeft = _details.currentX
|
||||||
- _details.widget->width();
|
- _details.widget->width();
|
||||||
const auto x = (xLeft >= 0)
|
const auto x = (xLeft >= 0)
|
||||||
|
|
|
@ -66,7 +66,9 @@ private:
|
||||||
[[nodiscard]] Limits finalXLimits() const;
|
[[nodiscard]] Limits finalXLimits() const;
|
||||||
[[nodiscard]] Limits currentHeightLimits() const;
|
[[nodiscard]] Limits currentHeightLimits() const;
|
||||||
[[nodiscard]] Limits finalHeightLimits() const;
|
[[nodiscard]] Limits finalHeightLimits() const;
|
||||||
[[nodiscard]] float64 detailsProgress(crl::time now) const;
|
[[nodiscard]] float64 detailsProgress(
|
||||||
|
crl::time now,
|
||||||
|
const Limits &appearedOnXLimits) const;
|
||||||
[[nodiscard]] bool animating() const;
|
[[nodiscard]] bool animating() const;
|
||||||
[[nodiscard]] bool isFPSSlow() const;
|
[[nodiscard]] bool isFPSSlow() const;
|
||||||
|
|
||||||
|
@ -125,6 +127,7 @@ private:
|
||||||
struct {
|
struct {
|
||||||
base::unique_qptr<PointDetailsWidget> widget;
|
base::unique_qptr<PointDetailsWidget> widget;
|
||||||
float64 currentX = 0;
|
float64 currentX = 0;
|
||||||
|
Limits appearedOnXLimits;
|
||||||
} _details;
|
} _details;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
Loading…
Add table
Reference in a new issue