Created CustomObjectRepository which can be serialized by Gson, storing all CustomImageObjects created
CustomObjectRepository is now being saved to and loaded from the ReplayFile The CustomObjectRenderer uses the GuiObjectManager's timeline cursor position as interpolation timestamp for the CustomImageObjects which are drawn if a GuiObjectManager is open (instant preview) KeyframeList's add() method now removes Keyframes with the same timestamp before adding the new Keyframe Transformations class now holds default values to prevent NullPointerExceptions in methods calling getTransformationForTimestamp() Added Javadoc to Transformation POJO Created NumberValueChangeListener which can be applied to GuiNumberInput objects Made step size customizable in GuiDraggingNumberInput Changing a ReplayImageAssets image now notifies the CustomImageObjects linked to that asset Modified RoundUtils to provide a round() method which uses the DecimalFormat class instead of Math.round which is unstable
This commit is contained in:
@@ -9,19 +9,23 @@ public class GuiDraggingNumberInput extends GuiNumberInputWithText {
|
||||
|
||||
public GuiDraggingNumberInput(FontRenderer fontRenderer,
|
||||
int xPos, int yPos, int width, Double minimum, Double maximum, Double defaultValue, boolean acceptFloats) {
|
||||
this(fontRenderer, xPos, yPos, width, minimum, maximum, defaultValue, acceptFloats, "");
|
||||
this(fontRenderer, xPos, yPos, width, minimum, maximum, defaultValue, acceptFloats, "", 0.5f);
|
||||
}
|
||||
|
||||
public GuiDraggingNumberInput(FontRenderer fontRenderer,
|
||||
int xPos, int yPos, int width, Double minimum,
|
||||
Double maximum, Double defaultValue, boolean acceptFloats, String suffix) {
|
||||
Double maximum, Double defaultValue, boolean acceptFloats, String suffix, double stepSize) {
|
||||
super(fontRenderer, xPos, yPos, width, minimum, maximum, defaultValue, acceptFloats, suffix);
|
||||
|
||||
this.stepSize = stepSize;
|
||||
}
|
||||
|
||||
private int prevMouseX;
|
||||
private boolean dragging;
|
||||
private boolean clicked;
|
||||
|
||||
private double stepSize;
|
||||
|
||||
@Override
|
||||
public boolean mouseClick(Minecraft mc, int mouseX, int mouseY, int button) {
|
||||
if(MouseUtils.isMouseWithinBounds(xPosition, yPosition, width, height) && isEnabled) {
|
||||
@@ -40,16 +44,10 @@ public class GuiDraggingNumberInput extends GuiNumberInputWithText {
|
||||
int diff = mouseX - prevMouseX;
|
||||
prevMouseX = mouseX;
|
||||
|
||||
int bounds = 100;
|
||||
|
||||
if(minimum != null && maximum != null) {
|
||||
bounds = (int)(maximum-minimum);
|
||||
}
|
||||
|
||||
double value = getPreciseValue();
|
||||
double valueDiff = RoundUtils.round2Decimals((diff / 200f) * bounds);
|
||||
double valueDiff = diff * stepSize;
|
||||
|
||||
this.setValue(value+valueDiff);
|
||||
this.setValue(RoundUtils.round2Decimals(value + valueDiff));
|
||||
}
|
||||
super.mouseDrag(mc, mouseX, mouseY, button);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user