fix direction for line tool

This commit is contained in:
2019-03-02 18:57:01 +01:00
parent 5c3dcaa4af
commit 62e037dd1a
2 changed files with 4 additions and 2 deletions

View File

@@ -189,9 +189,10 @@ std::vector<StrokeSample> Stroke::compute_samples()
auto pos = glm::lerp(A.pos, B.pos, t);
float pressure = glm::lerp(A.pressure, B.pressure, t);
if (m_dir_dist > m_dir_step && m_last_kp != m_dir_kp)
if (m_dir_dist > m_dir_step)
{
glm::vec2 v = glm::normalize(m_keypoints[m_last_kp].pos - m_keypoints[m_dir_kp].pos);
int next_kp = m_last_kp == m_dir_kp ? m_last_kp + 1 : m_dir_kp;
glm::vec2 v = glm::normalize(m_keypoints[m_last_kp].pos - m_keypoints[next_kp].pos);
m_dir_angle = -glm::orientedAngle(v, m_dir_ref);
if (m_brush->m_tip_angle_smooth > 0 && (glm::abs(m_dir_angle) > glm::radians(30.f) || !m_dir_valid))
{

View File

@@ -291,6 +291,7 @@ void CanvasModeLine::on_MouseEvent(MouseEvent* me, glm::vec2& loc)
{
Canvas::I->stroke_start({ m_drag_start, 0 }, 1.f);
Canvas::I->stroke_update({ m_drag_pos, 0 }, 1.f);
Canvas::I->stroke_draw();
Canvas::I->stroke_end();
}
m_dragging = false;