}
}
-int AbstractClipItem::mouseOverKeyFrames(QPointF pos)
+int AbstractClipItem::mouseOverKeyFrames(QPointF pos, double maxOffset)
{
- QRectF br = sceneBoundingRect();
+ const QRectF br = sceneBoundingRect();
double maxw = br.width() / cropDuration().frames(m_fps);
double maxh = br.height() / 100.0 * m_keyframeFactor;
if (m_keyframes.count() > 1) {
while (i != m_keyframes.constEnd()) {
x1 = br.x() + maxw * (i.key() - cropStart().frames(m_fps));
y1 = br.bottom() - i.value() * maxh;
- if (qAbs(pos.x() - x1) < 6 && qAbs(pos.y() - y1) < 6) {
+ if (qAbs(pos.x() - x1) < maxOffset && qAbs(pos.y() - y1) < 10) {
setToolTip('[' + QString::number((GenTime(i.key(), m_fps) - cropStart()).seconds(), 'f', 2) + i18n("seconds") + ", " + QString::number(i.value(), 'f', 1) + "%]");
return i.key();
} else if (x1 > pos.x()) break;
double m_fps;
//QRect visibleRect();
void drawKeyFrames(QPainter *painter, QRectF exposedRect);
- int mouseOverKeyFrames(QPointF pos);
+ int mouseOverKeyFrames(QPointF pos, double maxOffset);
virtual void mousePressEvent(QGraphicsSceneMouseEvent * event);
};
OPERATIONTYPE ClipItem::operationMode(QPointF pos)
{
if (isItemLocked()) return NONE;
-
+ const double scale = projectScene()->scale().x();
+ double maximumOffset = 6 / scale;
if (isSelected() || (parentItem() && parentItem()->isSelected())) {
- m_editedKeyframe = mouseOverKeyFrames(pos);
+ m_editedKeyframe = mouseOverKeyFrames(pos, maximumOffset);
if (m_editedKeyframe != -1) return KEYFRAME;
}
QRectF rect = sceneBoundingRect();
- const double scale = projectScene()->scale().x();
- double maximumOffset = 6 / scale;
int addtransitionOffset = 10;
// Don't allow add transition if track height is very small
if (rect.height() < 30) addtransitionOffset = 0;
m_animation = NULL;
double verticalPos = mapToScene(QPoint(0, viewport()->height() / 2)).y();
setMatrix(matrix);
+ m_cursorLine->setLine(m_cursorLine->line().x1(), 0, m_cursorLine->line().x1(), m_tracksHeight * m_document->tracksCount() * verticalScale);
int diff = sceneRect().width() - m_projectDuration;
if (diff * matrix.m11() < 50) {
if (matrix.m11() < 0.4) setSceneRect(0, 0, (m_projectDuration + 100 / matrix.m11()), sceneRect().height());