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

Mouse event propagation with MousePressed and MouseReleased of event #161

Closed
dayus20 opened this issue Feb 2, 2023 · 1 comment
Closed

Comments

@dayus20
Copy link

dayus20 commented Feb 2, 2023

Hi,

I made a quick UI to control some parameter in my app.

I'm using OF(0.11.2) default void for MousePressed event and MouseReleased event but it seems like when i click on the gui it's also executing the code on my MousePressed event.

So I tried using the gui->getMouseDown() referenced in another issue, but it's not working here a snippet of the code:

void ofApp::update(){
    gui->update();
    if (ofGetMousePressed() && gui->getMouseDown() == false) {
        // let the app handle the mouse event //
        inGui = false;
    }
    else {
        inGui = true;
    }
}
void ofApp::mousePressed(int x, int y, int button){
    if (inGui == false) {
        renderer.is_mouse_button_pressed = true;

        renderer.mouse_current_x = x;
        renderer.mouse_current_y = y;

        renderer.mouse_press_x = x;
        renderer.mouse_press_y = y;
    }
}
@dayus20
Copy link
Author

dayus20 commented Feb 3, 2023

Nevermind it's working now. Made a mistake in my code

@dayus20 dayus20 closed this as completed Feb 3, 2023
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

1 participant