about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/subway_map.cpp54
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
407void SubwayMap::OnMouseClick(wxMouseEvent &event) { 407void 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