Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix input lock issue when drag scrolling on a Tree element on touchscreen devices #94422

Merged
merged 1 commit into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions scene/gui/tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions scene/gui/tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,8 @@ class Tree : public Control {

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;
Expand Down
Loading