Merge branch 'master' of github.com:kami-blue/client

This commit is contained in:
S-B99 2020-04-05 18:51:54 -04:00
commit 74bf828a85
No known key found for this signature in database
GPG Key ID: 815562EA23BFE344
2 changed files with 5 additions and 15 deletions

View File

@ -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);

View File

@ -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;