diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-05-02 12:05:05 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-05-02 12:05:05 -0400 |
commit | 22014b967d0d9651b72bffbe02aba75dc98180a4 (patch) | |
tree | ffab7ffdc21463eb6cd7160fbce6f91e050f8c3e /tracker_panel.cpp | |
parent | 4ec5bf36218ad715657bba7649598410feae2794 (diff) | |
download | lingo-ap-tracker-22014b967d0d9651b72bffbe02aba75dc98180a4.tar.gz lingo-ap-tracker-22014b967d0d9651b72bffbe02aba75dc98180a4.tar.bz2 lingo-ap-tracker-22014b967d0d9651b72bffbe02aba75dc98180a4.zip |
Show locations popup when hovering over area
Diffstat (limited to 'tracker_panel.cpp')
-rw-r--r-- | tracker_panel.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/tracker_panel.cpp b/tracker_panel.cpp index 0cd65cc..0e78cc5 100644 --- a/tracker_panel.cpp +++ b/tracker_panel.cpp | |||
@@ -1,5 +1,6 @@ | |||
1 | #include "tracker_panel.h" | 1 | #include "tracker_panel.h" |
2 | 2 | ||
3 | #include "area_popup.h" | ||
3 | #include "game_data.h" | 4 | #include "game_data.h" |
4 | 5 | ||
5 | TrackerPanel::TrackerPanel(wxWindow *parent) : wxPanel(parent, wxID_ANY) { | 6 | TrackerPanel::TrackerPanel(wxWindow *parent) : wxPanel(parent, wxID_ANY) { |
@@ -9,7 +10,13 @@ TrackerPanel::TrackerPanel(wxWindow *parent) : wxPanel(parent, wxID_ANY) { | |||
9 | } | 10 | } |
10 | 11 | ||
11 | for (const MapArea &map_area : GetGameData().GetMapAreas()) { | 12 | for (const MapArea &map_area : GetGameData().GetMapAreas()) { |
12 | area_windows_.push_back(new AreaWindow(this, map_area.id)); | 13 | AreaPopup *area_popup = new AreaPopup(this, map_area.id); |
14 | area_popup->SetPosition({0, 0}); | ||
15 | area_popup->Raise(); | ||
16 | |||
17 | AreaWindow *area_window = new AreaWindow(this, map_area.id, area_popup); | ||
18 | area_window->Lower(); | ||
19 | area_windows_.push_back(area_window); | ||
13 | } | 20 | } |
14 | 21 | ||
15 | Redraw(); | 22 | Redraw(); |
@@ -62,5 +69,18 @@ void TrackerPanel::Redraw() { | |||
62 | final_y + (map_area.map_y - (AreaWindow::EFFECTIVE_SIZE / 2)) * | 69 | final_y + (map_area.map_y - (AreaWindow::EFFECTIVE_SIZE / 2)) * |
63 | final_width / image_size.GetWidth(), | 70 | final_width / image_size.GetWidth(), |
64 | }); | 71 | }); |
72 | |||
73 | AreaPopup *area_popup = area_window->GetPopup(); | ||
74 | int popup_x = | ||
75 | final_x + map_area.map_x * final_width / image_size.GetWidth(); | ||
76 | int popup_y = | ||
77 | final_y + map_area.map_y * final_width / image_size.GetWidth(); | ||
78 | if (popup_x + area_popup->GetSize().GetWidth() > panel_size.GetWidth()) { | ||
79 | popup_x = panel_size.GetWidth() - area_popup->GetSize().GetWidth(); | ||
80 | } | ||
81 | if (popup_y + area_popup->GetSize().GetHeight() > panel_size.GetHeight()) { | ||
82 | popup_y = panel_size.GetHeight() - area_popup->GetSize().GetHeight(); | ||
83 | } | ||
84 | area_popup->SetPosition({popup_x, popup_y}); | ||
65 | } | 85 | } |
66 | } | 86 | } |