| 3110 | } |
| 3111 | |
| 3112 | int BoardView::AnnotationIsHovered(void) { |
| 3113 | ImVec2 mp = ImGui::GetMousePos(); |
| 3114 | bool is_hovered = false; |
| 3115 | int i = 0; |
| 3116 | |
| 3117 | if (!ImGui::IsWindowHovered()) return false; |
| 3118 | m_annotation_last_hovered = 0; |
| 3119 | |
| 3120 | for (auto &ann : m_annotations.annotations) { |
| 3121 | ImVec2 a = CoordToScreen(ann.x, ann.y); |
| 3122 | if ((mp.x > a.x + DPI(config.annotationBoxOffset)) && (mp.x < a.x + (DPI(config.annotationBoxOffset) + DPI(config.annotationBoxSize))) && |
| 3123 | (mp.y < a.y - DPI(config.annotationBoxOffset)) && (mp.y > a.y - (DPI(config.annotationBoxOffset) + DPI(config.annotationBoxSize)))) { |
| 3124 | ann.hovered = true; |
| 3125 | is_hovered = true; |
| 3126 | m_annotation_last_hovered = i; |
| 3127 | } else { |
| 3128 | ann.hovered = false; |
| 3129 | } |
| 3130 | i++; |
| 3131 | } |
| 3132 | |
| 3133 | if (is_hovered == false) m_annotation_clicked_id = -1; |
| 3134 | |
| 3135 | return is_hovered; |
| 3136 | } |
| 3137 | |
| 3138 | /* |
| 3139 | * TODO |