Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to draw Vertical Timebar #420

Merged
merged 4 commits into from
Dec 2, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2740,6 +2740,15 @@ <h4 class="modal-title">Advanced User Settings</h4>
<span>Show the gradient background.</span>
</label>
</div>
<div>
<label class="option">TimeBar
<input class="verticalBar ios-switch" type="checkbox" />
<div>
<div></div>
</div>
<span>Show the vertical timebar.</span>
</label>
</div>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion js/grapher.js
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ function FlightLogGrapher(flightLog, graphConfig, canvas, stickCanvas, craftCanv
}

//Draw a bar highlighting the current time if we are drawing any graphs
if (graphs.length) {
if (options.drawVerticalBar && graphs.length) {
var
centerX = canvas.width / 2;

Expand Down
15 changes: 7 additions & 8 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1346,14 +1346,13 @@ function BlackboxLogViewer() {

userSettingsDialog = new UserSettingsDialog($("#dlgUserSettings"),
function(defaultSettings) { // onLoad

prefs.get('userSettings', function(item) {
if(item) {
userSettings = item;
} else {
userSettings = defaultSettings;
}
});
prefs.get('userSettings', function(item) {
if(item) {
wolkesson marked this conversation as resolved.
Show resolved Hide resolved
userSettings = $.extend({}, defaultSettings, item);
} else {
userSettings = defaultSettings;
}
});
},

function(newSettings) { // onSave
Expand Down
9 changes: 8 additions & 1 deletion js/user_settings_dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ function UserSettingsDialog(dialog, onLoad, onSave) {
drawWatermark : false, // Show Watermark on display?
drawLapTimer : false, // Show Laptimer on display?
drawGradient : false, // Show Gradient on display?
drawVerticalBar : true, // Show vertical timebar on display?
graphSmoothOverride : false, // Ability to toggle smoothing off=normal/ on=force 0%
graphExpoOverride : false, // Ability to toggle Expo off=normal/ on=force 100%
graphGridOverride : false, // Ability to toggle Expo off=normal/ on=force 100%
Expand Down Expand Up @@ -138,6 +139,7 @@ function UserSettingsDialog(dialog, onLoad, onSave) {
transparency: $('.laptimer-settings input[name="laptimer-transparency"]').val() + '%', },
drawLapTimer: ($(".laptimer").is(":checked")),
drawGradient: ($(".gradient").is(":checked")),
drawVerticalBar: ($(".verticalBar").is(":checked")),
});
return settings;
}
Expand Down Expand Up @@ -321,7 +323,7 @@ function UserSettingsDialog(dialog, onLoad, onSave) {
// Initialise the userSettings

onLoad(defaultSettings);

wolkesson marked this conversation as resolved.
Show resolved Hide resolved
// Public variables

this.resetToDefaults = function() {
Expand Down Expand Up @@ -422,6 +424,11 @@ function UserSettingsDialog(dialog, onLoad, onSave) {
$(".gradient").prop('checked', currentSettings.drawGradient);
}

if (currentSettings.drawVerticalBar != null) {
// set the toggle switch
$(".verticalBar").prop('checked', currentSettings.drawVerticalBar);
}

dialog.modal('show');

};
Expand Down