Commit 2b716f5c authored by Lukas Marik's avatar Lukas Marik

#767 disable scroll in menu when menu is hidden, mouse wheel scroll in about...

#767 disable scroll in menu when menu is hidden, mouse wheel scroll in about screen and encyclopedia screen
parent a3cbf591
......@@ -447,6 +447,7 @@ public abstract class AbstractMenu extends Stack implements Disposable {
private void menuHidden() {
moveAction = null;
isClosing = false;
disableScroll(true);
}
void closeMenu(boolean animated, boolean force) {
......@@ -469,12 +470,15 @@ public abstract class AbstractMenu extends Stack implements Disposable {
setPosition(menuClosePositionX, menuPositionY);
menuClosed();
}
}else {
disableScroll(true);
}
}
private void menuClosed() {
moveAction = null;
isClosing = false;
disableScroll(true);
setMenuReady(SCENARIO_STEP_READY_MENU);
}
......@@ -498,15 +502,22 @@ public abstract class AbstractMenu extends Stack implements Disposable {
setPosition(menuOpenPositionX, menuPositionY);
menuOpened();
}
}else {
disableScroll(false);
}
}
private void menuOpened() {
moveAction = null;
isOpening = false;
disableScroll(false);
setMenuReady(SCENARIO_STEP_OPENED_MENU);
}
protected void disableScroll(boolean disable){
}
public void doMenuAction(MenuAction menuAction, boolean animated, boolean force) {
if (menuAction != null) {
menuAction.doAction(this, animated, force);
......
......@@ -56,6 +56,7 @@ public class MainMenu extends AbstractMenu {
private Map<IMenuItem, Group> subMenus = new HashMap<IMenuItem, Group>();
private VerticalGroup mainMenuVerticalGroup;
private ScrollPane scrollPane;
private Container scrollPaneContainer;
public MainMenu(Float width, Float height) {
......@@ -119,7 +120,7 @@ public class MainMenu extends AbstractMenu {
Table layoutTable = new Table();
UserSelectBox userSelectBox = new UserSelectBox(SELECTBOX_USER_HEIGHT);
ScrollPane scrollPane = new ScrollPane(mainMenuVerticalGroup);
scrollPane = new ScrollPane(mainMenuVerticalGroup);
scrollPaneContainer = new Container();
layoutTable.add(userSelectBox).fill().align(Align.top).pad(USER_SELECT_BOX_PADDING);
......@@ -156,6 +157,19 @@ public class MainMenu extends AbstractMenu {
ApplicationBus.getInstance().unsubscribe(this);
}
@Override
protected void disableScroll(boolean disable) {
if(scrollPane == null || scrollPane.isScrollY() == !disable)
return;
if(disable)
scrollPane.setScrollingDisabled(true,true);
else
scrollPane.setScrollingDisabled(true,false);
scrollPane.layout();
}
private InputListener menuTouchInputListener = new ClickListener() {
@Override
......
......@@ -97,6 +97,7 @@ public class UserMenu extends AbstractMenu {
private String lastSyncUUID;
private TablexiaComponentDialog syncDialog;
private UserUuidSyncDialogComponent uuidSyncDialogComponent;
private ScrollPane scrollPane;
public UserMenu(Float width, Float height) {
super(width, height);
......@@ -118,7 +119,7 @@ public class UserMenu extends AbstractMenu {
public void initMenuItems(Container<Group> layoutContainer) {
final VerticalGroup menuItemsLayout = new VerticalGroup();
final ScrollPane scrollPane = new ScrollPane(menuItemsLayout);
scrollPane = new ScrollPane(menuItemsLayout);
final Container<ScrollPane> container = new Container<ScrollPane>(scrollPane);
container.setFillParent(true);
final float userMenuItemWidth = getBackground().getWidth();
......@@ -380,6 +381,19 @@ public class UserMenu extends AbstractMenu {
ApplicationBus.getInstance().unsubscribe(this);
}
@Override
protected void disableScroll(boolean disable) {
if(scrollPane == null || scrollPane.isScrollY() == !disable)
return;
if(disable){
scrollPane.setScrollingDisabled(true,true);
}else {
scrollPane.setScrollingDisabled(true,false);
}
scrollPane.layout();
}
//////////////////////////// CREATE USER EVENT HANDLING
......
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