MCPcopy Create free account
hub / github.com/OpenBoardView/OpenBoardView / AnnotationIsHovered

Method AnnotationIsHovered

src/openboardview/BoardView.cpp:3112–3136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3110}
3111
3112int 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

Callers

nothing calls this directly

Calls 1

DPIFunction · 0.85

Tested by

no test coverage detected