implement canvas touch lock
This commit is contained in:
@@ -28,35 +28,38 @@ void App::hideKeyboard()
|
||||
#endif
|
||||
}
|
||||
|
||||
bool App::mouse_down(int button, float x, float y, float pressure)
|
||||
bool App::mouse_down(int button, float x, float y, float pressure, kEventSource source)
|
||||
{
|
||||
redraw = true;
|
||||
MouseEvent e;
|
||||
e.m_type = button ? kEventType::MouseDownR : kEventType::MouseDownL;
|
||||
e.m_pos = { x / zoom, y / zoom };
|
||||
e.m_pressure = pressure;
|
||||
e.m_source = source;
|
||||
auto ret = layout[main_id]->on_event(&e);
|
||||
layout[main_id]->update();
|
||||
return ret == kEventResult::Consumed;
|
||||
}
|
||||
bool App::mouse_move(float x, float y, float pressure)
|
||||
bool App::mouse_move(float x, float y, float pressure, kEventSource source)
|
||||
{
|
||||
redraw = true;
|
||||
MouseEvent e;
|
||||
e.m_type = kEventType::MouseMove;
|
||||
e.m_pos = { x / zoom, y / zoom };
|
||||
e.m_pressure = pressure;
|
||||
e.m_source = source;
|
||||
kEventResult ret = kEventResult::Available;
|
||||
if (auto* main = layout[main_id])
|
||||
ret = main->on_event(&e);
|
||||
return ret == kEventResult::Consumed;
|
||||
}
|
||||
bool App::mouse_up(int button, float x, float y)
|
||||
bool App::mouse_up(int button, float x, float y, kEventSource source)
|
||||
{
|
||||
redraw = true;
|
||||
MouseEvent e;
|
||||
e.m_type = button ? kEventType::MouseUpR : kEventType::MouseUpL;
|
||||
e.m_pos = { x / zoom, y / zoom };
|
||||
e.m_source = source;
|
||||
auto ret = layout[main_id]->on_event(&e);
|
||||
layout[main_id]->update();
|
||||
return ret == kEventResult::Consumed;
|
||||
|
||||
Reference in New Issue
Block a user