Disabled mouse events for mute button when state is inactive.
This commit is contained in:
parent
4761b307b4
commit
5c6ddf9cb3
2 changed files with 17 additions and 0 deletions
|
|
@ -285,6 +285,7 @@ void CallMuteButton::init() {
|
|||
// State type.
|
||||
const auto previousType =
|
||||
lifetime().make_state<CallMuteButtonType>(_state.current().type);
|
||||
setEnableMouse(false);
|
||||
|
||||
const auto glowColor = [=](CallMuteButtonType type) {
|
||||
if (IsInactive(type)) {
|
||||
|
|
@ -302,6 +303,10 @@ void CallMuteButton::init() {
|
|||
const auto previous = *previousType;
|
||||
*previousType = type;
|
||||
|
||||
if (IsInactive(type) && !IsInactive(previous)) {
|
||||
setEnableMouse(false);
|
||||
}
|
||||
|
||||
const auto crossFrom = IsMuted(previous) ? 0. : 1.;
|
||||
const auto crossTo = IsMuted(type) ? 0. : 1.;
|
||||
|
||||
|
|
@ -347,6 +352,12 @@ void CallMuteButton::init() {
|
|||
}
|
||||
|
||||
overridesColors(previous, type, value);
|
||||
|
||||
if (value == to) {
|
||||
if (!IsInactive(type) && IsInactive(previous)) {
|
||||
setEnableMouse(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
_switchAnimation.stop();
|
||||
|
|
@ -462,6 +473,10 @@ void CallMuteButton::lower() {
|
|||
_blobs->lower();
|
||||
}
|
||||
|
||||
void CallMuteButton::setEnableMouse(bool value) {
|
||||
_content.setAttribute(Qt::WA_TransparentForMouseEvents, !value);
|
||||
}
|
||||
|
||||
void CallMuteButton::overridesColors(
|
||||
CallMuteButtonType fromType,
|
||||
CallMuteButtonType toType,
|
||||
|
|
|
|||
|
|
@ -67,6 +67,8 @@ private:
|
|||
CallMuteButtonType toType,
|
||||
float64 progress);
|
||||
|
||||
void setEnableMouse(bool value);
|
||||
|
||||
rpl::variable<CallMuteButtonState> _state;
|
||||
float _level = 0.;
|
||||
float64 _crossLineProgress = 0.;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue