mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-28 15:55:58 +00:00
Fix scrollbar not following mouse (#1961)
* Fix scrollbar not following mouse * add /*deobfName*/
This commit is contained in:
1 parent
56d7568fd3
commit
3f4995466c
1 file changed
+16
-1
@@ -94,6 +94,21 @@ public abstract class IrisGuiSlot extends GuiSlot {
|
||||
if (leftMouseDown && mouseX >= scrollBarX && mouseX <= rightEdge) {
|
||||
scrolling = true;
|
||||
this.initialClickY = (float) mouseY;
|
||||
|
||||
int contentOverflow = this.func_148135_f/*getMaxScroll*/();
|
||||
if (contentOverflow < 1) {
|
||||
contentOverflow = 1;
|
||||
}
|
||||
|
||||
int scrollPosSize = (this.bottom - this.top) * (this.bottom - this.top) / this.getContentHeight();
|
||||
if (scrollPosSize < 32) {
|
||||
scrollPosSize = 32;
|
||||
}
|
||||
if (scrollPosSize > this.bottom - this.top - 8) {
|
||||
scrollPosSize = this.bottom - this.top - 8;
|
||||
}
|
||||
|
||||
this.scrollMultiplier = -1.0F / ((float) (this.bottom - this.top - scrollPosSize) / (float) contentOverflow);
|
||||
} else if ((leftMouseDown || rightMouseDown)) {
|
||||
final int index = relativeY / this.slotHeight;
|
||||
|
||||
@@ -128,7 +143,7 @@ public abstract class IrisGuiSlot extends GuiSlot {
|
||||
|
||||
// Scrollbar nonsense
|
||||
if (scrolling) {
|
||||
this.amountScrolled += ((float) mouseY - this.initialClickY);
|
||||
this.amountScrolled -= ((float) mouseY - this.initialClickY) * this.scrollMultiplier;
|
||||
this.initialClickY = mouseY;
|
||||
} else if (this.mc.currentScreen != null ){
|
||||
while (!this.mc.gameSettings.touchscreen && Mouse.next()) {
|
||||
|
||||
Reference in new issue
Block a user