Showing 1 changed files with 16 additions and 1 deletions
+16 -1
Nasal/buttons.nas
... ...
@@ -243,7 +243,22 @@ var buttonsClass = {
243 243
         me.device.buttons.MENU = me.device.buttons.CLR;
244 244
     },
245 245
 
246
-    DirectTo : void,
246
+    DirectTo : func (a) {
247
+        if (a) return;
248
+        if (me.device.windows.selected == nil) return;
249
+        var (id, selected) = split('-', me.device.windows.selected);
250
+        var state = me.device.windows.state[id];
251
+        selected += state.scroll.offset;
252
+        var scratch = props.globals.getNode('/instrumentation/gps/scratch');
253
+        if (contains(state.objects[selected], 'dto')) {
254
+            scratch.setValue('longitude-deg', state.objects[selected].dto.lon);
255
+            scratch.setValue('latitude-deg', state.objects[selected].dto.lat);
256
+            scratch.setValue('ident', state.objects[selected].dto.id);
257
+            scratch.setValue('altitude-ft', data.alt);
258
+            setprop('/instrumentation/gps/command', 'direct');
259
+        }
260
+    },
261
+
247 262
     MENU : void,
248 263
     FPL : void,
249 264
     PROC : void,