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

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

Open
SAOMDVN opened this issue Feb 24, 2023 · 3 comments

Comments

@SAOMDVN
Copy link

SAOMDVN commented Feb 24, 2023

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:

Nuklear.mp4

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

@RobLoach
Copy link
Contributor

RobLoach commented Apr 4, 2024

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

@RobLoach RobLoach closed this as completed Apr 4, 2024
@RobLoach RobLoach reopened this Apr 8, 2024
@RobLoach
Copy link
Contributor

RobLoach commented Apr 8, 2024

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?

@SAOMDVN
Copy link
Author

SAOMDVN commented Apr 23, 2024

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;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants