disable brush pressure averaging, implement single finger for camera rotation when touch draw is disabled
This commit is contained in:
@@ -69,6 +69,7 @@ public:
|
||||
std::string doc_path;
|
||||
std::string doc_dir;
|
||||
std::string doc_filename;
|
||||
bool has_stylus = false;
|
||||
float width;
|
||||
float height;
|
||||
bool keys[256];
|
||||
@@ -132,6 +133,7 @@ public:
|
||||
bool key_up(kKey key);
|
||||
bool key_char(char key);
|
||||
void toggle_ui();
|
||||
void set_stylus();
|
||||
void message_box(const std::string& title, const std::string& text);
|
||||
|
||||
void rec_clear();
|
||||
|
||||
@@ -303,3 +303,10 @@ void App::toggle_ui()
|
||||
m->m_children[i]->m_display = fullscreen;
|
||||
fullscreen = !fullscreen;
|
||||
}
|
||||
|
||||
void App::set_stylus()
|
||||
{
|
||||
has_stylus = true;
|
||||
if (canvas)
|
||||
canvas->m_canvas->m_touch_lock = true;
|
||||
}
|
||||
|
||||
@@ -207,8 +207,8 @@ void ui::Stroke::add_point(glm::vec2 pos, float pressure)
|
||||
m_curve = glm::min(m_curve + 0.1f, 1.f);
|
||||
//pressure = pressure * glm::pow(m_curve, 2.f);
|
||||
#endif // __IOS__
|
||||
m_pressure_buff.add(pressure);
|
||||
pressure = m_pressure_buff.average();
|
||||
//m_pressure_buff.add(pressure);
|
||||
//pressure = m_pressure_buff.average();
|
||||
|
||||
if (m_brush.m_tip_size_pressure)
|
||||
m_step = glm::max(m_brush.m_tip_spacing * m_brush.m_tip_size * pressure * 800.f, 1.f);
|
||||
|
||||
@@ -115,7 +115,7 @@ public:
|
||||
static Canvas* I;
|
||||
NodeCanvas* m_node = nullptr;
|
||||
bool m_alpha_lock = false;
|
||||
bool m_touch_lock = true;
|
||||
bool m_touch_lock = false;
|
||||
glm::mat4 m_mv{ 1 };
|
||||
glm::mat4 m_proj{ 1 };
|
||||
glm::vec4 m_box{ 0 };
|
||||
|
||||
@@ -16,8 +16,20 @@ void CanvasModeBasicCamera::on_MouseEvent(MouseEvent* me, glm::vec2& loc)
|
||||
switch (me->m_type)
|
||||
{
|
||||
case kEventType::MouseDownL:
|
||||
if (canvas->m_touch_lock && me->m_source == kEventSource::Touch)
|
||||
{
|
||||
m_draggingR = true;
|
||||
m_dragR_start = me->m_pos;
|
||||
m_pan_start = canvas->m_pan;
|
||||
node->mouse_capture();
|
||||
}
|
||||
break;
|
||||
case kEventType::MouseUpL:
|
||||
if (canvas->m_touch_lock && me->m_source == kEventSource::Touch)
|
||||
{
|
||||
m_draggingR = false;
|
||||
node->mouse_release();
|
||||
}
|
||||
break;
|
||||
case kEventType::MouseDownR:
|
||||
if (App::I.keys[(int)kKey::KeyAlt])
|
||||
|
||||
@@ -25,6 +25,7 @@ public:
|
||||
class CanvasModeBasicCamera : public CanvasMode
|
||||
{
|
||||
bool m_draggingR = false;
|
||||
bool m_draggingT = false; // touch drag
|
||||
glm::vec2 m_dragR_start;
|
||||
glm::vec2 m_pan_start;
|
||||
float m_camera_fov;
|
||||
|
||||
20
src/main.cpp
20
src/main.cpp
@@ -561,15 +561,15 @@ int main(int argc, char** argv)
|
||||
LOG("show main window");
|
||||
ShowWindow(hWnd, SW_NORMAL);
|
||||
|
||||
// if (!sandboxed)
|
||||
// {
|
||||
// LOG("init WinTab");
|
||||
// WacomTablet::I.init(hWnd);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// LOG("SKIP init WinTab");
|
||||
// }
|
||||
if (!sandboxed)
|
||||
{
|
||||
LOG("init WinTab");
|
||||
WacomTablet::I.init(hWnd);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG("SKIP init WinTab");
|
||||
}
|
||||
|
||||
LOG("change icon");
|
||||
SendMessage(hWnd, WM_SETICON, ICON_SMALL,
|
||||
@@ -763,6 +763,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
|
||||
// }
|
||||
case WT_PACKET:
|
||||
{
|
||||
App::I.set_stylus();
|
||||
timer_stylus = 0;
|
||||
std::lock_guard<std::mutex> lock(task_mutex);
|
||||
tasklist.emplace_back([=] {
|
||||
@@ -967,6 +968,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
|
||||
WacomTablet::I.m_ink = true;
|
||||
WacomTablet::I.m_ink_pen = true;
|
||||
WacomTablet::I.m_pen_pres = (float)penInfo.pressure / 1024.f;
|
||||
App::I.set_stylus();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user