Cleanup of mouse interaction

This commit is contained in:
sylvass
2021-12-03 17:32:41 -05:00
parent 7a0529b6d1
commit 14c6760859
6 changed files with 199 additions and 158 deletions
+6 -1
View File
@@ -58,7 +58,11 @@ public:
// Mouse interaction
bool checkMouseIntersection(glm::vec2 mousePosition);
glm::vec2 selectedScreenSpacePosition();
bool isSelectedBrowser();
bool isBrowserSelected();
bool isTargetSelected();
void fineTuneTarget(const glm::vec2& start, const glm::vec2& translation);
void translateSelected(const glm::vec2& start, const glm::vec2& translation);
void resizeBrowser(const glm::vec2& start, const glm::vec2& translation);
// Browser
void sendIdToBrowser();
@@ -71,6 +75,7 @@ public:
// Boolean functions
bool hasFinishedFading(float goalState) const;
bool isOnResizeArea(glm::vec2 mouseScreenSpaceCoords);
bool isEnabled() const;
bool isLocked() const;
@@ -47,12 +47,8 @@ namespace openspace {
// Interaction. Resize
void saveResizeStartSize();
// Mouse interaction with the browser. Returns 1 or -1 at the coordinate in
// image if the mouse is on a side of the browser
// __1__
// y| -1 |_____|1
// |__x -1
glm::ivec2 isOnResizeArea(glm::vec2 screenSpaceCoord);
bool isOnResizeArea(glm::vec2 screenSpaceCoord);
void resize(const glm::vec2& start, const glm::vec2& mouseDrag);
glm::dvec2 fineTuneVector(glm::dvec2 drag);
void setIdInBrowser();
@@ -69,13 +65,15 @@ namespace openspace {
bool _isSyncedWithWwt{ false };
bool _isFovAnimated{ false };
// Animation of browser
// Animation of fieldOfView
float _endVfov{ 0.f };
// Resizing of browser
glm::vec2 _originalDimensions;
// Resizing
float _originalScale;
float _resizeAreaPercentage{ 0.1f };
glm::vec2 _originalDimensions;
glm::vec2 _originalScreenSpaceSize;
glm::ivec2 _resizeDirection;
// Time variables
// For capping the calls onchange properties from scrolling