Just Enough Items (JEI)

Just Enough Items (JEI)

392M Downloads

Inserting recipes with JEI's "+" button not working properly

recon88 opened this issue · 11 comments

commented

I'm encountering a weird issue with JEI and Occultism

Video (explains it perfectly): https://www.youtube.com/watch?v=wpoYstoayqY

Clicking the "+" seems to be doing another left-click on it's own after releasing the mouse button.
If I hold the left mouse button after clicking "+" and move the cursor away from JEI's item list, it inserts the recipe properly and doesn't open the recipe window again. If I keep holding and move to another recipe, it opens that one's crafting windows after releasing the button.

Both mods are the latest available version.

Ticket at Occultism's tracker in case they have to fix something on their end:
klikli-dev/occultism#213

commented

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

commented

Thanks for the report!
Unfortunately I'm not able to reproduce this with JEI alone. Clicking the button seems to cancel the click event, so nothing else should be able to use it after.
I wonder if there is something strange with Occultism's GUI that makes JEI fall back into a different mode of button handling.

commented

@mezz I'll look into it on my end (Occultism). I'm not really doing anything special in the UI or with the events as far as I recall, but something has to cause it after all.

commented

Thanks, let me know what you find. Worst-case I can load up Occultism in my dev environment and try stepping through with a debugger when I get a chance.

commented

So the explanation seems to be quite mundane, nothing is wrong with event handling.
In certain aspect ratios the different widths of the occultism storage UI and the JEI recipe preview UI lead to a resize of the JEI item pane between mouse down and mouse up.

Due to the different width of the occultism storage UI vs the JEI recipe preview the mouse down and mouse up events land on different UIs, that's why mouse up is not being consumed, because it never even reaches the JEI recipe preview.

Mouse down on the "plus" button in the JEI recipe view closes the recipe view and switches back to the underlying occultism UI.
As visible in the screenshots below the JEI item view then resizes to match occultism UI, at which point the mouse is over another block (you can trace a line straight from the plus button down to the oak wood in the second screenshot). The subsequent mouse-up event over that block then triggers a new JEI recipe view.

By clicking and holding the "plus" button this can be slowed down and analyzed in detail:

java_h2DBhn5RXH
java_78pTXF6drS

@mezz what do you think is a good way to go about solving this? I can try to resize my UI, but as it currently works it only happens on some aspect ratios (eg. 16:9 which is my default it doesn't happen on).
Is there a good way for my UI to force JEI's item pane into a consistent size? Or can something be done on the input event level without interfering with your other functionality?

commented

I think ideally button clicks should detect mouse down, and then only execute on mouse up if the mouse is still on it. If JEI followed that pattern for the recipe transfer button, I think that would solve this issue.

commented

As a workaround you can set your GUI width a bit larger. It shouldn't affect rendering, but JEI will try to stay out of the way if it thinks the GUI is there, so you can control its position that way.

commented

I pushed an update for JEI (version .88), can you try it out and see if it fixes this issue?

I'll test it and report back - thanks for the effort!

commented

@mezz That did it, it seems :) Can't reproduce it on my end any more, when clicking the "+" the recipe UI does not close and consumes the mouse up. Thanks a lot!

commented

I pushed an update for JEI (version .88), can you try it out and see if it fixes this issue?

commented

Great, thanks!