]> git.street.me.uk Git - andy/viking.git/blobdiff - src/viktrwlayer.c
Maintain trackpoint selected when moving it.
[andy/viking.git] / src / viktrwlayer.c
index 1f66c15544a21fc3a7cb529687139ae38bb8888b..a5d79e1db0bf9712043ac953d7c550cc2b130b3a 100644 (file)
@@ -8294,8 +8294,12 @@ static gboolean trw_layer_select_release ( VikTrwLayer *vtl, GdkEventButton *eve
 
     // Determine if working on a waypoint or a trackpoint
     if ( t->is_waypoint ) {
+      // Update waypoint position
       vtl->current_wp->coord = new_coord;
       trw_layer_calculate_bounds_waypoints ( vtl );
+      // Reset waypoint pointer
+      vtl->current_wp    = NULL;
+      vtl->current_wp_id = NULL;
     }
     else {
       if ( vtl->current_tpl ) {
@@ -8304,17 +8308,13 @@ static gboolean trw_layer_select_release ( VikTrwLayer *vtl, GdkEventButton *eve
         if ( vtl->current_tp_track )
           vik_track_calculate_bounds ( vtl->current_tp_track );
 
-       if ( vtl->tpwin )
+        if ( vtl->tpwin )
           if ( vtl->current_tp_track )
             vik_trw_layer_tpwin_set_tp ( vtl->tpwin, vtl->current_tpl, vtl->current_tp_track->name );
+        // NB don't reset the selected trackpoint, thus ensuring it's still in the tpwin
       }
     }
 
-    // Reset
-    vtl->current_wp    = NULL;
-    vtl->current_wp_id = NULL;
-    trw_layer_cancel_current_tp ( vtl, FALSE );
-
     vik_layer_emit_update ( VIK_LAYER(vtl) );
     return TRUE;
   }