added color picking with ALT key, added crash report library for windows
This commit is contained in:
@@ -29,7 +29,7 @@ void NodeColorQuad::set_value(float x, float y)
|
||||
{
|
||||
auto sz = GetSize();
|
||||
auto pos = glm::clamp(glm::vec2(x, y) * sz, { 0, 0 }, sz);
|
||||
m_picker->SetPosition(pos.x, pos.y);
|
||||
m_picker->SetPosition(pos - m_picker->GetSize() * .5f);
|
||||
m_value = pos / glm::max({ 1,1 }, sz); // avoid div0
|
||||
if (on_value_changed)
|
||||
on_value_changed(this, m_value);
|
||||
@@ -45,8 +45,8 @@ kEventResult NodeColorQuad::handle_event(Event* e)
|
||||
dragging = true;
|
||||
mouse_capture();
|
||||
auto sz = GetSize();
|
||||
auto pos = glm::clamp(((MouseEvent*)e)->m_pos - m_pos, { 0, 0 }, sz) - m_picker->GetSize() * .5f;
|
||||
m_picker->SetPosition(pos.x, pos.y);
|
||||
auto pos = glm::clamp(((MouseEvent*)e)->m_pos - m_pos, { 0, 0 }, sz);
|
||||
m_picker->SetPosition(pos - m_picker->GetSize() * .5f);
|
||||
m_value = pos / glm::max({ 1,1 }, sz); // avoid div0
|
||||
if (on_value_changed)
|
||||
on_value_changed(this, m_value);
|
||||
@@ -60,8 +60,8 @@ kEventResult NodeColorQuad::handle_event(Event* e)
|
||||
if (dragging)
|
||||
{
|
||||
auto sz = GetSize();
|
||||
auto pos = glm::clamp(((MouseEvent*)e)->m_pos - m_pos, { 0, 0 }, sz) - m_picker->GetSize() * .5f;
|
||||
m_picker->SetPosition(pos.x, pos.y);
|
||||
auto pos = glm::clamp(((MouseEvent*)e)->m_pos - m_pos, { 0, 0 }, sz);
|
||||
m_picker->SetPosition(pos - m_picker->GetSize() * .5f);
|
||||
m_value = pos / glm::max({ 1,1 }, sz); // avoid div0
|
||||
if (on_value_changed)
|
||||
on_value_changed(this, m_value);
|
||||
|
||||
Reference in New Issue
Block a user