380{
383 const auto hit =
m_layer->hit_test(ndc);
384
385 const int btn_idx = static_cast<int>(btn);
386
390 if (it !=
m_callbacks.end() && it->second.focus_lost)
392 }
393
395
396 if (hit) {
398 if (it !=
m_callbacks.end() && it->second.focus_gained)
399 it->second.focus_gained(*hit);
400 }
401 }
402
405 }
406
407 if (hit) {
409 if (it !=
m_callbacks.end() && it->second.press.count(btn_idx))
410 it->second.press[btn_idx](*hit, ndc);
411 }
412}
void sync_size()
Run the resize callbacks if the window's size differs from the size they last saw.
std::optional< uint32_t > m_dragging[3]
std::shared_ptr< Layer > m_layer
glm::vec2 to_ndc(double px, double py) const noexcept
std::unordered_map< uint32_t, ElementCallbacks > m_callbacks
std::optional< uint32_t > m_focused