From 1fd1ad1f5220c0a567ca3839b32393b9ce274589 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Wed, 8 Dec 2021 17:37:15 +0200 Subject: Mobile: Hide iOS text view background; Translation panel positioning Mobile panels should always be root-parented, but the source document relationship is currently not communicated in any other way. --- src/ios.m | 2 +- src/ui/documentwidget.c | 5 +++++ src/ui/util.c | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ios.m b/src/ios.m index 6a30c8a8..021e354d 100644 --- a/src/ios.m +++ b/src/ios.m @@ -759,7 +759,7 @@ void init_SystemTextInput(iSystemTextInput *d, iRect rect, int flags) { } else { UITextView *view = REF_d_view; - [view setBackgroundColor:backgroundColor]; + [view setBackgroundColor:[UIColor colorWithWhite:1.0f alpha:0.0f]]; [view setTextColor:textColor]; [view setTintColor:tintColor]; [view setEditable:YES]; diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 3dadb911..a9a0e07c 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c @@ -3204,6 +3204,11 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) else if (equal_Command(cmd, "document.translate") && d == document_App()) { if (!d->translation) { d->translation = new_Translation(d); + if (isUsingPanelLayout_Mobile()) { + const iRect safe = safeRect_Root(w->root); + d->translation->dlg->rect.pos = windowToLocal_Widget(w, zero_I2()); + d->translation->dlg->rect.size = safe.size; + } } return iTrue; } diff --git a/src/ui/util.c b/src/ui/util.c index 6e139856..21067bf4 100644 --- a/src/ui/util.c +++ b/src/ui/util.c @@ -1655,7 +1655,8 @@ static void updateValueInputSizing_(iWidget *dlg) { } else { dlg->rect.size.x = - iMin(rootSize.x, iMaxi(iMaxi(100 * gap_UI, title->rect.size.x), prompt->rect.size.x)); + iMin(rootSize.x, iMaxi(iMaxi(100 * gap_UI, title ? title->rect.size.x : 0), + prompt->rect.size.x)); } /* Adjust the maximum number of visible lines. */ int footer = 6 * gap_UI; -- cgit v1.2.3