Improve click area for keyframes

parent fe81b47c
......@@ -170,7 +170,7 @@ void KeyframeView::mousePressEvent(QMouseEvent *event)
bool ok;
GenTime position(pos + offset, pCore->getCurrentFps());
auto keyframe = m_model->getClosestKeyframe(position, &ok);
if (ok && qAbs(keyframe.first.frames(pCore->getCurrentFps()) - pos - offset) < 5) {
if (ok && qAbs(keyframe.first.frames(pCore->getCurrentFps()) - pos - offset) < ceil(m_lineHeight / 1.5)) {
m_currentKeyframeOriginal = keyframe.first.frames(pCore->getCurrentFps()) - offset;
// Select and seek to keyframe
m_currentKeyframe = m_currentKeyframeOriginal;
......@@ -208,7 +208,7 @@ void KeyframeView::mouseMoveEvent(QMouseEvent *event)
if (event->y() < m_lineHeight) {
bool ok;
auto keyframe = m_model->getClosestKeyframe(position, &ok);
if (ok && qAbs(keyframe.first.frames(pCore->getCurrentFps()) - pos - offset) < 5) {
if (ok && qAbs(keyframe.first.frames(pCore->getCurrentFps()) - pos - offset) < ceil(m_lineHeight / 1.5)) {
m_hoverKeyframe = keyframe.first.frames(pCore->getCurrentFps()) - offset;
setCursor(Qt::PointingHandCursor);
update();
......@@ -244,7 +244,7 @@ void KeyframeView::mouseDoubleClickEvent(QMouseEvent *event)
GenTime position(pos + offset, pCore->getCurrentFps());
bool ok;
auto keyframe = m_model->getClosestKeyframe(position, &ok);
if (ok && qAbs(keyframe.first.frames(pCore->getCurrentFps()) - pos - offset) < 5) {
if (ok && qAbs(keyframe.first.frames(pCore->getCurrentFps()) - pos - offset) < ceil(m_lineHeight / 1.5)) {
m_model->removeKeyframe(keyframe.first);
if (keyframe.first.frames(pCore->getCurrentFps()) == m_currentKeyframe + offset) {
m_currentKeyframe = m_currentKeyframeOriginal = -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment