mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-03-13 17:09:05 -05:00
Rotate camera if selected image is outside of screen
This commit is contained in:
@@ -60,6 +60,15 @@ namespace openspace::skybrowser::luascriptfunctions {
|
||||
if (browser->getSkyTarget()) {
|
||||
browser->getSkyTarget()->unlock();
|
||||
browser->getSkyTarget()->startAnimation(resultImage.celestCoords, resultImage.zoomLevel / 6);
|
||||
glm::dvec3 imgCoordsOnScreen = J2000SphericalToScreenSpace(resultImage.celestCoords);
|
||||
glm::vec2 windowRatio = global::windowDelegate->currentWindowSize();
|
||||
float r = windowRatio.x / windowRatio.y;
|
||||
// Check if image coordinate is within current FOV
|
||||
if (!(abs(imgCoordsOnScreen.x) < r && abs(imgCoordsOnScreen.y) < 1.f && imgCoordsOnScreen.z < 0)
|
||||
|| imgCoordsOnScreen.z > 0) {
|
||||
module->startRotation(resultImage.celestCoords);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user