MayaFlux 1.0.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 442 of file Context.cpp.

443{
444 const glm::vec2 ndc = to_ndc(px, py);
445 const int btn_idx = static_cast<int>(btn);
446
447 if (!m_dragging[btn_idx]) {
448 const auto hit = m_layer->hit_test(ndc);
449 if (hit)
450 m_dragging[btn_idx] = hit;
451 else
452 return;
453 }
454
455 auto it = m_callbacks.find(*m_dragging[btn_idx]);
456 if (it != m_callbacks.end() && it->second.drag.count(btn_idx))
457 it->second.drag[btn_idx](*m_dragging[btn_idx], ndc);
458}
uint32_t py
uint32_t px
std::optional< uint32_t > m_dragging[3]
Definition Context.hpp:382
std::shared_ptr< Layer > m_layer
Definition Context.hpp:355
glm::vec2 to_ndc(double px, double py) const noexcept
Definition Context.cpp:338
std::unordered_map< uint32_t, ElementCallbacks > m_callbacks
Definition Context.hpp:361

References m_callbacks, m_dragging, m_layer, px, py, and to_ndc().

Referenced by handle_drags().

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