use of de.johni0702.minecraft.gui.utils.lwjgl.ReadablePoint in project jGui by ReplayMod.
the class AbstractGuiHorizontalScrollbar method mouseRelease.
@Override
public boolean mouseRelease(ReadablePoint position, int button) {
if (dragging) {
Point pos = new Point(position);
if (getContainer() != null) {
getContainer().convertFor(this, pos);
}
updateValue(pos);
dragging = false;
startDragging = null;
return true;
} else {
return false;
}
}
use of de.johni0702.minecraft.gui.utils.lwjgl.ReadablePoint in project jGui by ReplayMod.
the class AbstractGuiHorizontalScrollbar method mouseDrag.
@Override
public boolean mouseDrag(ReadablePoint position, int button, long timeSinceLastCall) {
if (dragging) {
Point pos = new Point(position);
if (getContainer() != null) {
getContainer().convertFor(this, pos);
}
updateValue(pos);
}
return dragging;
}
use of de.johni0702.minecraft.gui.utils.lwjgl.ReadablePoint in project jGui by ReplayMod.
the class AbstractGuiSlider method mouseRelease.
@Override
public boolean mouseRelease(ReadablePoint position, int button) {
if (dragging) {
dragging = false;
Point pos = new Point(position);
if (getContainer() != null) {
getContainer().convertFor(this, pos);
}
updateValue(pos);
return true;
} else {
return false;
}
}
use of de.johni0702.minecraft.gui.utils.lwjgl.ReadablePoint in project jGui by ReplayMod.
the class AbstractGuiSlider method updateValue.
protected void updateValue(ReadablePoint position) {
if (getLastSize() == null) {
return;
}
int width = getLastSize().getWidth() - 8;
int pos = Math.max(0, Math.min(width, position.getX() - 4));
setValue(steps * pos / width);
}
use of de.johni0702.minecraft.gui.utils.lwjgl.ReadablePoint in project jGui by ReplayMod.
the class AbstractGuiSlider method mouseClick.
@Override
public boolean mouseClick(ReadablePoint position, int button) {
Point pos = new Point(position);
if (getContainer() != null) {
getContainer().convertFor(this, pos);
}
if (isMouseHovering(pos) && isEnabled()) {
updateValue(pos);
dragging = true;
return true;
}
return false;
}
Aggregations