Fix indistinct selection of small objects on the timeline.
authorCarl Hetherington <cth@carlh.net>
Fri, 29 Jan 2016 22:57:19 +0000 (22:57 +0000)
committerCarl Hetherington <cth@carlh.net>
Fri, 29 Jan 2016 22:57:19 +0000 (22:57 +0000)
src/lib/rect.h
src/wx/timeline_content_view.cc
src/wx/timeline_view.cc

index 97b90abc5e28546ab74d6c0fa1115460289a0dbb..5758dd04e4496955af9b7cc994c492bf785c40b6 100644 (file)
@@ -87,6 +87,15 @@ public:
                height = std::max (y + height, other.y + other.height) - y;
        }
 
+       Rect<T> extended (T amount) const {
+               Rect<T> c = *this;
+               c.x -= amount;
+               c.y -= amount;
+               c.width += amount * 2;
+               c.height += amount * 2;
+               return c;
+       }
+
        bool contains (Position<T> p) const
        {
                return (p.x >= x && p.x <= (x + width) && p.y >= y && p.y <= (y + height));
index 858214c33945cf83fe09e6b18a1ffa86e080f1cd..98ef0abb4a3aa65a14ce9215840ff75f9d6d8573 100644 (file)
@@ -45,10 +45,10 @@ TimelineContentView::bbox () const
        }
 
        return dcpomatic::Rect<int> (
-               time_x (content->position ()) - 8,
-               y_pos (_track.get()) - 8,
-               content->length_after_trim().seconds() * _timeline.pixels_per_second().get_value_or(0) + 16,
-               _timeline.track_height() + 16
+               time_x (content->position ()),
+               y_pos (_track.get()),
+               content->length_after_trim().seconds() * _timeline.pixels_per_second().get_value_or(0),
+               _timeline.track_height()
                );
 }
 
index a1c5fb7ec75d429f6db99e59395f6cc4caef6624..fee1921ed3019caca45574ea73fdfd1551d6f26d 100644 (file)
@@ -39,8 +39,8 @@ TimelineView::paint (wxGraphicsContext* g)
 void
 TimelineView::force_redraw ()
 {
-       _timeline.force_redraw (_last_paint_bbox);
-       _timeline.force_redraw (bbox ());
+       _timeline.force_redraw (_last_paint_bbox.extended (4));
+       _timeline.force_redraw (bbox().extended (4));
 }
 
 int