A bug in simutrans? The coordinates for the mouse pointer should be the same as the ones in the lower right corner as these are the only ones the code uses. (When dragging a bridge there is a temporary bridge ground existing though.)
If I move the mouse from the other side, the field above the river is returned for the slope field.
is_work_allowed_here() (https://doc.simutrans-germany.com/Simutrans-Squirrel-API/group__quick__return__func.html#ga4e79ca4788f47895ceedbd72d518bd0e)
The function description includes a note. It's possible that this behavior is what's meant by that note.
Quote...
Attention
Does not work with waybuilding and all tools that need path-finding, use the functions provided in rules in this case.
...
It's possible that the function `is_valid_pos() (https://doc.simutrans-germany.com/Simutrans-Squirrel-API/group__quick__return__func.html#gab439c7cd0533a77204c49910ec50851d)` can be used. However, I don't yet know how to use it.
During pathfinding, is_work_allowd_here() is called for all tiles of the path. So of course also for the bottom of the river and all tiles in between. (And for way building even more tiles.)
Excatly for this reason there is forbid_way_tool_rect()/allow_way_tool_rect() ...