Repository navigation
arigl on a phone: UI size, windows in view, the system keyboard - #967
Merged
Merged
Conversation
…tem keyboard VTK sizes the browser canvas in device pixels (CSS size x devicePixelRatio, about 3 on a phone), so the overlay's 2.0 touch scale drew ~11 CSS px text, and the "short side under 700 px" phone check never fired. - ImGuiOverlay: the UI size (ui.scale) is in logical pixels, times the display's pixel ratio (FontScaleMain x FontScaleDpi; devicePixelRatio, read each frame; setPixelRatio overrides). Touch starts at 1.25. Scale changes land at the next frame and carry the open windows along. Touch slop, drag threshold and title-bar-only moves follow touch mode. The show/hide button stays above every window but a popup. - ImGuiBackend: a document's px (window pos/size, tracks, columns, images, plots) scale with the UI, and persisted geometry is logical px. A window opens inside the view (a fitting one again once measured). - AppRuntime::set_host_ui_size: a "UI size" list at the top of the Controls window (titled Controls, as in #963); arigl binds it to the overlay's scale. - The browser system keyboard: while a finger activates an ImGui text field the overlay focuses a hidden <input> at its caret (in the touchend gesture, for iOS) and feeds ImGui what the keyboard does to it. - cyprty.html hides its key hints and footer under 600 px; ARIADNE.md 5.11.
The constructor seeds the defaults (UI size 1, no touch) and, being synchronous, handed them straight to ImGuiOverlay's apply callback, so a touch device's mode and UI size were lost before the first frame: the phone screenshots came up at 100%. Fence the seed and set() as ViewportLayout does; an outside edit (the Controls window's UI size) still reaches the overlay.
#931 took docs/ARIADNE.md §5.11 for pictures by URL, the slot this branch had used for phones; the phone section is now §5.12, and the ImGui layout note that points at it follows.
#932 took docs/ARIADNE.md §5.12 for backgrounds; the phone section is now §5.13. #932's ImGui backdrop took a group's authored px as device px, so on a phone (UI size 1.25 at pixel ratio 3) a `size: [auto, 120]` background came out a quarter of its height. It now goes through ui_px like every other px a document authors, and cvcgl_imgui_ui_size checks the area at the phone's scale and at 1 x 1.
#935 took docs/ARIADNE.md §5.13 for video and audio; the phone section is now §5.14.
This was referenced Nov 2, 2026
Merged
transfix
added a commit
that referenced
this pull request
Nov 2, 2026
Driving cyprty as a phone (headless Chrome: 390 x 844 CSS px at pixel ratio 3, real touch events) after #967 showed two things wrong. The conference's windows piled up. The document lays them out for a laptop (My Camera at 20,40, Users at 390,40, Avatar at 20,610), and on a phone each was moved into the view, all onto the same spot, the front one translucent over the others. On a phone (a view under 500 CSS px on its short side) a window whose authored place or size does not fit now opens collapsed, its title bar under the others' from the top of the view: a list of titles over the scene, to open one at a time. Opened, it unfolds from its title, as wide as the view and no taller than the room below. Windows that fit, those with no pos: (the flow), and every view wider than a phone are as before. Labels were cut off in a window that fits its widgets (the Controls window: "UI", "Sen", "Car"). ImGui gives such a window's widgets 16 lines' width, most of a phone's at its UI size, and #967 stops the window at the view's edge, so reserve_label_width's "the window grows to the label" no longer held. There the widget now leaves its label room up to the widest the window can be (the view less ImGui's safe-area padding), which does not depend on the window's own size, so it holds still. cvcgl_imgui_ui_size covers both: the stacked titles, the windows unfolding from them, a slider in a fitting window with nothing to scroll to, and a laptop where nothing opens collapsed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes Ariadne/arigl apps usable on a phone, cyprty first. There were two problems: the UI came out tiny and hard to hit, and nothing could be typed, because a phone has no keyboard to send keys.
Why the UI was tiny
VTK sizes the browser canvas in device pixels: the CSS size times
devicePixelRatio, about 3 on a phone. ImGuiOverlay's touch default of 2.0 therefore drew 16 × 2 = 32 device-px text, which is about 11 CSS px. The phone check had the same problem: it hid the panels when the short side was under 700 px, but a phone's canvas is about 1170 device px across, so the panels stayed open over the scene.UI size and pixel ratio (
cvc::gl::ImGuiOverlay)ui.scale) is in logical (CSS) pixels. The overlay multiplies it by the display's pixel ratio:style.FontScaleMainholds the UI size andFontScaleDpithe ratio, and the style is scaled by their product.devicePixelRatioevery frame, so browser zoom also zooms the UI. Natively it is 1.setPixelRatio()overrides it.scale > 1. Before, a 2× desktop browser picked them up too.UiSettings(cvc/gl/Settings.h) seeds its defaults (size 1, no touch) in its constructor. It runs synchronously, so it handed them straight back to the overlay, and the overlay's touch mode and size were gone before the first frame.UiSettingsnow fences its own writes, asViewportLayoutalready does. Itsset()no longer calls back either, which is what its comment always said.ScaleWindowsInViewport), and tables take their column widths again.A document's px follow the UI (Ariadne
ImGuiBackend)pos:/size:/min:/max:, column and row tracks, image and stream-view sizes, plot heights, and the area a group'sbackground:takes (Ariadne: background: on a window or group (media M2, stacked on #931) #932's, merged in). A 360 px window holds the same widgets at any size.tree.<id>.geometry, tracks, columns) is in the same logical px, so it survives a UI-size change. This is the same model the terminal backends use with their cell size.pos:past the edge until all of it shows. So a layout made for a laptop opens within reach on a phone.The "UI size" setting
<scene>.viewers.<viewer>.ui.scale, already mirrored byUiSettings. arigl's isui.docs.ari.viewers.main.ui.scale.AppRuntime::set_host_ui_size(UiSizeControl)(keys.h) adds a Display section above the keys with a UI size list (75% to 200%).Minimizing on a phone
The keyboard: can we raise the system keyboard?
Yes. In a browser a phone shows its keyboard only for a focused text field, and the canvas isn't one. So when a finger activates an ImGui text field (
io.WantTextInput, viaPlatform_SetImeDataFn), ImGuiOverlay focuses a hidden<input>that it adds next to the canvas, positioned at the field's caret. The keyboard comes up, and the browser keeps the field in view above it.What gets typed. The overlay feeds ImGui what the keyboard does to that hidden field, not key events:
keyCode 229, compose words, and autocorrect.iOS. iOS only raises a keyboard for a focus made inside a user gesture. VTK turns a touchstart into a press that ImGui handles on the next frame, so the field is already active when the finger lifts, and the
touchendhandler focuses the input then. A field that becomes active with no finger down raises the keyboard on Android, and on iOS at the next tap.What stays the same. Mouse clicks keep typing through the canvas as before. While the hidden input has focus the canvas doesn't, so SDL's filter (
activeElement === canvas) drops those keys and VTK never sees them: typing a name never walks the avatar. SDL is still not given VTK's#canvasas its keyboard element.An ImGui on-screen keyboard? Not worth it.
io.WantTextInputtells you when to show one (ocornut/imgui#3968).Natively, SDL3's
SDL_StartTextInputraises the OS keyboard on iOS and Android. arigl has no mobile build yet; when it does, the sameWantTextInputedge drives that.Tests
cvcgl_imgui_ui_size(new; bare ImGui context, no GL). At a phone's 1.25 × 3 it checks:UiSettingsdoesn't hand its seed or the owner's ownset()back to the owner, but does hand on an outside edit (the Controls window's pick).AriadneAppRuntime.ControlsWindowOffersTheHostsUiSize. The Display row comes before the keys, the list shows the host's size, a pick writes a number the host reads back, and a host without one gets no row.cvcgl_ari_golden(it renders, and every golden matches), thecvcgl_imgui_*tests,scene_chrome,ari_switch,ariadne_realize,ariadne_physics,tf_editor,stream_view,sdl_inputandviewport_input;ariadne_runtime_test246/246;ariadne_loader_test210 passed, 2 skipped.cyprty-wasm-deps) compiles and links. In the in-app browser's mobile emulation it has pixel ratio 2 and a 750×1540 canvas, the hidden input is installed (16 px font), and the header hints and footer are hidden.On a phone-sized page (in-app browser, mobile preset: 375 × 812 at pixel ratio 2)
No screenshots: they were skipped. What was checked by eye, on the build before the
UiSettingsfix:UiSettingsstart-up bug was found.Not checked in a browser: the keyboard path. The in-app browser's clicks arrive as mouse clicks, which keep the old canvas path by design. Raising the keyboard needs a real touch, ideally on an iPhone and an Android phone.