This commit is contained in:
sylvass
2021-11-15 15:34:35 -05:00
parent 4b81c76afe
commit b9aaab22a5
3 changed files with 9 additions and 6 deletions
+5 -3
View File
@@ -275,7 +275,7 @@ SkyBrowserModule::SkyBrowserModule()
_resizeDirection = _mouseOnPair->getBrowser()->isOnResizeArea(
_mousePosition
);
if (_resizeDirection != glm::vec2{ 0 }) {
if (_resizeDirection != glm::ivec2{ 0 }) {
_mouseOnPair->getBrowser()->saveResizeStartSize();
_startBrowserSize = _mouseOnPair->getBrowser()->
screenSpaceDimensions();
@@ -336,7 +336,7 @@ SkyBrowserModule::SkyBrowserModule()
if (_isResizing) {
// Calculate scaling factor
glm::vec2 mouseDragVector = (_mousePosition-_startMousePosition);
glm::vec2 scaling = mouseDragVector * _resizeDirection;
glm::vec2 scaling = mouseDragVector * glm::vec2(_resizeDirection);
glm::vec2 newSizeRelToOld = (_startBrowserSize + (scaling)) /
_startBrowserSize;
// Scale the browser
@@ -345,7 +345,9 @@ SkyBrowserModule::SkyBrowserModule()
// For dragging functionality, translate so it looks like the
// browser isn't moving. Make sure the browser doesn't move in
// directions it's not supposed to
translation = mouseDragVector * abs(_resizeDirection) / 2.f;
translation = 0.5f * mouseDragVector * abs(
glm::vec2(_resizeDirection)
);
}
// Translate
+1 -1
View File
@@ -137,7 +137,7 @@ private:
glm::vec2 _startMousePosition;
glm::vec2 _startDragPosition;
glm::vec2 _startBrowserSize;
glm::vec2 _resizeDirection{ 0.f };
glm::ivec2 _resizeDirection{ 0 };
// Animation of rotation of camera to look at coordinate galactic coordinates
glm::dvec3 _startAnimation;
+3 -2
View File
@@ -26,6 +26,7 @@
#include <modules/skybrowser/include/screenspaceskybrowser.h>
#include <modules/skybrowser/include/utility.h>
#include <ghoul/misc/assert.h>
namespace openspace {
@@ -34,8 +35,8 @@ namespace openspace {
Pair::Pair(ScreenSpaceSkyBrowser* browser, ScreenSpaceSkyTarget* target)
: _target(target), _browser(browser)
{
assert(browser != nullptr, "Sky browser is null pointer!");
assert(target != nullptr, "Sky target is null pointer!");
ghoul_assert(browser != nullptr, "Sky browser is null pointer!");
ghoul_assert(target != nullptr, "Sky target is null pointer!");
}
void Pair::lock() {