option menu: don't subtract nav bar size from width and fix width on 4:3 aspect ratio, don't overscroll when clicking on a category
This commit is contained in:
parent
02632deff0
commit
7a51828102
|
@ -47,7 +47,7 @@ public class KineticScrolling {
|
||||||
private float totalDelta;
|
private float totalDelta;
|
||||||
|
|
||||||
/** The maximum and minimum value the position can reach. */
|
/** The maximum and minimum value the position can reach. */
|
||||||
private float max = Float.MAX_VALUE, min = -Float.MAX_VALUE;
|
public float max = Float.MAX_VALUE, min = -Float.MAX_VALUE;
|
||||||
|
|
||||||
/** Whether the mouse is currently pressed or not. */
|
/** Whether the mouse is currently pressed or not. */
|
||||||
private boolean pressed = false;
|
private boolean pressed = false;
|
||||||
|
|
|
@ -467,7 +467,7 @@ public class DisplayContainer implements ErrorDumpable, ResolutionChangedListene
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isWidescreen() {
|
public boolean isWidescreen() {
|
||||||
return width * 1000 / height == 1777; // 16:9
|
return width * 1000 / height > 1500; // 1777 = 16:9, 1333 = 4:3
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -184,11 +184,12 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||||
public void revalidate() {
|
public void revalidate() {
|
||||||
super.revalidate();
|
super.revalidate();
|
||||||
|
|
||||||
targetWidth = Math.max((int) (displayContainer.width * 0.36f), 340); // 0.321f
|
boolean isWidescreen = displayContainer.isWidescreen();
|
||||||
|
targetWidth = (int) (displayContainer.width * (isWidescreen ? 0.4f : 0.5f));
|
||||||
height = displayContainer.height;
|
height = displayContainer.height;
|
||||||
|
|
||||||
// calculate positions
|
// calculate positions
|
||||||
float navIconWidthRatio = displayContainer.isWidescreen() ? 0.046875f : 0.065f;
|
float navIconWidthRatio = isWidescreen ? 0.046875f : 0.065f;
|
||||||
// non-widescreen ratio is not accurate
|
// non-widescreen ratio is not accurate
|
||||||
navButtonSize = (int) (displayContainer.width * navIconWidthRatio);
|
navButtonSize = (int) (displayContainer.width * navIconWidthRatio);
|
||||||
navIndicatorSize = navButtonSize / 10;
|
navIndicatorSize = navButtonSize / 10;
|
||||||
|
@ -869,6 +870,7 @@ public class OptionsOverlay extends OverlayOpsuState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sectionPosition = Utils.clamp(sectionPosition, (int) scrollHandler.min, (int) scrollHandler.max);
|
||||||
scrollHandler.scrollToPosition(sectionPosition);
|
scrollHandler.scrollToPosition(sectionPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user