diff --git a/scwx-qt/source/scwx/qt/gl/draw/placefile_icons.cpp b/scwx-qt/source/scwx/qt/gl/draw/placefile_icons.cpp index 151feb6c..9432e408 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/placefile_icons.cpp +++ b/scwx-qt/source/scwx/qt/gl/draw/placefile_icons.cpp @@ -523,13 +523,33 @@ bool PlacefileIcons::RunMousePicking( glm::radians(params.bearing), glm::vec3(0.0f, 0.0f, 1.0f)); + units::length::meters mapDistance = + (p->thresholded_) ? util::maplibre::GetMapDistance(params) : + units::length::meters {0.0}; + // For each pickable icon auto it = std::find_if( std::execution::par_unseq, p->hoverIcons_.crbegin(), p->hoverIcons_.crend(), - [&mapMatrix, &mousePos](const auto& icon) + [&mapDistance, &mapMatrix, &mousePos](const auto& icon) { + if ( + // Placefile is thresholded + mapDistance > units::length::meters {0.0} && + + // Placefile threshold is < 999 nmi + static_cast(std::round( + units::length::nautical_miles {icon.di_->threshold_} + .value())) < 999 && + + // Map distance is beyond the threshold + icon.di_->threshold_ < mapDistance) + { + // Icon is not pickable + return false; + } + // Initialize vertices glm::vec2 bl = icon.p_; glm::vec2 br = bl; diff --git a/scwx-qt/source/scwx/qt/gl/draw/placefile_lines.cpp b/scwx-qt/source/scwx/qt/gl/draw/placefile_lines.cpp index 424d8940..8041ff63 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/placefile_lines.cpp +++ b/scwx-qt/source/scwx/qt/gl/draw/placefile_lines.cpp @@ -446,13 +446,33 @@ bool PlacefileLines::RunMousePicking( glm::radians(params.bearing), glm::vec3(0.0f, 0.0f, 1.0f)); + units::length::meters mapDistance = + (p->thresholded_) ? util::maplibre::GetMapDistance(params) : + units::length::meters {0.0}; + // For each pickable line auto it = std::find_if( std::execution::par_unseq, p->currentHoverLines_.crbegin(), p->currentHoverLines_.crend(), - [&mapMatrix, &mousePos](const auto& line) + [&mapDistance, &mapMatrix, &mousePos](const auto& line) { + if ( + // Placefile is thresholded + mapDistance > units::length::meters {0.0} && + + // Placefile threshold is < 999 nmi + static_cast(std::round( + units::length::nautical_miles {line.di_->threshold_} + .value())) < 999 && + + // Map distance is beyond the threshold + line.di_->threshold_ < mapDistance) + { + // Line is not pickable + return false; + } + // Initialize vertices glm::vec2 bl = line.p1_; glm::vec2 br = bl;