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

◆ handle_drag()

void MayaFlux::Portal::Forma::Context::handle_drag ( double  px,
double  py,
IO::MouseButtons  btn 
)
private

Definition at line 342 of file Context.cpp.

343{
344 const glm::vec2 ndc = to_ndc(px, py);
345 const int btn_idx = static_cast<int>(btn);
346
347 if (!m_dragging[btn_idx]) {
348 const auto hit = m_layer->hit_test(ndc);
349 if (hit)
350 m_dragging[btn_idx] = hit;
351 else
352 return;
353 }
354
355 auto it = m_callbacks.find(*m_dragging[btn_idx]);
356 if (it != m_callbacks.end() && it->second.drag.count(btn_idx))
357 it->second.drag[btn_idx](*m_dragging[btn_idx], ndc);
358}
std::optional< uint32_t > m_dragging[3]
Definition Context.hpp:268
std::shared_ptr< Layer > m_layer
Definition Context.hpp:246
glm::vec2 to_ndc(double px, double py) const noexcept
Definition Context.cpp:254
std::unordered_map< uint32_t, ElementCallbacks > m_callbacks
Definition Context.hpp:252

References m_callbacks, m_dragging, 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: