Skip to content

Commit

Permalink
Fix OSD (HD) display overflow on Android (#3241)
Browse files Browse the repository at this point in the history
* Fix OSD (HD) display overflow on Android
* Add button for OSD tab orientation (Android)
  • Loading branch information
haslinghuis committed Jan 15, 2023
1 parent b407740 commit 4b0d446
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions locales/en/messages.json
Expand Up @@ -4839,6 +4839,9 @@
"message": "Uploaded all {{length}} characters to the OSD"
},

"osdToggleOrientation": {
"message": "Orientation"
},
"osdSetupSave": {
"message": "Save"
},
Expand Down
2 changes: 1 addition & 1 deletion src/css/tabs/osd.less
Expand Up @@ -541,7 +541,7 @@ button {
@media all and (max-width: 575px) {
.tab-osd {
.osd-preview {
min-width: 100%;
width: fit-content;
order: 1;
}
.osd-feature {
Expand Down
8 changes: 8 additions & 0 deletions src/js/tabs/osd.js
Expand Up @@ -2609,6 +2609,8 @@ osd.initialize = function(callback) {
// must invoke before i18n.localizePage() since it adds translation keys for expected logo size
LogoManager.init(FONT, SYM.LOGO);

$('div.btn.orientation').toggle(GUI.isCordova());

// translate to user-selected language
i18n.localizePage();

Expand Down Expand Up @@ -3281,6 +3283,8 @@ osd.initialize = function(callback) {
self.analyticsChanges = {};
});

$('a.orientation').on('click', () => screen.orientation.lock(screen.orientation.type.startsWith("portrait") ? "landscape" : "portrait"));

// font preview window
const fontPreviewElement = $('.font-preview');

Expand Down Expand Up @@ -3411,6 +3415,10 @@ osd.cleanup = function(callback) {
OSD.GUI.fontManager.destroy();
}

if (GUI.isCordova()) {
window.screen.orientation.lock("portrait");
}

// unbind "global" events
$(document).unbind('keypress');
$(document).off('click', 'span.progressLabel a');
Expand Down
3 changes: 3 additions & 0 deletions src/tabs/osd.html
Expand Up @@ -197,6 +197,9 @@ <h3 i18n="osdSetupCustomLogoInfoTitle"></h3>

<div class="supported hide">
<div class="content_toolbar" style="left:0;">
<div class="btn orientation">
<a class="orientation" href="#" i18n="osdToggleOrientation"></a>
</div>
<div class="btn">
<a class="requires-max7456-font-device-detected fonts" id="fontmanager" href="#" i18n="osdSetupFontManager"></a>
</div>
Expand Down

0 comments on commit 4b0d446

Please sign in to comment.