[gnome-maps] transitPlan: Use an empty compact label when color available



commit 074a3d16ad283773eee951b332566664f9f35e76
Author: Marcus Lundblad <ml update uu se>
Date:   Sun Jul 1 21:26:27 2018 +0200

    transitPlan: Use an empty compact label when color available
    
    When a route leg has a defined color, use an empty string as compact
    route name when other heuristics fails, giving colored empty badges
    in these cases in the overview list.
    
    Closes #121

 src/transitPlan.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/transitPlan.js b/src/transitPlan.js
index eac4480..6953394 100644
--- a/src/transitPlan.js
+++ b/src/transitPlan.js
@@ -447,6 +447,10 @@ var Leg = class Leg {
             /* if the above conditions are unmet, use the trip short name
              * as a fallback if it was shorter than the original route name */
             this._compactRoute = this._tripShortName;
+        } else if (this._color) {
+            /* as a fallback when the route has a defined color,
+             * use an empty compact label to get a colored badge */
+            this._compactRoute = '';
         } else {
             /* if none of the above is true, use the original route name,
              * and rely on label ellipsization */
@@ -714,4 +718,4 @@ function sortItinerariesByDepartureAsc(first, second) {
 
 function sortItinerariesByArrivalDesc(first, second) {
     return first.arrival < second.arrival;
-}
+}
\ No newline at end of file


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]