mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-30 23:40:06 +00:00 
			
		
		
		
	Cache alert hover text
This commit is contained in:
		
							parent
							
								
									f9bb3e07c3
								
							
						
					
					
						commit
						2ab8f3a77a
					
				
					 1 changed files with 21 additions and 5 deletions
				
			
		|  | @ -181,6 +181,9 @@ public: | ||||||
|    std::unordered_map<bool, boost::gil::rgba32f_pixel_t> lineColor_; |    std::unordered_map<bool, boost::gil::rgba32f_pixel_t> lineColor_; | ||||||
| 
 | 
 | ||||||
|    std::chrono::system_clock::time_point selectedTime_ {}; |    std::chrono::system_clock::time_point selectedTime_ {}; | ||||||
|  | 
 | ||||||
|  |    std::shared_ptr<const gl::draw::GeoLineDrawItem> lastHoverDi_ {nullptr}; | ||||||
|  |    std::string                                      tooltip_ {}; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| AlertLayer::AlertLayer(std::shared_ptr<MapContext> context, | AlertLayer::AlertLayer(std::shared_ptr<MapContext> context, | ||||||
|  | @ -535,12 +538,25 @@ void AlertLayer::Impl::HandleGeoLinesHover( | ||||||
|    std::shared_ptr<const gl::draw::GeoLineDrawItem>& di, |    std::shared_ptr<const gl::draw::GeoLineDrawItem>& di, | ||||||
|    const QPointF&                                    mouseGlobalPos) |    const QPointF&                                    mouseGlobalPos) | ||||||
| { | { | ||||||
|    auto it = segmentsByLine_.find(di); |    if (di != lastHoverDi_) | ||||||
|    if (it != segmentsByLine_.cend()) |  | ||||||
|    { |    { | ||||||
|       util::tooltip::Show( |       auto it = segmentsByLine_.find(di); | ||||||
|          boost::algorithm::join(it->second->segment_->productContent_, "\n"), |       if (it != segmentsByLine_.cend()) | ||||||
|          mouseGlobalPos); |       { | ||||||
|  |          tooltip_ = | ||||||
|  |             boost::algorithm::join(it->second->segment_->productContent_, "\n"); | ||||||
|  |       } | ||||||
|  |       else | ||||||
|  |       { | ||||||
|  |          tooltip_.clear(); | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|  |       lastHoverDi_ = di; | ||||||
|  |    } | ||||||
|  | 
 | ||||||
|  |    if (!tooltip_.empty()) | ||||||
|  |    { | ||||||
|  |       util::tooltip::Show(tooltip_, mouseGlobalPos); | ||||||
|    } |    } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat