shpaass / yafc-ce

Powerful Factorio calculator/analyser that works with mods
GNU General Public License v3.0
54 stars 20 forks source link

Fix PageSearch scrollbar #176

Closed veger closed 3 months ago

veger commented 3 months ago

gui.SetTextInputFocus was setting gui.mouseDownRect, which is heavily used by scrollbars to detect is the mouse is still inside the scrollbar rect when dragging.

Since the PageSearch focus gets updated every (build) event, the mouseDownRect was effectively always set to the search input, and the scrollbar could not be dragged as it detected that the mouse was not in the correct Rect anymore.

I fixes the issue by introducing a gui.focusRect, so these Rects are tracked independently. Both typing text, as well as dragging the PageSearch scrollbar seem to be working now.

I (quickly) checked some other input fields, but did not see any regressions.

(The other commit is a small cleanup that I encountered while debugging this issue)

Fixes #168