Nuklear icon indicating copy to clipboard operation
Nuklear copied to clipboard

Moving mouse out of Window when still holding scrollbar is treated as unactive

Open SAOMDVN opened this issue 2 years ago • 3 comments

I have a simple Group on a Window widget. This Group has many elements which spawns a scrollbar. If I hold onto the scrollbar and move my mouse outside of the current window nk_item_is_any_active will return false even though I haven't let go of the scrollbar. The expected behaviour is the Group widget is still being active/focused.

Demonstration:

https://user-images.githubusercontent.com/34767287/221190771-16ae477b-d63b-4e9b-bcdc-758b668e1981.mp4

I'm currently using the raylib runtime at https://github.com/RobLoach/raylib-nuklear

SAOMDVN avatar Feb 24 '23 13:02 SAOMDVN

Thanks! Could possibly be an issue with the raylib implementation. Mind chatting there?

RobLoach avatar Apr 04 '24 17:04 RobLoach

Ah, I'm not sure this is implementation specific. Do you have any sample code to test this? Does it work in the Overview example?

RobLoach avatar Apr 08 '24 13:04 RobLoach

You can test with this:

int main() {
    InitWindow(640, 480, "raylib-nuklear example");

    // Create the Nuklear Context
    int fontSize = 10;
    const char *activeText[2] = {"Inactive", "Active"};
    struct nk_context *ctx = InitNuklear(fontSize);

    while (!WindowShouldClose()) {
        // Update the Nuklear context, along with input
        UpdateNuklear(ctx);

        // Nuklear GUI Code
        // https://github.com/Immediate-Mode-UI/Nuklear/wiki/Window
        if (nk_begin(ctx, "Nuklear", nk_rect(100, 100, 220, 220),
                NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_CLOSABLE)) {
            nk_layout_row_static(ctx, 50, 150, 1);
            //Random text to make the scrollbar appear
            nk_label(ctx, "Lorem Ipsum", NK_LEFT);
            nk_label(ctx, "Lorem Ipsum", NK_LEFT);
            nk_label(ctx, "Lorem Ipsum", NK_LEFT);
            nk_label(ctx, "Lorem Ipsum", NK_LEFT);
        }
        nk_end(ctx);

        // Render
        BeginDrawing();
            ClearBackground(GRAY);

            int active = nk_item_is_any_active(ctx);
            DrawText(activeText[active], 400, 200, 20, GREEN);

            // Render the Nuklear GUI
            DrawNuklear(ctx);

        EndDrawing();
    }

    // De-initialize the Nuklear GUI
    UnloadNuklear(ctx);

    CloseWindow();
    return 0;
}

SAOMDVN avatar Apr 23 '24 17:04 SAOMDVN