Fix items not clickable in the crafting station #1629
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What:
My fix for slots inside a scrollable list #1558 has broken the item list tab in the crafting station.
The reason is that the new check for isWidgetClickable() uses isBoxInsideScissor().
isBoxInsideScissor() requires the whole widget to be inside the scissor because it checks both the top left and bottom right corners are inside the scissor.
For the crafting station it is even worse, because the item list tab actually has each row of items (a widget group) as the direct subwidget of the scrollable list widget. And the way it is setup, the bottom right corner of that group was not considered inside the scissor because it overlaps the scroll bar.
How solved:
Changed isWidgetClickable() to use a new method that only requires one of the 4 corners to be inside the scissor.
This matches the logic added to SlotWidget.isEnabled() where it checks the scissor overlaps the rectangle of the widget, rather than requiring the whole widget to be inside the scissor.
Outcome:
You can correctly click items in the crafting station's item list tab again.