Just Enough Calculation

Just Enough Calculation

11M Downloads

Sometimes disambiguate setting can't scroll

Discreater opened this issue ยท 2 comments

commented

Version: 1.16.5
And the slot under the overlay hovered incorrectly
jeca

commented

It seems caused by the getLabelUnderMouse function doesn't check the overlay.

@Override
public WLabel getLabelUnderMouse(int xMouse, int yMouse) {
return mouseIn(xMouse, yMouse) ? this : null;
}

@Override
public WLabel getLabelUnderMouse(int xMouse, int yMouse) {
return new Utilities.ReversedIterator<>(widgets).stream()
.map(i -> i.getLabelUnderMouse(xMouse, yMouse))
.filter(Objects::nonNull)
.findFirst().orElse(null);
}

So, when recipe gui handling the mouse scroll event, it will get the label under the overlay.

@Override
public boolean onMouseScroll(JecaGui gui, int xMouse, int yMouse, int diff) {
WLabel w = getLabelUnderMouse(xMouse, yMouse);
if (w == null) return super.onMouseScroll(gui, xMouse, yMouse, diff);
ILabel l = w.getLabel();
for (int i = 0; i < Math.abs(diff); i++)
l = diff > 0 ? l.increaseAmount() : l.decreaseAmount();
w.setLabel(l, true);
return true;
}

commented

As I remember, the overlay is basically a widget at the top of the widget list. So every user input will get handled by the overlay first. If the overlay can handle it (mouse inside overlay area), it will not pass to underlaying widgets.

I guess I'm doing something wrong with mouse positon offsetting. So the input is not at the position of expected widget.

Never mind, I'll check it.