Skip to content

Commit

Permalink
Merge pull request #215 from PixlOne/fix/thumbwheel
Browse files Browse the repository at this point in the history
Fix ThumbWheel feature direction bug
  • Loading branch information
PixlOne authored Mar 14, 2021
2 parents 916fa86 + 48399a1 commit 214af3d
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions src/logid/features/ThumbWheel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 214af3d

Please sign in to comment.