mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-11-17 23:25:15 -06:00
Add cursor condition to check if mouse button is held down
This commit is contained in:
@@ -25,6 +25,8 @@ const static std::map<MacroConditionCursor::Condition, std::string>
|
||||
#ifdef _WIN32 // Not implemented for MacOS and Linux
|
||||
{MacroConditionCursor::Condition::CLICK,
|
||||
"AdvSceneSwitcher.condition.cursor.type.click"},
|
||||
{MacroConditionCursor::Condition::HELD,
|
||||
"AdvSceneSwitcher.condition.cursor.type.held"},
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -50,6 +52,19 @@ bool MacroConditionCursor::CheckClick()
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MacroConditionCursor::CheckHeld()
|
||||
{
|
||||
switch (_button) {
|
||||
case MacroConditionCursor::Button::LEFT:
|
||||
return IsMouseLeftButtonDown() || CheckClick();
|
||||
case MacroConditionCursor::Button::MIDDLE:
|
||||
return IsMouseMiddleButtonDown() || CheckClick();
|
||||
case MacroConditionCursor::Button::RIGHT:
|
||||
return IsMouseRightButtonDown() || CheckClick();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MacroConditionCursor::CheckCondition()
|
||||
{
|
||||
bool ret = false;
|
||||
@@ -68,6 +83,9 @@ bool MacroConditionCursor::CheckCondition()
|
||||
case Condition::CLICK:
|
||||
ret = CheckClick();
|
||||
break;
|
||||
case Condition::HELD:
|
||||
ret = CheckHeld();
|
||||
break;
|
||||
}
|
||||
|
||||
_lastCheckTime = std::chrono::high_resolution_clock::now();
|
||||
@@ -351,7 +369,9 @@ void MacroConditionCursorEdit::SetWidgetVisibility()
|
||||
}
|
||||
|
||||
_buttons->setVisible(_entryData->_condition ==
|
||||
MacroConditionCursor::Condition::CLICK);
|
||||
MacroConditionCursor::Condition::CLICK ||
|
||||
_entryData->_condition ==
|
||||
MacroConditionCursor::Condition::HELD);
|
||||
|
||||
adjustSize();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user