MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ hit_test() [2/2]

std::optional< uint32_t > MayaFlux::Portal::Forma::Layer::hit_test ( glm::vec2  ndc) const

Return the topmost interactive, visible element containing ndc.

Traverses back-to-front. An element passes if:

  1. bounds_hint is absent OR bounds_hint.contains(ndc) is true.
  2. contains is absent OR contains(ndc) is true. An element with neither set never hits.
Parameters
ndcPoint in NDC space (x, y in [-1, +1]).
Returns
Element id, or nullopt if no element hit.

Definition at line 170 of file Layer.cpp.

171{
172 for (const auto& m_element : std::views::reverse(m_elements)) {
173 if (test_element(m_element, ndc))
174 return m_element.id;
175 }
176 return std::nullopt;
177}
std::vector< Element > m_elements
Definition Layer.hpp:313
static bool test_element(const Element &el, glm::vec2 ndc) noexcept
Definition Layer.cpp:295
void reverse(std::span< double > data) noexcept
Reverse temporal order in-place.
Definition Transform.cpp:90

References m_elements, and test_element().

Referenced by hit_test().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: