mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 15:43:55 +02:00
Added ability to hide point details on chart by second click.
This commit is contained in:
parent
b606a7b21d
commit
ecce9dbaaa
1 changed files with 6 additions and 1 deletions
|
@ -1192,6 +1192,7 @@ void ChartWidget::setupDetails() {
|
||||||
switch (state.mouseState) {
|
switch (state.mouseState) {
|
||||||
case QEvent::MouseButtonPress:
|
case QEvent::MouseButtonPress:
|
||||||
case QEvent::MouseMove: {
|
case QEvent::MouseMove: {
|
||||||
|
const auto wasXIndex = _details.widget->xIndex();
|
||||||
const auto chartRect = chartAreaRect();
|
const auto chartRect = chartAreaRect();
|
||||||
const auto currentXLimits = _animationController.finalXLimits();
|
const auto currentXLimits = _animationController.finalXLimits();
|
||||||
const auto nearestXIndex = _chartView->findXIndexByPosition(
|
const auto nearestXIndex = _chartView->findXIndexByPosition(
|
||||||
|
@ -1218,6 +1219,10 @@ void ChartWidget::setupDetails() {
|
||||||
if (_details.widget->isHidden()) {
|
if (_details.widget->isHidden()) {
|
||||||
_details.hideOnAnimationEnd = false;
|
_details.hideOnAnimationEnd = false;
|
||||||
_details.animation.start();
|
_details.animation.start();
|
||||||
|
} else if ((state.mouseState == QEvent::MouseButtonPress)
|
||||||
|
&& (wasXIndex == nearestXIndex)) {
|
||||||
|
_details.hideOnAnimationEnd = true;
|
||||||
|
_details.animation.start();
|
||||||
}
|
}
|
||||||
_details.widget->show();
|
_details.widget->show();
|
||||||
_chartArea->update();
|
_chartArea->update();
|
||||||
|
@ -1233,7 +1238,6 @@ void ChartWidget::setupDetails() {
|
||||||
0.,
|
0.,
|
||||||
1.);
|
1.);
|
||||||
const auto alpha = _details.hideOnAnimationEnd ? (1. - value) : value;
|
const auto alpha = _details.hideOnAnimationEnd ? (1. - value) : value;
|
||||||
_chartArea->update();
|
|
||||||
if (_details.widget) {
|
if (_details.widget) {
|
||||||
_details.widget->setAlpha(alpha);
|
_details.widget->setAlpha(alpha);
|
||||||
_details.widget->update();
|
_details.widget->update();
|
||||||
|
@ -1245,6 +1249,7 @@ void ChartWidget::setupDetails() {
|
||||||
}
|
}
|
||||||
_details.animation.stop();
|
_details.animation.stop();
|
||||||
}
|
}
|
||||||
|
_chartArea->update();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue