mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-26 13:09:22 +01:00
Added better mouse controls to the booklet
This commit is contained in:
parent
0494da1fb6
commit
32a42643c9
3 changed files with 36 additions and 17 deletions
|
@ -335,7 +335,9 @@ public class BookletUtils{
|
|||
booklet.buttonBackward.visible = getPrevPage(booklet.currentEntrySet.chapter, booklet.currentEntrySet.page) != null;
|
||||
}
|
||||
else{
|
||||
openIndexEntry(booklet, booklet.currentEntrySet.entry, booklet.currentEntrySet.pageInIndex+1, !(booklet.currentEntrySet.entry instanceof BookletEntryAllSearch));
|
||||
if(booklet.currentEntrySet.pageInIndex+1 <= booklet.indexPageAmount){
|
||||
openIndexEntry(booklet, booklet.currentEntrySet.entry, booklet.currentEntrySet.pageInIndex+1, !(booklet.currentEntrySet.entry instanceof BookletEntryAllSearch));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -355,7 +357,9 @@ public class BookletUtils{
|
|||
booklet.buttonBackward.visible = getPrevPage(booklet.currentEntrySet.chapter, booklet.currentEntrySet.page) != null;
|
||||
}
|
||||
else{
|
||||
openIndexEntry(booklet, booklet.currentEntrySet.entry, booklet.currentEntrySet.pageInIndex-1, !(booklet.currentEntrySet.entry instanceof BookletEntryAllSearch));
|
||||
if(booklet.currentEntrySet.pageInIndex-1 > 0){
|
||||
openIndexEntry(booklet, booklet.currentEntrySet.entry, booklet.currentEntrySet.pageInIndex-1, !(booklet.currentEntrySet.entry instanceof BookletEntryAllSearch));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ import ellpeck.actuallyadditions.config.GuiConfiguration;
|
|||
import ellpeck.actuallyadditions.proxy.ClientProxy;
|
||||
import ellpeck.actuallyadditions.update.UpdateChecker;
|
||||
import ellpeck.actuallyadditions.util.AssetUtil;
|
||||
import ellpeck.actuallyadditions.util.KeyUtil;
|
||||
import ellpeck.actuallyadditions.util.ModUtil;
|
||||
import ellpeck.actuallyadditions.util.StringUtil;
|
||||
import ellpeck.actuallyadditions.util.playerdata.PersistentClientData;
|
||||
|
@ -34,6 +33,7 @@ import net.minecraft.util.EnumChatFormatting;
|
|||
import net.minecraft.util.IChatComponent;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -151,6 +151,21 @@ public class GuiBooklet extends GuiScreen{
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
//For scrolling through pages
|
||||
public void handleMouseInput(){
|
||||
int wheel = Mouse.getEventDWheel();
|
||||
if(wheel != 0){
|
||||
if(wheel > 0){
|
||||
BookletUtils.handleNextPage(this);
|
||||
}
|
||||
else if(wheel < 0){
|
||||
BookletUtils.handlePreviousPage(this);
|
||||
}
|
||||
}
|
||||
super.handleMouseInput();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyTyped(char theChar, int key){
|
||||
if(key == Keyboard.KEY_ESCAPE && this.parentScreen != null){
|
||||
|
@ -181,10 +196,19 @@ public class GuiBooklet extends GuiScreen{
|
|||
@Override
|
||||
protected void mouseClicked(int par1, int par2, int par3){
|
||||
this.searchField.mouseClicked(par1, par2, par3);
|
||||
//Notifys the booklet of the mouse being pressed
|
||||
//Left mouse button
|
||||
if(par3 == 0 && this.currentEntrySet.chapter != null){
|
||||
this.mousePressed = true;
|
||||
}
|
||||
//Right mouse button
|
||||
else if(par3 == 1){
|
||||
if(this.currentEntrySet.chapter != null){
|
||||
BookletUtils.openIndexEntry(this, this.currentEntrySet.entry, this.currentEntrySet.pageInIndex, true);
|
||||
}
|
||||
else{
|
||||
BookletUtils.openIndexEntry(this, null, 1, true);
|
||||
}
|
||||
}
|
||||
super.mouseClicked(par1, par2, par3);
|
||||
}
|
||||
|
||||
|
@ -220,16 +244,11 @@ public class GuiBooklet extends GuiScreen{
|
|||
}
|
||||
//Handles gonig from page to chapter or from chapter to index
|
||||
else if(button == this.buttonPreviousScreen){
|
||||
if(KeyUtil.isShiftPressed()){
|
||||
if(this.currentEntrySet.chapter != null){
|
||||
BookletUtils.openIndexEntry(this, this.currentEntrySet.entry, this.currentEntrySet.pageInIndex, true);
|
||||
}
|
||||
else{
|
||||
BookletUtils.openIndexEntry(this, null, 1, true);
|
||||
}
|
||||
if(this.currentEntrySet.chapter != null){
|
||||
BookletUtils.openIndexEntry(this, this.currentEntrySet.entry, this.currentEntrySet.pageInIndex, true);
|
||||
}
|
||||
else{
|
||||
//TODO History
|
||||
BookletUtils.openIndexEntry(this, null, 1, true);
|
||||
}
|
||||
}
|
||||
//Handles Bookmark button
|
||||
|
@ -253,11 +272,7 @@ public class GuiBooklet extends GuiScreen{
|
|||
this.buttonBackward = new TexturedButton(1, this.guiLeft+8, this.guiTop+this.ySize+1, 146, 0, 18, 10, Collections.singletonList(EnumChatFormatting.GOLD+"Previous Page"));
|
||||
this.buttonList.add(this.buttonBackward);
|
||||
|
||||
List prevScreenHover = new ArrayList<>();
|
||||
prevScreenHover.add(EnumChatFormatting.GOLD+"Back");
|
||||
prevScreenHover.add("Click for last item in history");
|
||||
prevScreenHover.add(EnumChatFormatting.ITALIC+"Shift-Click for Chapter");
|
||||
this.buttonPreviousScreen = new TexturedButton(2, this.guiLeft+this.xSize/2-7, this.guiTop+this.ySize+1, 182, 0, 15, 10, prevScreenHover);
|
||||
this.buttonPreviousScreen = new TexturedButton(2, this.guiLeft+this.xSize/2-7, this.guiTop+this.ySize+1, 182, 0, 15, 10, Collections.singletonList(EnumChatFormatting.GOLD+"Back"));
|
||||
this.buttonList.add(this.buttonPreviousScreen);
|
||||
|
||||
ArrayList updateHover = new ArrayList();
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
Loading…
Reference in a new issue