Merge branch 'master' into feature/du-meshes-selection

This commit is contained in:
Malin E
2022-08-09 09:02:16 +02:00
12 changed files with 177 additions and 107 deletions
+2 -2
View File
@@ -32,10 +32,10 @@ GUIKeyboardHandler::GUIKeyboardHandler() {
_keyConsumed = false;
global::callback::keyboard->emplace_back(
[&](Key, KeyModifier, KeyAction) -> bool {
[&](Key, KeyModifier, KeyAction, IsGuiWindow isGuiWindow) -> bool {
const bool previous = _keyConsumed;
_keyConsumed = false;
return previous;
return isGuiWindow ? previous : false;
}
);
}
+33 -11
View File
@@ -153,31 +153,50 @@ ImGUIModule::ImGUIModule()
});
global::callback::keyboard->emplace_back(
[&](Key key, KeyModifier mod, KeyAction action) -> bool {
[&](Key key, KeyModifier mod, KeyAction action,
IsGuiWindow isGuiWindow) -> bool
{
ZoneScopedN("ImGUI")
return _isEnabled ? keyCallback(key, mod, action) : false;
if (!isGuiWindow || !_isEnabled) {
return false;
}
return keyCallback(key, mod, action);
}
);
global::callback::character->emplace_back(
[&](unsigned int codepoint, KeyModifier modifier) -> bool {
[&](unsigned int codepoint, KeyModifier modifier,
IsGuiWindow isGuiWindow) -> bool
{
ZoneScopedN("ImGUI")
return _isEnabled ? charCallback(codepoint, modifier) : false;
if (!isGuiWindow || !_isEnabled) {
return false;
}
return charCallback(codepoint, modifier);
}
);
global::callback::mousePosition->emplace_back(
[&](double x, double y) {
[&](double x, double y, IsGuiWindow isGuiWindow) {
if (!isGuiWindow) {
return; // do nothing
}
_mousePosition = glm::vec2(static_cast<float>(x), static_cast<float>(y));
}
);
global::callback::mouseButton->emplace_back(
[&](MouseButton button, MouseAction action, KeyModifier) -> bool {
[&](MouseButton button, MouseAction action, KeyModifier,
IsGuiWindow isGuiWindow) -> bool
{
ZoneScopedN("ImGUI")
if (!isGuiWindow) {
return false;
}
if (action == MouseAction::Press) {
_mouseButtons |= (1 << static_cast<int>(button));
}
@@ -190,10 +209,13 @@ ImGUIModule::ImGUIModule()
);
global::callback::mouseScrollWheel->emplace_back(
[&](double, double posY) -> bool {
[&](double, double posY, IsGuiWindow isGuiWindow) -> bool {
ZoneScopedN("ImGUI")
return _isEnabled ? mouseWheelCallback(posY) : false;
if (!isGuiWindow || !_isEnabled) {
return false;
}
return mouseWheelCallback(posY);
}
);
@@ -225,7 +247,7 @@ void ImGUIModule::internalInitialize(const ghoul::Dictionary&) {
const std::vector<SceneGraphNode*>& nodes = scene ?
scene->allSceneGraphNodes() :
std::vector<SceneGraphNode*>();
return std::vector<properties::PropertyOwner*>(nodes.begin(), nodes.end());
}
);
@@ -412,7 +434,7 @@ void ImGUIModule::internalInitializeGL() {
sizeof(ImDrawVert),
nullptr
);
glEnableVertexAttribArray(uvAttrib);
glVertexAttribPointer(
uvAttrib,
@@ -422,7 +444,7 @@ void ImGUIModule::internalInitializeGL() {
sizeof(ImDrawVert),
reinterpret_cast<GLvoid*>(offsetof(ImDrawVert, uv))
);
glEnableVertexAttribArray(colorAttrib);
glVertexAttribPointer(
colorAttrib,
+3 -2
View File
@@ -166,8 +166,9 @@ SkyBrowserModule::SkyBrowserModule()
_wwtImageCollectionUrl.setReadOnly(true);
// Set callback functions
global::callback::mouseButton->emplace(global::callback::mouseButton->begin(),
[&](MouseButton, MouseAction action, KeyModifier) -> bool {
global::callback::mouseButton->emplace(
global::callback::mouseButton->begin(),
[&](MouseButton button, MouseAction action, KeyModifier, IsGuiWindow) -> bool {
if (action == MouseAction::Press) {
_cameraRotation.stop();
}
@@ -236,7 +236,9 @@ void ScreenSpaceSkyBrowser::addDisplayCopy(const glm::vec3& raePosition, int nCo
void ScreenSpaceSkyBrowser::removeDisplayCopy() {
if (!_displayCopies.empty()) {
removeProperty(_displayCopies.back().get());
removeProperty(_showDisplayCopies.back().get());
_displayCopies.pop_back();
_showDisplayCopies.pop_back();
}
}
+30 -18
View File
@@ -149,48 +149,58 @@ namespace {
namespace openspace {
void EventHandler::initialize() {
global::callback::character->emplace_back(
[this](unsigned int charCode, KeyModifier mod) -> bool {
if (_browserInstance) {
global::callback::character->emplace(
global::callback::character->begin(),
[this](unsigned int charCode, KeyModifier mod, IsGuiWindow isGuiWindow) -> bool {
if (_browserInstance && isGuiWindow) {
return charCallback(charCode, mod);
}
return false;
}
);
global::callback::keyboard->emplace_back(
[this](Key key, KeyModifier mod, KeyAction action) -> bool {
if (_browserInstance) {
global::callback::keyboard->emplace(
global::callback::keyboard->begin(),
[this](Key key, KeyModifier mod, KeyAction action,
IsGuiWindow isGuiWindow) -> bool
{
if (_browserInstance && isGuiWindow) {
return keyboardCallback(key, mod, action);
}
return false;
}
);
global::callback::mousePosition->emplace_back(
[this](double x, double y) -> bool {
if (_browserInstance) {
global::callback::mousePosition->emplace(
global::callback::mousePosition->begin(),
[this](double x, double y, IsGuiWindow isGuiWindow) -> bool {
if (_browserInstance && isGuiWindow) {
return mousePositionCallback(x, y);
}
return false;
}
);
global::callback::mouseButton->emplace_back(
[this](MouseButton button, MouseAction action, KeyModifier mods) -> bool {
if (_browserInstance) {
global::callback::mouseButton->emplace(
global::callback::mouseButton->begin(),
[this](MouseButton button, MouseAction action,
KeyModifier mods, IsGuiWindow isGuiWindow) -> bool
{
if (_browserInstance && isGuiWindow) {
return mouseButtonCallback(button, action, mods);
}
return false;
}
);
global::callback::mouseScrollWheel->emplace_back(
[this](double x, double y) -> bool {
if (_browserInstance) {
global::callback::mouseScrollWheel->emplace(
global::callback::mouseScrollWheel->begin(),
[this](double x, double y, IsGuiWindow isGuiWindow) -> bool {
if (_browserInstance && isGuiWindow) {
return mouseWheelCallback(glm::ivec2(x, y));
}
return false;
}
);
global::callback::touchDetected->emplace_back(
global::callback::touchDetected->emplace(
global::callback::touchDetected->begin(),
[&](TouchInput input) -> bool {
if (!_browserInstance) {
return false;
@@ -229,7 +239,8 @@ void EventHandler::initialize() {
}
);
global::callback::touchUpdated->emplace_back(
global::callback::touchUpdated->emplace(
global::callback::touchUpdated->begin(),
[&](TouchInput input) -> bool {
if (!_browserInstance || _validTouchStates.empty()) {
return false;
@@ -267,7 +278,8 @@ void EventHandler::initialize() {
}
);
global::callback::touchExit->emplace_back(
global::callback::touchExit->emplace(
global::callback::touchExit->begin(),
[&](TouchInput input) {
if (!_browserInstance) {
return;