Merge pull request #215 from PixlOne/fix/thumbwheel
Fix ThumbWheel feature direction bug
This commit is contained in:
commit
214af3d6bb
|
@ -142,23 +142,15 @@ void ThumbWheel::_handleEvent(hidpp20::ThumbWheel::ThumbwheelEvent event)
|
|||
if(event.rotation) {
|
||||
int8_t direction = event.rotation > 0 ? 1 : -1;
|
||||
std::shared_ptr<actions::Gesture> scroll_action;
|
||||
std::shared_ptr<actions::Gesture> opposite_scroll;
|
||||
|
||||
if(event.rotation > 0) {
|
||||
if(direction > 0)
|
||||
scroll_action = _config.rightAction();
|
||||
opposite_scroll = _config.leftAction();
|
||||
} else {
|
||||
else
|
||||
scroll_action = _config.leftAction();
|
||||
opposite_scroll = _config.rightAction();
|
||||
}
|
||||
|
||||
if(direction != _last_direction) {
|
||||
if(opposite_scroll)
|
||||
opposite_scroll->release();
|
||||
if(scroll_action) {
|
||||
scroll_action->press(true);
|
||||
scroll_action->move(direction * event.rotation);
|
||||
}
|
||||
if(scroll_action) {
|
||||
scroll_action->press(true);
|
||||
scroll_action->move(direction * event.rotation);
|
||||
}
|
||||
|
||||
_last_direction = direction;
|
||||
|
|
Loading…
Reference in New Issue
Block a user