@@ -98,6 +98,10 @@ function BlackboxLogViewer() {
9898 fieldPresenter = FlightLogFieldPresenter ,
9999
100100 hasVideo = false , hasLog = false , hasMarker = false , // add measure feature
101+ hasTable = true , hasCraft = true , hasSticks = true ,
102+
103+ isFullscreen = false , // New fullscreen feature (to hide table)
104+
101105 video = $ ( ".log-graph video" ) [ 0 ] ,
102106 canvas = $ ( "#graphCanvas" ) [ 0 ] ,
103107 craftCanvas = $ ( "#craftCanvas" ) [ 0 ] ,
@@ -168,41 +172,48 @@ function BlackboxLogViewer() {
168172 fieldNames = flightLog . getMainFieldNames ( ) ;
169173
170174 $ ( "tr:not(:first)" , table ) . remove ( ) ;
171-
175+
172176 if ( frame ) {
173- var
174- rows = [ ] ,
175- rowCount = Math . ceil ( fieldNames . length / 2 ) ;
176-
177- for ( i = 0 ; i < rowCount ; i ++ ) {
177+
178+ if ( hasTable ) { // Only redraw the table if it is enabled
179+
178180 var
179- row =
180- "<tr>" +
181- '<td>' + fieldPresenter . fieldNameToFriendly ( fieldNames [ i ] ) + '</td>' +
182- '<td class="raw-value">' + atMost2DecPlaces ( frame [ i ] ) + '</td>' +
183- '<td>' + fieldPresenter . decodeFieldToFriendly ( flightLog , fieldNames [ i ] , frame [ i ] ) + "</td>" ,
184-
185- secondColumn = i + rowCount ;
186-
187- if ( secondColumn < fieldNames . length ) {
188- row +=
189- '<td>' + fieldPresenter . fieldNameToFriendly ( fieldNames [ secondColumn ] ) + '</td>' +
190- '<td>' + atMost2DecPlaces ( frame [ secondColumn ] ) + '</td>' +
191- '<td>' + fieldPresenter . decodeFieldToFriendly ( flightLog , fieldNames [ secondColumn ] , frame [ secondColumn ] ) + '</td>' ;
181+ rows = [ ] ,
182+ rowCount = Math . ceil ( fieldNames . length / 2 ) ;
183+
184+ for ( i = 0 ; i < rowCount ; i ++ ) {
185+ var
186+ row =
187+ "<tr>" +
188+ '<td>' + fieldPresenter . fieldNameToFriendly ( fieldNames [ i ] ) + '</td>' +
189+ '<td class="raw-value">' + atMost2DecPlaces ( frame [ i ] ) + '</td>' +
190+ '<td>' + fieldPresenter . decodeFieldToFriendly ( flightLog , fieldNames [ i ] , frame [ i ] ) + "</td>" ,
191+
192+ secondColumn = i + rowCount ;
193+
194+ if ( secondColumn < fieldNames . length ) {
195+ row +=
196+ '<td>' + fieldPresenter . fieldNameToFriendly ( fieldNames [ secondColumn ] ) + '</td>' +
197+ '<td>' + atMost2DecPlaces ( frame [ secondColumn ] ) + '</td>' +
198+ '<td>' + fieldPresenter . decodeFieldToFriendly ( flightLog , fieldNames [ secondColumn ] , frame [ secondColumn ] ) + '</td>' ;
199+ }
200+
201+ row += "</tr>" ;
202+
203+ rows . push ( row ) ;
192204 }
193-
194- row += "</tr>" ;
195-
196- rows . push ( row ) ;
205+
206+ table . append ( rows . join ( "" ) ) ;
197207 }
198208
199- table . append ( rows . join ( "" ) ) ;
200-
201209 // update time field on toolbar
202210 $ ( ".graph-time" ) . val ( formatTime ( ( currentBlackboxTime - flightLog . getMinTime ( ) ) / 1000 , true ) ) ;
203211 if ( hasMarker ) {
204212 $ ( ".graph-time-marker" ) . val ( formatTime ( ( currentBlackboxTime - markerTime ) / 1000 , true ) ) ;
205213 }
214+
215+ // Update the Legend Values
216+ if ( graphLegend ) graphLegend . updateValues ( flightLog , frame ) ;
206217 }
207218 }
208219
@@ -561,6 +572,8 @@ function BlackboxLogViewer() {
561572
562573 hasLog = true ;
563574 $ ( "html" ) . addClass ( "has-log" ) ;
575+ ( hasCraft ) ?$ ( "html" ) . addClass ( "has-craft" ) :$ ( "html" ) . removeClass ( "has-craft" ) ;
576+ ( hasTable ) ?$ ( "html" ) . addClass ( "has-table" ) :$ ( "html" ) . removeClass ( "has-table" ) ;
564577
565578 selectLog ( null ) ;
566579 } ;
@@ -613,6 +626,11 @@ function BlackboxLogViewer() {
613626 ( state ) ?$ ( "html" ) . addClass ( "has-marker" ) :$ ( "html" ) . removeClass ( "has-marker" ) ;
614627 }
615628
629+ function setFullscreen ( state ) { // update fullscreen status
630+ isFullscreen = state ;
631+ ( state ) ?$ ( "html" ) . addClass ( "is-fullscreen" ) :$ ( "html" ) . removeClass ( "is-fullscreen" ) ;
632+ }
633+
616634 this . getMarker = function ( ) { // get marker field
617635 return {
618636 state :hasMarker ,
@@ -673,7 +691,27 @@ function BlackboxLogViewer() {
673691 graphLegend . hide ( ) ;
674692 }
675693 } ) ;
676-
694+
695+ prefs . get ( 'hasCraft' , function ( item ) {
696+ if ( item ) {
697+ hasCraft = item ;
698+ ( hasCraft ) ?$ ( "html" ) . addClass ( "has-craft" ) :$ ( "html" ) . removeClass ( "has-craft" ) ;
699+ }
700+ } ) ;
701+
702+ prefs . get ( 'hasSticks' , function ( item ) {
703+ if ( item ) {
704+ hasSticks = item ;
705+ }
706+ } ) ;
707+
708+ prefs . get ( 'hasTable' , function ( item ) {
709+ if ( item ) {
710+ hasTable = item ;
711+ ( hasTable ) ?$ ( "html" ) . addClass ( "has-table" ) :$ ( "html" ) . removeClass ( "has-table" ) ;
712+ }
713+ } ) ;
714+
677715 $ ( ".file-open" ) . change ( function ( e ) {
678716 var
679717 files = e . target . files ,
@@ -699,6 +737,25 @@ function BlackboxLogViewer() {
699737 }
700738 } ) ;
701739
740+ // New View Controls
741+ $ ( ".view-craft" ) . click ( function ( ) {
742+ hasCraft = ! hasCraft ;
743+ ( hasCraft ) ?$ ( "html" ) . addClass ( "has-craft" ) :$ ( "html" ) . removeClass ( "has-craft" ) ;
744+ prefs . set ( 'hasCraft' , hasCraft ) ;
745+ } ) ;
746+
747+ $ ( ".view-sticks" ) . click ( function ( ) {
748+ hasSticks = ! hasSticks ;
749+ graph . setDrawSticks ( hasSticks ) ;
750+ prefs . set ( 'hasSticks' , hasSticks ) ;
751+ invalidateGraph ( ) ;
752+ } ) ;
753+
754+ $ ( ".view-table" ) . click ( function ( ) {
755+ hasTable = ! hasTable ;
756+ ( hasTable ) ?$ ( "html" ) . addClass ( "has-table" ) :$ ( "html" ) . removeClass ( "has-table" ) ;
757+ prefs . set ( 'hasTable' , hasTable ) ;
758+ } ) ;
702759
703760 var logJumpBack = function ( ) {
704761 if ( hasVideo ) {
0 commit comments