After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 777559 - Add shortcut to reverse a route
Add shortcut to reverse a route
Status: RESOLVED FIXED
Product: gnome-maps
Classification: Applications
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: gnome-maps-maint
gnome-maps-maint
Depends on:
Blocks:
 
 
Reported: 2017-01-21 08:39 UTC by Marcus Lundblad
Modified: 2017-02-16 20:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
routing: Add button to quickly reverse a route search (3.59 KB, patch)
2017-01-22 21:26 UTC, Marcus Lundblad
none Details | Review
routing: Add button to quickly reverse a route search (3.12 KB, patch)
2017-01-22 21:31 UTC, Marcus Lundblad
none Details | Review
screenshot (908.75 KB, image/png)
2017-01-23 12:22 UTC, Andreas Nilsson
  Details
icon (5.47 KB, image/svg+xml)
2017-02-14 13:35 UTC, Andreas Nilsson
  Details
Add icon for reversing a route (6.32 KB, patch)
2017-02-15 21:02 UTC, Marcus Lundblad
committed Details | Review
routing: Add button to quickly reverse a route search (3.25 KB, patch)
2017-02-15 21:02 UTC, Marcus Lundblad
none Details | Review
routing: Add button to quickly reverse a route search (3.24 KB, patch)
2017-02-15 21:07 UTC, Marcus Lundblad
committed Details | Review

Description Marcus Lundblad 2017-01-21 08:39:45 UTC
When doing a route search it could be convenient with a button that reverses
the list.
I think one of the interview persons in Andreas' public transportation survey
had one such usecase (search for a route to go to a pub in town, and then change
direction and set a late time to see when the last bus home goes), but now I couldn't find it.
It is possible now also, by dragging the points, but it is a bit awkward,
and especially with extra stops inbetween.
One option might be to have a "switch direction" button next to the last route entry (where there is a + button at the top and a - button for intermediate entries to add and remove them).
Comment 1 Marcus Lundblad 2017-01-22 21:26:27 UTC
Created attachment 344004 [details] [review]
routing: Add button to quickly reverse a route search

Adds a button to reverse a route search.
Comment 2 Marcus Lundblad 2017-01-22 21:29:33 UTC
NOTE: the above patch is kinda WIP, it uses a "temporary icon" (I think it comes from Evolution, it sports up and down arrows, and seemed good enough to "prove the point").
I cooked this up more as a quick evening proof-of-concept.
And it probably makes sense to revise this after landing the transit-routing branch, as this will probably need a bit of rebasing after that (and ofcourse a more permanent solution with the icon would be needed).
Comment 3 Marcus Lundblad 2017-01-22 21:31:37 UTC
Created attachment 344005 [details] [review]
routing: Add button to quickly reverse a route search

Adds a button to reverse a route search.
Comment 4 Andreas Nilsson 2017-01-23 12:22:14 UTC
Created attachment 344025 [details]
screenshot
Comment 5 Andreas Nilsson 2017-01-23 12:24:38 UTC
Seems to work well.
Looks good to me, UI-wise.
Comment 6 Jonas Danielsson 2017-01-23 12:28:48 UTC
Review of attachment 344005 [details] [review]:

Nice!

Some questions

::: src/routeEntry.js
@@ +77,3 @@
             this._icon.icon_name = 'maps-point-end-symbolic';
+            /* TODO: only use this icon temporarily */
+            this._buttonImage.icon_name = 'mail-send-receive-symbolic';

How temporarily, should this be committed to master? What is the plan for this icon?

::: src/sidebar.js
@@ +146,3 @@
             });
+        } else if (type === RouteEntry.Type.TO) {
+            routeEntry.button.connect('clicked', function() {

could this be routeEntry.button.connect('clicked',
                                        this._reverseRoute.bind(this));

Is it prettier?

@@ -248,0 +252,12 @@
+    _reverseRoutePoints: function() {
+        let query = Application.routeService.query;
+        let points = query.points;
... 9 more ...

We do not have the array.reverse() javascript function ?
Comment 7 Marcus Lundblad 2017-01-23 20:12:22 UTC
(In reply to Jonas Danielsson from comment #6)
> Review of attachment 344005 [details] [review] [review]:
> 
> Nice!
> 
> Some questions
> 
> ::: src/routeEntry.js
> @@ +77,3 @@
>              this._icon.icon_name = 'maps-point-end-symbolic';
> +            /* TODO: only use this icon temporarily */
> +            this._buttonImage.icon_name = 'mail-send-receive-symbolic';
> 
> How temporarily, should this be committed to master? What is the plan for
> this icon?
> 
Not sure, the icon actually comes from adwaita-icon-theme when I took a closer look.
Though, I was kinda thinking about waiting with this patch, since it would need some rebase gymnastics in the transit-routing branch (as the route query was moved out from routeService.js, which is for GraphHopper, to application.js to be used by the OpenTripPlanner module as well.

> ::: src/sidebar.js
> @@ +146,3 @@
>              });
> +        } else if (type === RouteEntry.Type.TO) {
> +            routeEntry.button.connect('clicked', function() {
> 
> could this be routeEntry.button.connect('clicked',
>                                         this._reverseRoute.bind(this));
> 
> Is it prettier?
> 
Makes sense.

> @@ -248,0 +252,12 @@
> +    _reverseRoutePoints: function() {
> +        let query = Application.routeService.query;
> +        let points = query.points;
> ... 9 more ...
> 
> We do not have the array.reverse() javascript function ?

Yes, however in RouteQuery, the objects in the "points" array are RouteQueryPoints, on which the "place" parameter is connected a notification handler. Something similar is done in _reorderRoutePoints() which is called when dragging an entry. So, in essense the place properties on the RouteQuery objects are exchanged.
Comment 8 Andreas Nilsson 2017-01-24 11:00:00 UTC
(In reply to Jonas Danielsson from comment #6)
> ::: src/routeEntry.js
> @@ +77,3 @@
>              this._icon.icon_name = 'maps-point-end-symbolic';
> +            /* TODO: only use this icon temporarily */
> +            this._buttonImage.icon_name = 'mail-send-receive-symbolic';
> 
> How temporarily, should this be committed to master? What is the plan for
> this icon?

Yeah, this icon name seems a bit risky under other icon themes.
Adding Jimmac and Lapo to cc.
What's the best approach here?
Comment 9 Andreas Nilsson 2017-02-13 19:36:02 UTC
Maybe it's easiest to ship our own copy of the icon under the name route-reverse-symbolic
Comment 10 Marcus Lundblad 2017-02-14 07:13:22 UTC
(In reply to Andreas Nilsson from comment #9)
> Maybe it's easiest to ship our own copy of the icon under the name
> route-reverse-symbolic

Yeah, maybe that is the easiest option.
Comment 11 Andreas Nilsson 2017-02-14 13:35:07 UTC
Created attachment 345731 [details]
icon

this is just the mail icon renamed.
Comment 12 Marcus Lundblad 2017-02-15 21:02:11 UTC
Created attachment 345880 [details] [review]
Add icon for reversing a route

This icon is just a copy of the "mail send/receive" icon from the
Adwaita icon theme.
Comment 13 Marcus Lundblad 2017-02-15 21:02:46 UTC
Created attachment 345881 [details] [review]
routing: Add button to quickly reverse a route search

Adds a button to reverse a route search.
Comment 14 Marcus Lundblad 2017-02-15 21:07:25 UTC
Created attachment 345882 [details] [review]
routing: Add button to quickly reverse a route search

Adds a button to reverse a route search.
Comment 15 Marcus Lundblad 2017-02-15 21:09:33 UTC
Added a patch installing the copy of the icon.
And rebased the main patch to the new "post transit merge" era :)
Also added a comment about the rational behind the array shuffling when reversing.
Comment 16 Jonas Danielsson 2017-02-16 06:11:33 UTC
Review of attachment 345880 [details] [review]:

yes
Comment 17 Jonas Danielsson 2017-02-16 06:12:56 UTC
Review of attachment 345882 [details] [review]:

lgtm

::: src/routeEntry.js
@@ +76,3 @@
         case Type.TO:
             this._icon.icon_name = 'maps-point-end-symbolic';
+            this._buttonImage.icon_name = 'route-reverse-symbolic';

before you push, you _could_ change the order of these assignments to match FROM and VIA which do buttomImage then icon_name.
Comment 18 Marcus Lundblad 2017-02-16 20:30:55 UTC
Attachment 345880 [details] pushed as 770d4db - Add icon for reversing a route
Attachment 345882 [details] pushed as 62d6188 - routing: Add button to quickly reverse a route search