Merge pull request #94422 from m4gr3d/fix_input_locking_issue

Fix input lock issue when drag scrolling on a `Tree` element on touchscreen devices
This commit is contained in:
Rémi Verschelde 2024-07-18 15:38:17 +02:00
commit 7d71b4be37
No known key found for this signature in database
GPG key ID: C3336907360768E1
2 changed files with 20 additions and 0 deletions

View file

@ -5440,6 +5440,24 @@ int Tree::get_drop_section_at_position(const Point2 &p_pos) const {
return -100;
}
bool Tree::can_drop_data(const Point2 &p_point, const Variant &p_data) const {
if (drag_touching) {
// Disable data drag & drop when touch dragging.
return false;
}
return Control::can_drop_data(p_point, p_data);
}
Variant Tree::get_drag_data(const Point2 &p_point) {
if (drag_touching) {
// Disable data drag & drop when touch dragging.
return Variant();
}
return Control::get_drag_data(p_point);
}
TreeItem *Tree::get_item_at_position(const Point2 &p_pos) const {
if (root) {
Point2 pos = p_pos;

View file

@ -698,6 +698,8 @@ public:
virtual String get_tooltip(const Point2 &p_pos) const override;
virtual bool can_drop_data(const Point2 &p_point, const Variant &p_data) const override;
virtual Variant get_drag_data(const Point2 &p_point) override;
TreeItem *get_item_at_position(const Point2 &p_pos) const;
int get_column_at_position(const Point2 &p_pos) const;
int get_drop_section_at_position(const Point2 &p_pos) const;