mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-27 17:28:41 +00:00
Restore pre-5.9.0-dev behavior of touch_use_crosshair=false shootline (#14389)
* Fix incorrect shootline after releasing pointer if touch_use_crosshair=false This happened because Android reuses pointer IDs. Also includes a refactor to merge "m_known_ids" and "m_pointer_pos". * Restore pre-5.9.0-dev behavior of shootline when !m_has_move_id
This commit is contained in:
parent
492aab20fe
commit
57de599a29
2 changed files with 17 additions and 34 deletions
|
@ -246,6 +246,8 @@ private:
|
|||
size_t m_move_id;
|
||||
bool m_move_has_really_moved = false;
|
||||
u64 m_move_downtime = 0;
|
||||
// m_move_pos stays valid even after m_move_id has been released.
|
||||
v2s32 m_move_pos;
|
||||
|
||||
bool m_has_joystick_id = false;
|
||||
size_t m_joystick_id;
|
||||
|
@ -281,16 +283,6 @@ private:
|
|||
const rect<s32> &button_rect, int texture_id,
|
||||
bool visible = true);
|
||||
|
||||
struct id_status
|
||||
{
|
||||
size_t id;
|
||||
int X;
|
||||
int Y;
|
||||
};
|
||||
|
||||
// vector to store known ids and their initial touch positions
|
||||
std::vector<id_status> m_known_ids;
|
||||
|
||||
// handle a button event
|
||||
void handleButtonEvent(touch_gui_button_id bID, size_t eventID, bool action);
|
||||
|
||||
|
@ -303,7 +295,7 @@ private:
|
|||
// apply joystick status
|
||||
void applyJoystickStatus();
|
||||
|
||||
// array for saving last known position of a pointer
|
||||
// map to store the IDs and positions of currently pressed pointers
|
||||
std::unordered_map<size_t, v2s32> m_pointer_pos;
|
||||
|
||||
// settings bar
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue