Skip to content

Support item hovering state in drag and drop #8632

Open

Description

@tope99

Version/Branch of Dear ImGui:

Version 1.91.6, Branch: docking

Back-ends:

imgui_impl_android.cpp + imgui_impl_opengl3.cpp

Compiler, OS:

Windows 10 + Android Studio

Full config/build information:

No response

Details:

My Issue/Question:

I am using drag and drop functionality to implement reordering and removal of items in a table. For a removal there is a button at the bottom of the screen (see picture).

Image

Currently AcceptDragDropPayload only supports rendering of a yellow bounding rectangle when the removal button is hovered. It would be nice to add support for ordinary hovering state so that buttons or selectables render as hovered. For example we could have a new flag ImGuiDragDropFlags_AcceptDrawHovered

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

No response

Activity

  1. ocornut commented on Nov 6, 2025

    @ocornut
    Owner

    Apologies for my late answer.
    This seems sensible, I pushed b0d3c3a + bd0e203, the later adding a new ImGuiDragDropFlags_AcceptDrawAsHovered flag as suggested.

    ImGui::Button("Drop Me");
    if (ImGui::BeginDragDropTarget())
    {
        if (ImGui::AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_3F, ImGuiDragDropFlags_AcceptNoDrawDefaultRect | ImGuiDragDropFlags_AcceptDrawAsHovered))
        {
           IMGUI_DEBUG_LOG("Dropped\n");
        }
        ImGui::EndDragDropTarget();
    }

    Please note that as #9056 you can also slightly configure the drop rect highlight, but I presume that in this sorts of case you would use ImGuiDragDropFlags_AcceptNoDrawDefaultRect anyhow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions