added more snapping

This commit is contained in:
itsmattkc
2018-06-09 01:59:16 -07:00
parent cf18e52e90
commit b8fc5f4dac
6 changed files with 116 additions and 6 deletions
+21
View File
@@ -454,6 +454,27 @@ void Timeline::split_at_playhead() {
if (split_selected) redraw_all_clips();
}
void Timeline::snap_to_clip(long* l) {
int limit = 10;
snapped = false;
for (int i=0;i<sequence->clip_count();i++) {
Clip* c = sequence->get_clip(i);
if (*l > c->timeline_in-limit-1 &&
*l < c->timeline_in+limit+1) {
*l = c->timeline_in;
snapped = true;
snap_point = c->timeline_in;
break;
} else if (*l > c->timeline_out-limit-1 &&
*l < c->timeline_out+limit+1) {
*l = c->timeline_out;
snapped = true;
snap_point = c->timeline_out;
break;
}
}
}
long Timeline::getFrameFromScreenPoint(int x) {
long f = round((float) x / zoom);
if (f < 0) {