GuiElement interface's mouseClick method returns a boolean which is handled by ComposedElement to prevent mouse clicks on multiple elements at once
ComposedElement's entries are sorted so that GuiDropdown are always drawn on top Modified thrown UnsupportedOperationExceptions in CustomImageObject to not be thrown if asset is null
This commit is contained in:
@@ -16,14 +16,10 @@ import java.util.UUID;
|
|||||||
|
|
||||||
public class CustomImageObject implements GuiEntryListEntry {
|
public class CustomImageObject implements GuiEntryListEntry {
|
||||||
|
|
||||||
public CustomImageObject(String name, UUID assetUUID) {
|
public CustomImageObject(String name, UUID assetUUID) throws IOException {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
||||||
try {
|
|
||||||
setLinkedAsset(assetUUID);
|
setLinkedAsset(assetUUID);
|
||||||
} catch(Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter @Setter private String name;
|
@Getter @Setter private String name;
|
||||||
@@ -43,7 +39,7 @@ public class CustomImageObject implements GuiEntryListEntry {
|
|||||||
|
|
||||||
if(asset instanceof ReplayImageAsset) {
|
if(asset instanceof ReplayImageAsset) {
|
||||||
setImage(((ReplayImageAsset)asset).getObject());
|
setImage(((ReplayImageAsset)asset).getObject());
|
||||||
} else {
|
} else if(asset != null) {
|
||||||
throw new UnsupportedOperationException("A CustomImageObject requires a ReplayImageAsset");
|
throw new UnsupportedOperationException("A CustomImageObject requires a ReplayImageAsset");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,8 +141,12 @@ public class GuiObjectManager extends GuiScreen {
|
|||||||
addButton = new GuiAdvancedButton(0, 0, 0, 20, I18n.format("replaymod.gui.add"), new Runnable() {
|
addButton = new GuiAdvancedButton(0, 0, 0, 20, I18n.format("replaymod.gui.add"), new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
try {
|
||||||
CustomImageObject customImageObject = new CustomImageObject(I18n.format("replaymod.gui.objects.defaultname"), null);
|
CustomImageObject customImageObject = new CustomImageObject(I18n.format("replaymod.gui.objects.defaultname"), null);
|
||||||
objectList.addElement(customImageObject);
|
objectList.addElement(customImageObject);
|
||||||
|
} catch(IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, null);
|
}, null);
|
||||||
|
|
||||||
@@ -165,11 +169,44 @@ public class GuiObjectManager extends GuiScreen {
|
|||||||
CustomImageObject selectedObject = objectList.getElement(selectionIndex);
|
CustomImageObject selectedObject = objectList.getElement(selectionIndex);
|
||||||
if(selectedObject != null) {
|
if(selectedObject != null) {
|
||||||
disableElements.setEnabled(true);
|
disableElements.setEnabled(true);
|
||||||
|
|
||||||
|
nameInput.setText(selectedObject.getName());
|
||||||
|
|
||||||
|
//setting the dropdown value
|
||||||
|
int sel = 0;
|
||||||
|
if(selectedObject.getLinkedAsset() != null) {
|
||||||
|
int i = 0;
|
||||||
|
for(GuiEntryListValueEntry<UUID> entry : assetDropdown.getAllElements()) {
|
||||||
|
if(selectedObject.getLinkedAsset().equals(entry.getValue())) {
|
||||||
|
sel = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assetDropdown.setSelectionIndexQuietly(sel);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
disableElements.setEnabled(false);
|
disableElements.setEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
assetDropdown.addSelectionListener(new SelectionListener() {
|
||||||
|
@Override
|
||||||
|
public void onSelectionChanged(int selectionIndex) {
|
||||||
|
CustomImageObject selectedObject = objectList.getElement(objectList.getSelectionIndex());
|
||||||
|
GuiEntryListValueEntry<UUID> entry = assetDropdown.getElement(selectionIndex);
|
||||||
|
if(selectedObject != null && entry != null) {
|
||||||
|
try {
|
||||||
|
selectedObject.setLinkedAsset(entry.getValue());
|
||||||
|
} catch(IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] labelStrings = new String[] {
|
String[] labelStrings = new String[] {
|
||||||
@@ -200,12 +237,12 @@ public class GuiObjectManager extends GuiScreen {
|
|||||||
opacityInputs = new ComposedElement(opacityInput);
|
opacityInputs = new ComposedElement(opacityInput);
|
||||||
numberInputs = new ComposedElement(anchorInputs, positionInputs, scaleInputs, orientationInputs, opacityInputs);
|
numberInputs = new ComposedElement(anchorInputs, positionInputs, scaleInputs, orientationInputs, opacityInputs);
|
||||||
|
|
||||||
for(int i = numberInputs.getParts().length-1; i >= 0; i--) {
|
for(int i = numberInputs.getParts().size()-1; i >= 0; i--) {
|
||||||
int yPos = this.height-5-10-(25*(numberInputs.getParts().length-i));
|
int yPos = this.height-5-10-(25*(numberInputs.getParts().size()-i));
|
||||||
DelegatingElement button = keyframeButton(10, yPos, i);
|
DelegatingElement button = keyframeButton(10, yPos, i);
|
||||||
GuiString label = new GuiString(35, yPos + 6, Color.WHITE, labelStrings[i]);
|
GuiString label = new GuiString(35, yPos + 6, Color.WHITE, labelStrings[i]);
|
||||||
|
|
||||||
ComposedElement child = (ComposedElement)numberInputs.getParts()[i];
|
ComposedElement child = (ComposedElement)numberInputs.getParts().get(i);
|
||||||
int x = 0;
|
int x = 0;
|
||||||
for(GuiElement el : child.getParts()) {
|
for(GuiElement el : child.getParts()) {
|
||||||
GuiDraggingNumberInput dni = (GuiDraggingNumberInput)el;
|
GuiDraggingNumberInput dni = (GuiDraggingNumberInput)el;
|
||||||
@@ -318,6 +355,11 @@ public class GuiObjectManager extends GuiScreen {
|
|||||||
Point mousePos = MouseUtils.getMousePos();
|
Point mousePos = MouseUtils.getMousePos();
|
||||||
allElements.buttonPressed(mc, mousePos.getX(), mousePos.getY(), typedChar, keyCode);
|
allElements.buttonPressed(mc, mousePos.getX(), mousePos.getY(), typedChar, keyCode);
|
||||||
|
|
||||||
|
CustomImageObject selectedObject = objectList.getElement(objectList.getSelectionIndex());
|
||||||
|
if(selectedObject != null) {
|
||||||
|
selectedObject.setName(nameInput.getText().trim());
|
||||||
|
}
|
||||||
|
|
||||||
super.keyTyped(typedChar, keyCode);
|
super.keyTyped(typedChar, keyCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -364,14 +406,17 @@ public class GuiObjectManager extends GuiScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseClick(Minecraft mc, int mouseX, int mouseY, int button) {
|
public boolean mouseClick(Minecraft mc, int mouseX, int mouseY, int button) {
|
||||||
if(!enabled) return;
|
if(!enabled) return false;
|
||||||
super.mouseClick(mc, mouseX, mouseY, button);
|
super.mouseClick(mc, mouseX, mouseY, button);
|
||||||
int time = (int) getTimeAt(mouseX, mouseY);
|
int time = (int) getTimeAt(mouseX, mouseY);
|
||||||
if(time != -1) {
|
if(time != -1) {
|
||||||
cursorPosition = time;
|
cursorPosition = time;
|
||||||
dragging = true;
|
dragging = true;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -179,8 +179,8 @@ public class GuiReplaySpeedSlider extends GuiButton implements GuiElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseClick(Minecraft mc, int mouseX, int mouseY, int button) {
|
public boolean mouseClick(Minecraft mc, int mouseX, int mouseY, int button) {
|
||||||
mousePressed(mc, mouseX, mouseY);
|
return mousePressed(mc, mouseX, mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -3,23 +3,22 @@ package eu.crushedpixel.replaymod.gui.elements;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
public class ComposedElement implements GuiElement {
|
public class ComposedElement implements GuiElement {
|
||||||
|
|
||||||
|
private static final ComposedElementComparator COMPOSED_ELEMENT_COMPARATOR = new ComposedElementComparator();
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private GuiElement[] parts;
|
private List<GuiElement> parts = new ArrayList<GuiElement>();
|
||||||
|
|
||||||
public ComposedElement(GuiElement...parts) {
|
public ComposedElement(GuiElement...parts) {
|
||||||
this.parts = parts;
|
this.parts = new ArrayList<GuiElement>(Arrays.asList(parts));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPart(GuiElement part) {
|
public void addPart(GuiElement part) {
|
||||||
GuiElement[] newParts = new GuiElement[parts.length+1];
|
parts.add(part);
|
||||||
int i = 0;
|
Collections.sort(parts, COMPOSED_ELEMENT_COMPARATOR);
|
||||||
for(GuiElement e : parts) {
|
|
||||||
newParts[i] = e;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
newParts[i] = part;
|
|
||||||
this.parts = newParts;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -47,10 +46,14 @@ public class ComposedElement implements GuiElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseClick(Minecraft mc, int mouseX, int mouseY, int button) {
|
public boolean mouseClick(Minecraft mc, int mouseX, int mouseY, int button) {
|
||||||
for (GuiElement part : parts) {
|
boolean clicked = false;
|
||||||
part.mouseClick(mc, mouseX, mouseY, button);
|
//iterate over elements in reverse order to first handle mouse clicks of elements that are drawn on top
|
||||||
|
for (int i=0; i<parts.size(); i++) {
|
||||||
|
clicked = parts.get(parts.size()-1-i).mouseClick(mc, mouseX, mouseY, button);
|
||||||
|
if(clicked) break;
|
||||||
}
|
}
|
||||||
|
return clicked;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -87,4 +90,20 @@ public class ComposedElement implements GuiElement {
|
|||||||
part.setEnabled(enabled);
|
part.setEnabled(enabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class ComposedElementComparator implements Comparator<GuiElement> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(GuiElement o1, GuiElement o2) {
|
||||||
|
Boolean d1 = o1 instanceof GuiDropdown;
|
||||||
|
Boolean d2 = o2 instanceof GuiDropdown;
|
||||||
|
|
||||||
|
return d1.compareTo(d2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ public abstract class DelegatingElement implements GuiElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseClick(Minecraft mc, int mouseX, int mouseY, int button) {
|
public boolean mouseClick(Minecraft mc, int mouseX, int mouseY, int button) {
|
||||||
delegate().mouseClick(mc, mouseX, mouseY, button);
|
return delegate().mouseClick(mc, mouseX, mouseY, button);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -52,10 +52,12 @@ public class GuiAdvancedButton extends GuiButton implements GuiElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseClick(Minecraft mc, int mouseX, int mouseY, int button) {
|
public boolean mouseClick(Minecraft mc, int mouseX, int mouseY, int button) {
|
||||||
if (isHovering(mouseX, mouseY)) {
|
if (isHovering(mouseX, mouseY)) {
|
||||||
performAction();
|
performAction();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ public class GuiAdvancedCheckBox extends GuiCheckBox implements GuiElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseClick(Minecraft mc, int mouseX, int mouseY, int button) {
|
public boolean mouseClick(Minecraft mc, int mouseX, int mouseY, int button) {
|
||||||
mousePressed(mc, mouseX, mouseY);
|
return mousePressed(mc, mouseX, mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -67,8 +67,9 @@ public class GuiAdvancedTextField extends GuiTextField implements GuiElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseClick(Minecraft mc, int mouseX, int mouseY, int button) {
|
public boolean mouseClick(Minecraft mc, int mouseX, int mouseY, int button) {
|
||||||
mouseClicked(mouseX, mouseY, button);
|
mouseClicked(mouseX, mouseY, button);
|
||||||
|
return isHovering(mouseX, mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -23,12 +23,14 @@ public class GuiDraggingNumberInput extends GuiNumberInputWithText {
|
|||||||
private boolean clicked;
|
private boolean clicked;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseClick(Minecraft mc, int mouseX, int mouseY, int button) {
|
public boolean mouseClick(Minecraft mc, int mouseX, int mouseY, int button) {
|
||||||
if(MouseUtils.isMouseWithinBounds(xPosition, yPosition, width, height) && isEnabled) {
|
if(MouseUtils.isMouseWithinBounds(xPosition, yPosition, width, height) && isEnabled) {
|
||||||
dragging = false;
|
dragging = false;
|
||||||
clicked = true;
|
clicked = true;
|
||||||
prevMouseX = mouseX;
|
prevMouseX = mouseX;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -133,11 +133,10 @@ public class GuiDropdown<T extends GuiEntryListEntry> extends GuiAdvancedTextFie
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked(int xPos, int yPos, int mouseButton) {
|
public boolean mouseClick(Minecraft mc, int mouseX, int mouseY, int button) {
|
||||||
mouseClickedResult(xPos, yPos);
|
return mouseClickedResult(mouseX, mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean mouseClickedResult(int xPos, int yPos) {
|
public boolean mouseClickedResult(int xPos, int yPos) {
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
if(!isEnabled) return success;
|
if(!isEnabled) return success;
|
||||||
@@ -202,9 +201,18 @@ public class GuiDropdown<T extends GuiEntryListEntry> extends GuiAdvancedTextFie
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setSelectionIndex(int index) {
|
public void setSelectionIndex(int index) {
|
||||||
|
setSelectionIndexQuietly(index);
|
||||||
|
fireSelectionChangeEvent();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the selection index without notifying SelectionChangeListeners.
|
||||||
|
* @param index The Selection Index
|
||||||
|
*/
|
||||||
|
public void setSelectionIndexQuietly(int index) {
|
||||||
this.selectionIndex = index;
|
this.selectionIndex = index;
|
||||||
if(selectionIndex < 0) selectionIndex = -1;
|
if(selectionIndex < 0) selectionIndex = -1;
|
||||||
fireSelectionChangeEvent();
|
if(selectionIndex >= elements.size()) selectionIndex = elements.size()-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fireSelectionChangeEvent() {
|
private void fireSelectionChangeEvent() {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ public interface GuiElement {
|
|||||||
|
|
||||||
boolean isHovering(int mouseX, int mouseY);
|
boolean isHovering(int mouseX, int mouseY);
|
||||||
|
|
||||||
void mouseClick(Minecraft mc, int mouseX, int mouseY, int button);
|
boolean mouseClick(Minecraft mc, int mouseX, int mouseY, int button);
|
||||||
void mouseDrag(Minecraft mc, int mouseX, int mouseY, int button);
|
void mouseDrag(Minecraft mc, int mouseX, int mouseY, int button);
|
||||||
void mouseRelease(Minecraft mc, int mouseX, int mouseY, int button);
|
void mouseRelease(Minecraft mc, int mouseX, int mouseY, int button);
|
||||||
|
|
||||||
|
|||||||
@@ -61,12 +61,14 @@ public class GuiScrollbar extends Gui implements GuiElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseClick(Minecraft mc, int mouseX, int mouseY, int button) {
|
public boolean mouseClick(Minecraft mc, int mouseX, int mouseY, int button) {
|
||||||
if(!enabled) return;
|
if(!enabled) return false;
|
||||||
if (isHovering(mouseX, mouseY)) {
|
if (isHovering(mouseX, mouseY)) {
|
||||||
draggingStart = mouseX;
|
draggingStart = mouseX;
|
||||||
draggingStartPosition = sliderPosition;
|
draggingStartPosition = sliderPosition;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ public class GuiString extends Gui implements GuiElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseClick(Minecraft mc, int mouseX, int mouseY, int button) {
|
public boolean mouseClick(Minecraft mc, int mouseX, int mouseY, int button) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -470,7 +470,7 @@ public class GuiTextArea extends Gui implements GuiElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseClick(Minecraft mc, int mouseX, int mouseY, int button) {
|
public boolean mouseClick(Minecraft mc, int mouseX, int mouseY, int button) {
|
||||||
boolean hovering = isHovering(mouseX, mouseY);
|
boolean hovering = isHovering(mouseX, mouseY);
|
||||||
|
|
||||||
if (hovering && isFocused() && button == 0) {
|
if (hovering && isFocused() && button == 0) {
|
||||||
@@ -486,6 +486,7 @@ public class GuiTextArea extends Gui implements GuiElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setFocused(hovering);
|
setFocused(hovering);
|
||||||
|
return hovering;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -32,13 +32,13 @@ public class GuiKeyframeTimeline extends GuiTimeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseClick(Minecraft mc, int mouseX, int mouseY, int button) {
|
public boolean mouseClick(Minecraft mc, int mouseX, int mouseY, int button) {
|
||||||
if(!enabled) return;
|
if(!enabled) return false;
|
||||||
//left mouse button
|
//left mouse button
|
||||||
if(button == 0) {
|
if(button == 0) {
|
||||||
long time = getTimeAt(mouseX, mouseY);
|
long time = getTimeAt(mouseX, mouseY);
|
||||||
if(time == -1) {
|
if(time == -1) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tolerance = (int) (2 * Math.round(zoom * timelineLength / width));
|
int tolerance = (int) (2 * Math.round(zoom * timelineLength / width));
|
||||||
@@ -71,6 +71,8 @@ public class GuiKeyframeTimeline extends GuiTimeline {
|
|||||||
this.clickTime = currentTime;
|
this.clickTime = currentTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return isHovering(mouseX, mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -24,14 +24,14 @@ public class GuiMarkerTimeline extends GuiTimeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseClick(Minecraft mc, int mouseX, int mouseY, int button) {
|
public boolean mouseClick(Minecraft mc, int mouseX, int mouseY, int button) {
|
||||||
if(!enabled) return;
|
if(!enabled) return false;
|
||||||
|
|
||||||
//left mouse button
|
//left mouse button
|
||||||
if(button == 0) {
|
if(button == 0) {
|
||||||
long time = getTimeAt(mouseX, mouseY);
|
long time = getTimeAt(mouseX, mouseY);
|
||||||
if(time == -1) {
|
if(time == -1) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tolerance = (int) (2 * Math.round(zoom * timelineLength / width));
|
int tolerance = (int) (2 * Math.round(zoom * timelineLength / width));
|
||||||
@@ -66,7 +66,7 @@ public class GuiMarkerTimeline extends GuiTimeline {
|
|||||||
|
|
||||||
long time = getTimeAt(mouseX, mouseY);
|
long time = getTimeAt(mouseX, mouseY);
|
||||||
if(time == -1) {
|
if(time == -1) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tolerance = (int) (2 * Math.round(zoom * timelineLength / width));
|
int tolerance = (int) (2 * Math.round(zoom * timelineLength / width));
|
||||||
@@ -82,6 +82,8 @@ public class GuiMarkerTimeline extends GuiTimeline {
|
|||||||
ReplayMod.replaySender.jumpToTime(closest.getRealTimestamp());
|
ReplayMod.replaySender.jumpToTime(closest.getRealTimestamp());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return isHovering(mouseX, mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -222,8 +222,8 @@ public class GuiTimeline extends Gui implements GuiElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseClick(Minecraft mc, int mouseX, int mouseY, int button) {
|
public boolean mouseClick(Minecraft mc, int mouseX, int mouseY, int button) {
|
||||||
|
return isHovering(mouseX, mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user