diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-06-06 14:58:08 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2024-06-06 14:58:08 -0400 |
commit | e7b85c60546341dd842efe4dc06718854be9376c (patch) | |
tree | fdb5f6ae52dfa6db147dfeddad895ec28beefed0 | |
parent | 52dd0b92f4cf82dee0f638bdf4ba304090863423 (diff) | |
download | lingo-ap-tracker-e7b85c60546341dd842efe4dc06718854be9376c.tar.gz lingo-ap-tracker-e7b85c60546341dd842efe4dc06718854be9376c.tar.bz2 lingo-ap-tracker-e7b85c60546341dd842efe4dc06718854be9376c.zip |
Allow scrolling while sticky hovering
-rw-r--r-- | src/subway_map.cpp | 54 |
1 files changed, 33 insertions, 21 deletions
diff --git a/src/subway_map.cpp b/src/subway_map.cpp index dde817b..b32c362 100644 --- a/src/subway_map.cpp +++ b/src/subway_map.cpp | |||
@@ -405,35 +405,47 @@ void SubwayMap::OnMouseLeave(wxMouseEvent &event) { | |||
405 | } | 405 | } |
406 | 406 | ||
407 | void SubwayMap::OnMouseClick(wxMouseEvent &event) { | 407 | void SubwayMap::OnMouseClick(wxMouseEvent &event) { |
408 | if (sticky_hover_) { | 408 | bool finished = false; |
409 | sticky_hover_ = false; | ||
410 | 409 | ||
411 | if (actual_hover_ != hovered_item_) { | 410 | if (actual_hover_) { |
412 | hovered_item_ = actual_hover_; | 411 | const SubwayItem &subway_item = GD_GetSubwayItem(*actual_hover_); |
413 | |||
414 | Refresh(); | ||
415 | } | ||
416 | } else if (hovered_item_) { | ||
417 | const SubwayItem &subway_item = GD_GetSubwayItem(*hovered_item_); | ||
418 | if ((subway_item.door && !GetDoorRequirements(*subway_item.door).empty()) || | 412 | if ((subway_item.door && !GetDoorRequirements(*subway_item.door).empty()) || |
419 | networks_.IsItemInNetwork(*hovered_item_)) { | 413 | networks_.IsItemInNetwork(*hovered_item_)) { |
420 | sticky_hover_ = true; | 414 | if (actual_hover_ != hovered_item_) { |
415 | hovered_item_ = actual_hover_; | ||
416 | |||
417 | if (!hovered_item_) { | ||
418 | sticky_hover_ = false; | ||
419 | } | ||
420 | |||
421 | Refresh(); | ||
422 | } else { | ||
423 | sticky_hover_ = !sticky_hover_; | ||
424 | } | ||
425 | |||
426 | finished = true; | ||
421 | } | 427 | } |
422 | } else if (scroll_mode_) { | 428 | } |
423 | scroll_mode_ = false; | ||
424 | 429 | ||
425 | SetScrollSpeed(0, 0); | 430 | if (!finished) { |
431 | if (scroll_mode_) { | ||
432 | scroll_mode_ = false; | ||
426 | 433 | ||
427 | SetCursor(wxCURSOR_ARROW); | 434 | SetScrollSpeed(0, 0); |
428 | } else if (event.GetPosition().x < GetSize().GetWidth() / 6 || | ||
429 | event.GetPosition().x > 5 * GetSize().GetWidth() / 6 || | ||
430 | event.GetPosition().y < GetSize().GetHeight() / 6 || | ||
431 | event.GetPosition().y > 5 * GetSize().GetHeight() / 6) { | ||
432 | scroll_mode_ = true; | ||
433 | 435 | ||
434 | EvaluateScroll(event.GetPosition()); | 436 | SetCursor(wxCURSOR_ARROW); |
437 | } else if (event.GetPosition().x < GetSize().GetWidth() / 6 || | ||
438 | event.GetPosition().x > 5 * GetSize().GetWidth() / 6 || | ||
439 | event.GetPosition().y < GetSize().GetHeight() / 6 || | ||
440 | event.GetPosition().y > 5 * GetSize().GetHeight() / 6) { | ||
441 | scroll_mode_ = true; | ||
435 | 442 | ||
436 | SetCursor(wxCURSOR_CROSS); | 443 | EvaluateScroll(event.GetPosition()); |
444 | |||
445 | SetCursor(wxCURSOR_CROSS); | ||
446 | } else { | ||
447 | sticky_hover_ = false; | ||
448 | } | ||
437 | } | 449 | } |
438 | } | 450 | } |
439 | 451 | ||