Skip to content

Commit

Permalink
Change combo value via mouse wheel
Browse files Browse the repository at this point in the history
  • Loading branch information
luboslenco committed Jun 2, 2021
1 parent b465561 commit 6d9a1ac
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Sources/zui/Zui.hx
Expand Up @@ -1274,12 +1274,16 @@ class Zui {
var distBottom = kha.System.windowHeight() - windowBorderBottom - (comboSelectedY + comboH );
var unrollUp = distBottom < 0 && distBottom < distTop;
beginRegion(globalG, comboSelectedX, comboSelectedY, comboSelectedW);
if (isKeyPressed) {
if (key == (unrollUp ? KeyCode.Down : KeyCode.Up) && comboToSubmit > 0) {
if (isKeyPressed || inputWheelDelta != 0) {
var arrowUp = isKeyPressed && key == (unrollUp ? KeyCode.Down : KeyCode.Up);
var arrowDown = isKeyPressed && key == (unrollUp ? KeyCode.Up : KeyCode.Down);
var wheelUp = (unrollUp && inputWheelDelta > 0) || (!unrollUp && inputWheelDelta < 0);
var wheelDown = (unrollUp && inputWheelDelta < 0) || (!unrollUp && inputWheelDelta > 0);
if ((arrowUp || wheelUp) && comboToSubmit > 0) {
comboToSubmit--;
submitComboHandle = comboSelectedHandle;
}
else if (key == (unrollUp ? KeyCode.Up : KeyCode.Down) && comboToSubmit < comboSelectedTexts.length - 1) {
else if ((arrowDown || wheelDown) && comboToSubmit < comboSelectedTexts.length - 1) {
comboToSubmit++;
submitComboHandle = comboSelectedHandle;
}
Expand Down

1 comment on commit 6d9a1ac

@MathemanFlo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very convenient. Love it!

Please sign in to comment.