feat(ui): one proportional UI scale as window content zoom, density removed - #635
Conversation
…emoved The Compact / Standard / Large density setting shifted the whole application one MoonUI tier. MoonUI draws each tier by hand, so a tier step substituted a different design rather than scaling the reviewed one, and the design's own mixture of tiers lost its proportions. The UI zoom slider fed the token multipliers, which reach only the geometry that goes through `tokens.ui()`. Now `ui_scale` (50-200 %) is installed as `MoonScale::zoom`; every window's `MoonRoot` applies it as content zoom, so every pixel, glyph and hitbox scales by construction. The tokens stay at the design's size system, spelled once as `design::CONTROL_TIER` / `DESIGN_FONT_DELTA` / `BODY_TEXT` / `INPUT_SIZE`; the tier resolvers, `UiDensity`, its settings row, locale keys and the density-migration contracts are gone. The chart keeps device density: `chartdx` sizes its render target by the combined factor and its own geometry and text by `scale_factor / content_zoom`, the text layer crosses into content pixels only at the GPUI boundary, and the overlays over chart geometry divide by the zoom in `chart_origin_logical`. All of it is shared code above the three GPU backends. `responsive_width` and the click series read content and screen space as they should; the FireTest probe is built in platform space and a `MOON_FIXTURE_SETTINGS` hook lets the bench open at a chosen scale. Requires MoonUI with `Window::set_content_zoom` (Moonbot-Tech/MoonUI#77).
…r zoom Two clean-context reviews of the scale change. The chart-input half had the engine's factor (device pixels per chart-design pixel, UI zoom excluded) where the window's (device per content pixel) belongs, so at any zoom but 100 % the crosshair, drags and presses landed at `1 / zoom` of the pointer and the corner overlays and hover cards sat `zoom` times too far from the pane: - `chart_local_from_window_pos` crosses with `slot_scale_factor()`, the window's factor as the last frame saw it; - the six input handlers hand the container `last_ppp`, the chart-design factor its pane layout and thresholds are drawn with; - the pane close, pin, lock and broom buttons, the zone markers, the logo and the news, warning and trade hover cards divide device pixels by the window's factor to land in content space. Also from the reviews: first-open window sizes and minimums (login, detached and chart windows, expert settings, report) are design pixels and now multiply the content zoom in; four contracts that still guard the size system return as `theme_contract/size_system.rs`; stale "density" wording in comments reads "control tier"; a tautological assertion is dropped. An engine test pins the two factors and the pointer crossing.
|
Два замечания по правке. Плотность юзеры получили четыре дня назад. Compact / Standard / Large приехали в v0.45.3 (15.09) и были в анонсе релиза вместе с масштабом 75–150 %; тем же обновлением им уже один раз сбросили прежний «размер шрифта» на стандартную плотность и 100 %. Кто за эти дни успел поставить себе Compact или Large, на ближайшем автообновлении молча уедет обратно на Standard — второй сброс интерфейса за неделю. Менять в коде нечего: ползунок теперь берёт 50–200 %, и обе привычки восстанавливаются масштабом, причём пропорционально, чего смена tier'а как раз не давала. Но в примечания к релизу и в чат это стоит положить строкой, иначе первыми об этом напишут юзеры — и напишут не «стало пропорционально», а «размер сам поменялся». Устаревший комментарий на поле, которое поменяло смысл. |
…zoom # Conflicts: # docs/ARCHITECTURE.md # docs/FIRETEST.md
|
Re-read after the update — the change itself is the same one I read before, so just two things about the code. The stale doc on A doc comment lost its function in The release-notes point from the last read still stands: whoever writes them should say in one line that the density choice is gone and Compact/Large users land on Standard at their stored zoom — that is the second interface reset in a week for anyone who picked one, and they will otherwise report it as "the size changed by itself". |
6b7e43e to
38e95f5
Compare
|
Third read. The only new commit is the merge from
Release notes point still stands too: one line saying the density choice is gone and Compact/Large users land on Standard at their stored zoom. That is the second interface reset in a week for anyone who picked one, and they will otherwise report it as "the size changed by itself". |
MoonUI #77 is merged: `Window::set_content_zoom`, `MoonScale::zoom` and the device-pixel centring of the toggle thumb, checkbox mark and radio dot. This branch calls that API, so the committed lock has to name a revision that has it; the previous pin (1767a249) does not compile here. Only the 23 packages sourced from the MoonUI repository move, 1767a249 -> e4f2d4e9. `cargo fetch --locked` and `cargo check -p moon-ui-gpui --locked` pass with no local override.
|
Fourth read. The only new commit is
And the release-notes line still stands: say that the density choice is gone and that Compact/Large users land on Standard at their stored zoom. For anyone who picked one this is the second interface reset in a week, and without that line they report it as "the size changed by itself". |
What & why
One proportional UI scale, applied as window content zoom; the Compact / Standard / Large density setting is removed.
Density shifted the whole application one MoonUI tier (
Xs/Sm/Md). MoonUI draws each tier by hand — a toggle is 36×20 atSmand 44×24 atMd, control heights step 20 → 24 → 32 — so stepping the app a tier substituted a different design rather than scaling the reviewed one, and the design's own mixture of tiers (Xs strips, Sm controls, Md dialogs) lost its proportions. The existing "UI zoom" slider fed MoonUI's token multipliers, which reach only the geometry that goes throughtokens.ui(): raw pixel literals, persisted dock sizes and the inherited base widgets stayed put.Now
ui_scale(Settings → General, 50–200 %) is installed asMoonScale::zoomand every window'sMoonRootapplies it throughWindow::set_content_zoom(Moonbot-Tech/MoonUI#77). The zoom folds into the window's scale factor, so every pixel, glyph and hitbox scales by construction and the design keeps its proportions at any factor. The tokens stay at the design's own size system:tier = Sm,font_delta = 3,ui = font = 1.0, spelled once asdesign::CONTROL_TIER/DESIGN_FONT_DELTA/BODY_TEXT/INPUT_SIZE.The chart does not scale with the interface.
chartdxsizes its render target by the frame's combined factor (the slot really is that many device pixels) and its own geometry — line widths, candle outlines, axis gutters, captions — byscale_factor / content_zoom, the platform DPI. Its text layer lays out in the chart's own logical pixels and crosses into GPUI's content pixels only inchartdx::text::content_px/chart_metrics; the overlays over chart geometry (action buttons, arbitrage names, filter headers, the volume menu) divide by the zoom in one place,chart_origin_logical. Every one of those edits is shared code abovechartdx/backend.rs; the Direct3D 11, Metal and wgpu layers are untouched.Notable decisions
UiDensityis deleted frommoon-core, the settings page, the locales and the presentation mapping. A storedui_densitykey is ignored on load (SettingsFilehas nodeny_unknown_fields) and dropped on the next save; it is not a reason to rewrite a file. Compact and Large users land on Standard at their stored zoom.design.rs(button_tier,choice_tier,input_tier,tier_font_size,tier_text_step,tier_text_value,tier_font_base,tier_text_metrics) are gone; their call sites read the constants or the renamedtext_metrics/body_font_base.checkbox_metrics(cx)became theCHECKBOX_METRICSconstant, the stepper reserve instrategies/settings.rskeeps only theSmratio, and seven widget builders lost a context parameter they no longer read.design::ui_px/ui_valuestay as MoonUI's token adapter (identity while the tokens are at 1.0). Replacing their ~1200 call sites withpx(v)is a mechanical follow-up kept out of this diff so the review sees the real change.windowing::responsive_widthreadsviewport_size()(content space) instead ofbounds()(screen space), so the narrow-layout thresholds compare against the width the row is actually laid out in. The chart's click series (double-click and close-residue detection, which is process-wide and therefore screen space) multiplies the press by the zoom before adding the window's screen origin.BODY_TEXTandDESIGN_FONT_DELTA(21 IPv4 glyphs at the body size over the 1.3 text ratio; the cap adds 2 px), so the column stops taking name-column room it no longer needs.MOON_FIXTURE_SETTINGShook (asettings.tomlcopied into the bench before the configuration is read, mirroringMOON_FIXTURE_LAYOUT) lets a scripted run open at a chosen scale.theme_contract/density.rsis gone; the four of its contracts that still guard live invariants (no legacy font channel outside the documented mirror, no custom button metrics on the Settings and Analytics tabs, no literalMoonSize::Smin chrome controls, toolbar strip text on the rendered body metrics) return astheme_contract/size_system.rs. The contract strings elsewhere follow the renamed helpers.ChartEngine::slot_scale_factor), the input container and the engine's own geometry take the chart-design factor (last_ppp), and the pane buttons, zone markers, logo and hover cards divide device pixels by the window's factor to land in content space. An engine unit test pins the two factors and the crossing. First-open window sizes and minimums (login, detached and chart windows, expert settings, report) are design pixels and multiply the content zoom in.Known limitations
iface.density*keys, so the Tour job is expected to stay green.design::ui_px(cx, v)withpx(v).Issues
Open issues were searched for density / zoom / scale / compact: none covers this change. #608 (chart scale hotkeys in the trade window) is unrelated.
How to verify
Live, on the fixture bench (
moonterminal.exe --fixture --debug-script chart-smoke) at 100 % and, withMOON_FIXTURE_SETTINGSnaming asettings.tomlholdingui_scale = 1.5, at 150 %: every behavioural stage passes at both scales — chart probe, mouse storm over the chart, static-text storm, command-error contract, tool windows open and dedup, Root overlay contract, live locale switch, price scale 50 % → 20 % → Auto. The run's final verdict isarrival_flash pulse_per_chart 3.3 < 5.0; a pristineorigin/mainbuild fails identically on this machine (3.2), so that is the flash pacing measurement on this hardware, not this change.cargo test --workspacestops inmoon-coreonupdate::discovery::tests(a local scripted HTTP server): a different test of that module fails on each run, including on a pristineorigin/mainworktree, so it is pre-existing flakiness unrelated toconfig; the crates' own suites are green.Builds on Moonbot-Tech/MoonUI#77, which is merged; the lock is re-pinned to that MoonUI revision (
e4f2d4e9, only the MoonUI packages move), andcargo check -p moon-ui-gpui --lockedpasses with no local override.