fixed trimming one frame clips

This commit is contained in:
itsmattkc
2019-04-21 11:48:08 +10:00
parent 56680ff4d6
commit d386d5c7f2
+15 -10
View File
@@ -2513,8 +2513,8 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
// threshold around a trim point that the cursor can be within and still considered "trimming"
int lim = 5;
long mouse_frame_lower = panel_timeline->getTimelineFrameFromScreenPoint(pos.x()-lim)-1;
long mouse_frame_upper = panel_timeline->getTimelineFrameFromScreenPoint(pos.x()+lim)+1;
int mouse_frame_lower = pos.x() - lim;
int mouse_frame_upper = pos.x() + lim;
// used to determine whether we the cursor found a trim point or not
bool found = false;
@@ -2576,11 +2576,14 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
}
}
int visual_in_point = panel_timeline->getTimelineScreenPointFromFrame(c->timeline_in());
int visual_out_point = panel_timeline->getTimelineScreenPointFromFrame(c->timeline_out());
// is the cursor hovering around the clip's IN point?
if (c->timeline_in() > mouse_frame_lower && c->timeline_in() < mouse_frame_upper) {
if (visual_in_point > mouse_frame_lower && visual_in_point < mouse_frame_upper) {
// test how close this IN point is to the cursor
int nc = qAbs(c->timeline_in() + 1 - panel_timeline->cursor_frame);
int nc = qAbs(visual_in_point + 1 - pos.x());
// and test whether it's closer than the last in/out point we found
if (nc < closeness) {
@@ -2595,10 +2598,10 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
}
// is the cursor hovering around the clip's OUT point?
if (c->timeline_out() > mouse_frame_lower && c->timeline_out() < mouse_frame_upper) {
if (visual_out_point > mouse_frame_lower && visual_out_point < mouse_frame_upper) {
// test how close this OUT point is to the cursor
int nc = qAbs(c->timeline_out() - 1 - panel_timeline->cursor_frame);
int nc = qAbs(visual_out_point - 1 - pos.x());
// and test whether it's closer than the last in/out point we found
if (nc < closeness) {
@@ -2620,13 +2623,14 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
if (c->opening_transition != nullptr) {
// cache the timeline frame where the transition ends
long transition_point = c->timeline_in() + c->opening_transition->get_true_length();
int transition_point = panel_timeline->getTimelineScreenPointFromFrame(c->timeline_in()
+ c->opening_transition->get_true_length());
// check if the cursor is hovering around it (within the threshold)
if (transition_point > mouse_frame_lower && transition_point < mouse_frame_upper) {
// similar to above, test how close it is and if it's closer, make this active
int nc = qAbs(transition_point - 1 - panel_timeline->cursor_frame);
int nc = qAbs(transition_point - 1 - pos.x());
if (nc < closeness) {
panel_timeline->trim_target = i;
panel_timeline->trim_type = TRIM_OUT;
@@ -2641,13 +2645,14 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
if (c->closing_transition != nullptr) {
// cache the timeline frame where the transition starts
long transition_point = c->timeline_out() - c->closing_transition->get_true_length();
int transition_point = panel_timeline->getTimelineScreenPointFromFrame(c->timeline_out()
- c->closing_transition->get_true_length());
// check if the cursor is hovering around it (within the threshold)
if (transition_point > mouse_frame_lower && transition_point < mouse_frame_upper) {
// similar to above, test how close it is and if it's closer, make this active
int nc = qAbs(transition_point + 1 - panel_timeline->cursor_frame);
int nc = qAbs(transition_point + 1 - pos.x());
if (nc < closeness) {
panel_timeline->trim_target = i;
panel_timeline->trim_type = TRIM_IN;