From 738ccc2aab507cbd55cdb9d99a4f87693085c9bb Mon Sep 17 00:00:00 2001 From: catboxanon <122327233+catboxanon@users.noreply.github.com> Date: Sun, 20 Aug 2023 05:51:02 -0400 Subject: [PATCH] Fix generate button swapping places when mobile layout is triggered --- extensions-builtin/mobile/javascript/mobile.js | 8 +++++++- modules/ui.py | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/extensions-builtin/mobile/javascript/mobile.js b/extensions-builtin/mobile/javascript/mobile.js index 12cae4b7576..4de1407c652 100644 --- a/extensions-builtin/mobile/javascript/mobile.js +++ b/extensions-builtin/mobile/javascript/mobile.js @@ -18,7 +18,13 @@ function reportWindowSize() { for (var tab of ["txt2img", "img2img"]) { var button = gradioApp().getElementById(tab + '_generate_box'); - var target = gradioApp().getElementById(currentlyMobile ? tab + '_results' : tab + '_actions_column'); + var target = null; + if (currentlyMobile) { + target = gradioApp().getElementById(tab + '_results'); + } else { + target = gradioApp().getElementById(tab + '_actions_column') || gradioApp().getElementById(tab + '_generate_row'); + } + target.insertBefore(button, target.firstElementChild); } } diff --git a/modules/ui.py b/modules/ui.py index 21f9a5a7f00..a50f356a139 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -190,7 +190,7 @@ def __init__(self, is_img2img: bool, toprow_prompt: ToprowPrompt, in_settings_co with gr.Row(elem_id=f"{id_part}_toprow", variant="compact"): if in_settings_column: - with gr.Row(elem_classes=self.flex_revert): + with gr.Row(elem_id=f"{id_part}_generate_row", elem_classes=self.flex_revert): self._create_generate_box() with gr.Column(elem_id=f"{id_part}_prompt_container", scale=6):