mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 17:00:05 +00:00
Hover over time for additional product information
This commit is contained in:
parent
c2918daebf
commit
1e7df9f236
6 changed files with 107 additions and 6 deletions
|
|
@ -44,9 +44,7 @@ class OverlayLayerImpl
|
|||
public:
|
||||
explicit OverlayLayerImpl(std::shared_ptr<MapContext> context) :
|
||||
activeBoxOuter_ {std::make_shared<gl::draw::Rectangle>(context)},
|
||||
activeBoxInner_ {std::make_shared<gl::draw::Rectangle>(context)},
|
||||
sweepTimeString_ {},
|
||||
sweepTimeNeedsUpdate_ {true}
|
||||
activeBoxInner_ {std::make_shared<gl::draw::Rectangle>(context)}
|
||||
{
|
||||
}
|
||||
~OverlayLayerImpl() = default;
|
||||
|
|
@ -54,8 +52,9 @@ public:
|
|||
std::shared_ptr<gl::draw::Rectangle> activeBoxOuter_;
|
||||
std::shared_ptr<gl::draw::Rectangle> activeBoxInner_;
|
||||
|
||||
std::string sweepTimeString_;
|
||||
bool sweepTimeNeedsUpdate_;
|
||||
std::string sweepTimeString_ {};
|
||||
bool sweepTimeNeedsUpdate_ {true};
|
||||
bool sweepTimePicked_ {false};
|
||||
};
|
||||
|
||||
OverlayLayer::OverlayLayer(std::shared_ptr<MapContext> context) :
|
||||
|
|
@ -96,6 +95,8 @@ void OverlayLayer::Render(
|
|||
|
||||
context()->set_render_parameters(params);
|
||||
|
||||
p->sweepTimePicked_ = false;
|
||||
|
||||
if (p->sweepTimeNeedsUpdate_ && radarProductView != nullptr)
|
||||
{
|
||||
const scwx::util::time_zone* currentZone;
|
||||
|
|
@ -154,7 +155,38 @@ void OverlayLayer::Render(
|
|||
nullptr,
|
||||
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize |
|
||||
ImGuiWindowFlags_AlwaysAutoResize);
|
||||
ImGui::TextUnformatted(p->sweepTimeString_.c_str());
|
||||
|
||||
if (ImGui::IsWindowHovered())
|
||||
{
|
||||
// Show a detailed product description when the sweep time is hovered
|
||||
p->sweepTimePicked_ = true;
|
||||
|
||||
auto fields = radarProductView->GetDescriptionFields();
|
||||
if (fields.empty())
|
||||
{
|
||||
ImGui::TextUnformatted(p->sweepTimeString_.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ImGui::BeginTable("Description Fields", 2))
|
||||
{
|
||||
for (auto& field : fields)
|
||||
{
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextUnformatted(field.first.c_str());
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::TextUnformatted(field.second.c_str());
|
||||
}
|
||||
ImGui::EndTable();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::TextUnformatted(p->sweepTimeString_.c_str());
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
|
|
@ -178,6 +210,16 @@ void OverlayLayer::Deinitialize()
|
|||
}
|
||||
}
|
||||
|
||||
bool OverlayLayer::RunMousePicking(
|
||||
const QMapLibreGL::CustomLayerRenderParameters& /* params */,
|
||||
const QPointF& /* mouseLocalPos */,
|
||||
const QPointF& /* mouseGlobalPos */,
|
||||
const glm::vec2& /* mouseCoords */)
|
||||
{
|
||||
// If sweep time was picked, don't process additional items
|
||||
return p->sweepTimePicked_;
|
||||
}
|
||||
|
||||
void OverlayLayer::UpdateSweepTimeNextFrame()
|
||||
{
|
||||
p->sweepTimeNeedsUpdate_ = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue