Don't show reel labels if there is no space.
authorCarl Hetherington <cth@carlh.net>
Wed, 2 Dec 2015 11:35:11 +0000 (11:35 +0000)
committerCarl Hetherington <cth@carlh.net>
Wed, 2 Dec 2015 11:35:11 +0000 (11:35 +0000)
src/wx/timeline_reels_view.cc

index 6013c60a7ec875ed6ed5a2b769a450c6adf801cf..cc9d401cf1430bb700ed97d190e2b56429b2fc6d 100644 (file)
@@ -86,7 +86,10 @@ TimelineReelsView::do_paint (wxGraphicsContext* gc)
                wxDouble str_leading;
                gc->GetTextExtent (str, &str_width, &str_height, &str_descent, &str_leading);
 
-               int const tx = time_x (DCPTime((i.from.get() + i.to.get()) / 2));
-               gc->DrawText (str, tx - str_width / 2, _y + 4);
+               int const available_width = time_x (DCPTime (i.to.get() - i.from.get()));
+
+               if (available_width > str_width) {
+                       gc->DrawText (str, time_x (DCPTime (i.from.get())) + (available_width - str_width) / 2, _y + 4);
+               }
        }
 }