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

◆ handle_move()

void MayaFlux::Portal::Forma::Context::handle_move ( double  px,
double  py 
)
private

Definition at line 277 of file Context.cpp.

278{
279 const glm::vec2 ndc = to_ndc(px, py);
280 const auto hit = m_layer->hit_test(ndc);
281
282 if (hit != m_hovered) {
283 if (m_hovered) {
284 auto it = m_callbacks.find(*m_hovered);
285 if (it != m_callbacks.end() && it->second.leave)
286 it->second.leave(*m_hovered);
287 }
288 if (hit) {
289 auto it = m_callbacks.find(*hit);
290 if (it != m_callbacks.end() && it->second.enter)
291 it->second.enter(*hit);
292 }
293 m_hovered = hit;
294 }
295
296 if (hit) {
297 auto it = m_callbacks.find(*hit);
298 if (it != m_callbacks.end() && it->second.move)
299 it->second.move(*hit, ndc);
300 }
301}
std::shared_ptr< Layer > m_layer
Definition Context.hpp:263
glm::vec2 to_ndc(double px, double py) const noexcept
Definition Context.cpp:268
std::unordered_map< uint32_t, ElementCallbacks > m_callbacks
Definition Context.hpp:269
std::optional< uint32_t > m_hovered
Definition Context.hpp:267

References m_callbacks, m_hovered, m_layer, and to_ndc().

Referenced by register_handlers().

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