mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 17:40:05 +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::radians<float>(params.bearing), | ||||||
|                            glm::vec3(0.0f, 0.0f, 1.0f)); |                            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
 |    // For each pickable icon
 | ||||||
|    auto it = std::find_if( |    auto it = std::find_if( | ||||||
|       std::execution::par_unseq, |       std::execution::par_unseq, | ||||||
|       p->hoverIcons_.crbegin(), |       p->hoverIcons_.crbegin(), | ||||||
|       p->hoverIcons_.crend(), |       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
 |          // Initialize vertices
 | ||||||
|          glm::vec2 bl = icon.p_; |          glm::vec2 bl = icon.p_; | ||||||
|          glm::vec2 br = bl; |          glm::vec2 br = bl; | ||||||
|  |  | ||||||
|  | @ -446,13 +446,33 @@ bool PlacefileLines::RunMousePicking( | ||||||
|                            glm::radians<float>(params.bearing), |                            glm::radians<float>(params.bearing), | ||||||
|                            glm::vec3(0.0f, 0.0f, 1.0f)); |                            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
 |    // For each pickable line
 | ||||||
|    auto it = std::find_if( |    auto it = std::find_if( | ||||||
|       std::execution::par_unseq, |       std::execution::par_unseq, | ||||||
|       p->currentHoverLines_.crbegin(), |       p->currentHoverLines_.crbegin(), | ||||||
|       p->currentHoverLines_.crend(), |       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
 |          // Initialize vertices
 | ||||||
|          glm::vec2 bl = line.p1_; |          glm::vec2 bl = line.p1_; | ||||||
|          glm::vec2 br = bl; |          glm::vec2 br = bl; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat