summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_drag.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2020-04-05 20:19:26 +0200
committerRobin Gareus <robin@gareus.org>2020-04-05 20:24:11 +0200
commitfbc48bdf3423a9d325f7b7275cff509915ae98e7 (patch)
tree0e0157ff9e0473f30d3e224a3a740abb9ecf9333 /gtk2_ardour/editor_drag.cc
parent14a2a50e9330756025a980a1197e4e7d42debcb7 (diff)
Fix end vs. length bug when creating regions - #7978
set_length() includes the end. A Region starting at 0 and ending at 0, has a length of 1 (think counting fence-posts, or video-frames).
Diffstat (limited to 'gtk2_ardour/editor_drag.cc')
-rw-r--r--gtk2_ardour/editor_drag.cc10
1 files changed, 2 insertions, 8 deletions
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index 8670910216..81d3bae02d 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -2484,15 +2484,9 @@ RegionCreateDrag::motion (GdkEvent* event, bool first_move)
_region->set_initial_position (f);
}
- /* Don't use a zero-length region, and subtract 1 sample from the snapped length
- so that if this region is duplicated, its duplicate starts on
- a snap point rather than 1 sample after a snap point. Otherwise things get
- a bit confusing as if a region starts 1 sample after a snap point, one cannot
- place snapped notes at the start of the region.
- */
if (f != grab_sample()) {
- samplecnt_t const len = (samplecnt_t) fabs ((double)(f - grab_sample () - 1));
- _region->set_length (len < 1 ? 1 : len, _editor->get_grid_music_divisions (event->button.state));
+ samplecnt_t const len = ::llabs (f - grab_sample ());
+ _region->set_length (len, _editor->get_grid_music_divisions (event->button.state));
}
}
}