forked from RepoMirrors/kami-blue
Made scroll bars always visible to avoid confusion.
Some code cleanup too.
This commit is contained in:
parent
2909debee8
commit
3a9b2571f2
|
@ -35,7 +35,7 @@ public class RootScrollpaneUI extends AbstractComponentUI<Scrollpane> {
|
|||
component.addMouseListener(new MouseListener() {
|
||||
@Override
|
||||
public void onMouseDown(MouseButtonEvent event) {
|
||||
if (System.currentTimeMillis() - lastScroll < barLife && scrollComponent.liesIn(component) && component.canScrollY()) {
|
||||
if (component.canScrollY()) {
|
||||
double progress = (double) component.getScrolledY() / (double) component.getMaxScrollY();
|
||||
int barHeight = 30;
|
||||
int y = (int) ((component.getHeight() - barHeight) * progress);
|
||||
|
@ -82,9 +82,9 @@ public class RootScrollpaneUI extends AbstractComponentUI<Scrollpane> {
|
|||
|
||||
@Override
|
||||
public void onPostRender() {
|
||||
if (dragBar)
|
||||
lastScroll = System.currentTimeMillis();
|
||||
if (System.currentTimeMillis() - lastScroll < barLife && scrollComponent.liesIn(component) && component.canScrollY()) {
|
||||
lastScroll = System.currentTimeMillis();
|
||||
|
||||
if (component.canScrollY()) {
|
||||
float alpha = Math.min(1, (barLife - (System.currentTimeMillis() - lastScroll)) / 100f) / 3f;
|
||||
if (dragBar) alpha = 0.4f;
|
||||
GL11.glColor4f(toF(GuiC.scrollBar.color.getRed()), toF(GuiC.scrollBar.color.getGreen()), toF(GuiC.scrollBar.color.getBlue()), alpha);
|
||||
|
|
|
@ -51,16 +51,14 @@ public class Scrollpane extends OrganisedContainer {
|
|||
public void onPreRender() {
|
||||
translatex = scrolledX;
|
||||
translatey = scrolledY;
|
||||
//GL11.glTranslatef(-translatex, -translatey, 0);
|
||||
int[] real = GUI.calculateRealPosition(Scrollpane.this);
|
||||
int scale = DisplayGuiScreen.getScale();
|
||||
GL11.glScissor(getX() * scale + real[0] * scale - ((Container) getParent()).getOriginOffsetX() - 1, Display.getHeight() - getHeight() * scale - real[1] * scale - 1, getWidth() * scale + ((Container) getParent()).getOriginOffsetX() * scale + 1, getHeight() * scale + 1);
|
||||
GL11.glScissor(getX() * scale + real[0] * scale - getParent().getOriginOffsetX() - 1, Display.getHeight() - getHeight() * scale - real[1] * scale - 1, getWidth() * scale + getParent().getOriginOffsetX() * scale + 1, getHeight() * scale + 1);
|
||||
GL11.glEnable(GL11.GL_SCISSOR_TEST);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPostRender() {
|
||||
//GL11.glTranslatef(translatex, translatey, 0);
|
||||
GL11.glDisable(GL11.GL_SCISSOR_TEST);
|
||||
}
|
||||
});
|
||||
|
@ -175,14 +173,6 @@ public class Scrollpane extends OrganisedContainer {
|
|||
return doScrollY;
|
||||
}
|
||||
|
||||
public void setDoScrollY(boolean doScrollY) {
|
||||
this.doScrollY = doScrollY;
|
||||
}
|
||||
|
||||
public void setDoScrollX(boolean doScrollX) {
|
||||
this.doScrollX = doScrollX;
|
||||
}
|
||||
|
||||
public void setScrolledX(int scrolledX) {
|
||||
int a = getScrolledX();
|
||||
this.scrolledX = scrolledX;
|
||||
|
|
Loading…
Reference in New Issue