diff --git a/src/celestia/celestiacore.cpp b/src/celestia/celestiacore.cpp index fc9c904fc4..d859a66f9d 100644 --- a/src/celestia/celestiacore.cpp +++ b/src/celestia/celestiacore.cpp @@ -394,7 +394,7 @@ void CelestiaCore::mouseButtonUp(float x, float y, int button) setViewChanged(); // Four pixel tolerance for picking - float pickTolerance = sim->getActiveObserver()->getFOV() / height * 4.0f; + float pickTolerance = sim->getActiveObserver()->getFOV() / height * this->pickTolerance; if (resizeSplit != nullptr) { @@ -2181,6 +2181,16 @@ void CelestiaCore::setSafeAreaInsets(int left, int top, int right, int bottom) safeAreaInsets = { left, top, right, bottom }; } +float CelestiaCore::getPickTolerance() const +{ + return pickTolerance; +} + +void CelestiaCore::setPickTolerance(float newPickTolerance) +{ + pickTolerance = newPickTolerance; +} + // Return true if anything changed that requires re-rendering. Otherwise, we // can skip rendering, keep the GPU idle, and save power. bool CelestiaCore::viewUpdateRequired() const diff --git a/src/celestia/celestiacore.h b/src/celestia/celestiacore.h index 7736d7fe16..895f457819 100644 --- a/src/celestia/celestiacore.h +++ b/src/celestia/celestiacore.h @@ -286,6 +286,8 @@ class CelestiaCore // : public Watchable int getDistanceToScreen() const; void setDistanceToScreen(int); void setSafeAreaInsets(int left, int top, int right, int bottom); + float getPickTolerance() const; + void setPickTolerance(float); void setFOVFromZoom(); void setZoomFromFOV(); @@ -467,6 +469,8 @@ class CelestiaCore // : public Watchable int screenDpi{ 96 }; int distanceToScreen{ 400 }; + float pickTolerance { 4.0f }; + unique_ptr viewportEffect { nullptr }; bool isViewportEffectUsed { false };