mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 18:00:06 +00:00
Placefile thresholds should apply to mouse picking
This commit is contained in:
parent
96421bba40
commit
854d4a43db
2 changed files with 42 additions and 2 deletions
|
|
@ -523,13 +523,33 @@ bool PlacefileIcons::RunMousePicking(
|
|||
glm::radians<float>(params.bearing),
|
||||
glm::vec3(0.0f, 0.0f, 1.0f));
|
||||
|
||||
units::length::meters<double> mapDistance =
|
||||
(p->thresholded_) ? util::maplibre::GetMapDistance(params) :
|
||||
units::length::meters<double> {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<double> {0.0} &&
|
||||
|
||||
// Placefile threshold is < 999 nmi
|
||||
static_cast<int>(std::round(
|
||||
units::length::nautical_miles<double> {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;
|
||||
|
|
|
|||
|
|
@ -446,13 +446,33 @@ bool PlacefileLines::RunMousePicking(
|
|||
glm::radians<float>(params.bearing),
|
||||
glm::vec3(0.0f, 0.0f, 1.0f));
|
||||
|
||||
units::length::meters<double> mapDistance =
|
||||
(p->thresholded_) ? util::maplibre::GetMapDistance(params) :
|
||||
units::length::meters<double> {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<double> {0.0} &&
|
||||
|
||||
// Placefile threshold is < 999 nmi
|
||||
static_cast<int>(std::round(
|
||||
units::length::nautical_miles<double> {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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue