Commit 9f557210 authored by Lukas Marik's avatar Lukas Marik

#767 add mouse wheel scroll listening in ActionsStripWidget

parent cda32b5e
......@@ -317,7 +317,41 @@ public class ActionsStripWidget extends Group implements ActionListener {
scrollPaneTrackedPosition = scrollPane.getY() - offsetY;
}
}
@Override
public boolean scrolled(InputEvent event, float x, float y, int amount) {
if(isScrollEnabled()){
scrollPaneTracked = true;
float selectedActionHeight = selectedActions.size() * (actionSizeBigger + actionOffset);
float mouseWheelY = Math.min(getHeight(), Math.max(getHeight() * 0.9f, selectedActionHeight * 0.1f) / 4);
float offsetY = (mouseWheelY / 2) * (amount * -1);
scrollPaneLastPosition = y;
accel5 = (accel0 + accel1 + accel2 + accel3 + accel4 + offsetY) / 6;
accel0 = accel1;
accel1 = accel2;
accel3 = accel4;
accel4 = accel5;
accel5 = accel5 * SCROLL_ACCEL_SPEEDUP;
scrollPaneTrackedPosition = scrollPane.getY() - offsetY;
return true;
}
return false;
}
@Override
public void dragStart(InputEvent event, float x, float y, int pointer) {
super.dragStart(event, x, y, pointer);
}
});
tablexiaGame.getStage().setScrollFocus(scrollPane);
}
private void moveScrollOffset(float offset, Runnable finishHandler) {
......@@ -358,7 +392,7 @@ public class ActionsStripWidget extends Group implements ActionListener {
private int getScrollPaneBottomPosition(int position) {
return -position * (actionSizeBigger + actionOffset);
}
/* //////////////////////////////////////////// NEXT ACTION FIELD */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment