keyReleased not working
Opened this issue · 1 comments
Deleted user commented
I am using the 3D world panel inside the ofxCeres example.
I am noticing that i can press h to move the world around but releasing h does not bring it back to mouse rotation mode.
Placed a bunch of ofLog() and noticed that keyReleased never is called.
Also noticed in this line that it probably should say
ofArgs.type = ofKeyEventArgs::Type::Released;
https://github.com/elliotwoods/ofxCvGui/blob/master/src/ofxCvGui/Panels/World.cpp#L99
Deleted user commented
Also had to add the following. Now it works.
void Controller::keyReleased(ofKeyEventArgs & args) {
if (!this->rootGroup) {
return;
}
auto currentPanel = this->currentPanel.lock();
KeyboardArguments action(args, KeyboardArguments::Released, currentPanel);
if (this->activeDialog) {
// if (args.key == OF_KEY_ESC) {
// this->closeActiveDialog();
// }
// else {
this->activeDialog->keyboardAction(action);
// }
}
else {
if (this->maximised) {
//if something is maximised, only it get the key press
currentPanel->keyboardAction(action);
}
else {
//otherwise everything visible gets the key press
rootGroup->keyboardAction(action);
}
}
}
plus add and remove listeners
ofAddListener(ofEvents().keyReleased, this, &Controller::keyReleased);