Changes to touch module to allow it to build with or without webbrowser module enabled (#808)

This commit is contained in:
Gene Payne
2019-03-07 03:15:45 -07:00
committed by Emil Axelsson
parent f49202c36c
commit 63c1ac89fb
2 changed files with 10 additions and 4 deletions

View File

@@ -25,8 +25,9 @@
#include <openspace/engine/globals.h>
#include <modules/touch/include/touchinteraction.h>
#include <modules/imgui/imguimodule.h>
#ifdef OPENSPACE_MODULE_WEBBROWSER_ENABLED
#include <modules/webbrowser/webbrowsermodule.h>
#include <modules/webgui/webguimodule.h>
#endif
#include <openspace/interaction/orbitalnavigator.h>
#include <openspace/engine/globals.h>
@@ -437,8 +438,12 @@ bool TouchInteraction::webContent(const std::vector<TuioCursor>& list) {
list.at(0).getScreenY(res.y)
);
#ifdef OPENSPACE_MODULE_WEBBROWSER_ENABLED
WebBrowserModule& module = *(global::moduleEngine.module<WebBrowserModule>());
return module.eventHandler().hasContentCallback(pos.x, pos.y);
#else
return false;
#endif
}
// Activates/Deactivates gui input mode (if active it voids all other interactions)
@@ -1327,8 +1332,6 @@ void TouchInteraction::step(double dt) {
planetBoundaryRadius *= _zoomBoundarySphereMultiplier;
double distToSurface = length(centerToCamera - planetBoundaryRadius);
WebGuiModule& module = *(global::moduleEngine.module<WebGuiModule>());
//Apply the velocity to update camera position
glm::dvec3 velocityIncr = directionToCenter * _vel.zoom * dt;
bool isDeltaLessThanDistToSurface = (length(_vel.zoom * dt) < distToSurface);

View File

@@ -23,8 +23,9 @@
****************************************************************************************/
#include <modules/touch/touchmodule.h>
#ifdef OPENSPACE_MODULE_WEBBROWSER_ENABLED
#include <modules/webbrowser/webbrowsermodule.h>
#include <modules/webgui/webguimodule.h>
#endif
#include <openspace/engine/globals.h>
#include <openspace/engine/globalscallbacks.h>
@@ -122,6 +123,7 @@ void TouchModule::hasNewWebInput(const std::vector<TuioCursor>& listOfContactPoi
listOfContactPoints.at(0).getScreenY(res.y)
);
#ifdef OPENSPACE_MODULE_WEBBROWSER_ENABLED
WebBrowserModule& module = *(global::moduleEngine.module<WebBrowserModule>());
if (module.eventHandler().hasContentCallback(pos.x, pos.y)) {
webPositionCallback = glm::vec2(pos.x, pos.y);
@@ -134,6 +136,7 @@ void TouchModule::hasNewWebInput(const std::vector<TuioCursor>& listOfContactPoi
module.eventHandler().touchReleaseCallback(webPositionCallback.x,
webPositionCallback.y);
webPositionCallback = glm::vec2(0, 0);
#endif
}
}