Skip to content

fix(chart): give a broomed compare pane to its order book - #405

Merged
guyverino merged 1 commit into
mainfrom
fix/broom-pane-control-zone
Sep 3, 2026
Merged

fix(chart): give a broomed compare pane to its order book#405
guyverino merged 1 commit into
mainfrom
fix/broom-pane-control-zone

Conversation

@guyverino

Copy link
Copy Markdown
Collaborator

What & why

The comparison broom collapses a follower chart to nothing but its order book: the engine hides the price axis, floors the plot at one pixel and gives the book the whole pane. Input never learned that. Hit testing derived the book's width from the Order Book toggle alone, so it kept the book a strip along the right edge — and four fifths of a pane that is entirely order book answered clicks as chart. Orders could be placed, moved, dragged or cancelled only in that strip; a click further left panned an invisible plot, opened the coin on Main, or collapsed the stack's fullscreen.

The width was derived twice because there was nowhere to read it from. There is now: chartdx::pane_layout returns both areas — plot and book, placement and size — and prepare draws them while the panel hit-tests them.

On a broomed pane every chart gesture is now refused, whatever the "separate control zones" setting says: there is no plot there to pan, zoom, open on Main or leave fullscreen from.

Notable decisions

  • No exceptions on a broomed pane. The open-on-Main double click and the right-click fullscreen exit are gone there too, deliberately: that pane is an order book and nothing else. The setting hint says so in all three locales.
  • Two further copies removed. chartdx/input.rs had its own split in plot_metrics_for and try_dblclick_to_main. Fixing them also fixes the double click that opened a coin over the book's own left part whenever the price axis sat outboard of it, and the wheel that zoomed against a width the engine does not draw when the book is disabled.
  • One predicate for "chart, not book" (chart_gesture_pane_at) — figure drawing, figure hit testing and the order-cross gate each answered it separately before.
  • Subscription follows the drawing, not the toggle. Broom mode forces the book on with the Order Book toggle cleared, but demand followed the toggle — so such a pane rendered an empty book and, with the whole pane now its trading zone, invited orders against no depth. orderbook_drawn() is now the one spelling; historical viewers stay excluded.
  • The book's left edge was floored one pixel inside the pane by an expression that cannot return zero. In broom mode that both misplaced what is drawn and left a column of chart at the pane's edge.

Known limitations

  • Not driven live: this repo's UI verification is the maintainer's, and FireTest was not run. The unit tests cover the geometry, not the gestures.
  • render.rs still derives a few logical-pixel layouts (button reserves, paddings) of its own; converting them is a separate change.
  • The AddToChart wheel still reserves a left PRICE_AXIS_W strip regardless of the axis position — pre-existing, untouched here.

How to verify

cargo build --workspace --all-targets --target x86_64-pc-windows-msvc
cargo clippy -p moon-ui-gpui --bin moonterminal --target x86_64-pc-windows-msvc --all-targets -- -D warnings
cargo test --workspace --target x86_64-pc-windows-msvc
  • build: pass.
  • tests: pass — 1385 + 263 + the rest of the workspace green, including 11 new chartdx::tests unit tests for the shared pane layout and a new theme_contract contract pinning all four hit-test readers to it.
  • clippy: this tree carries large pre-existing debt and -D warnings exits non-zero on origin/main too. No NEW finding: the only reports inside touched files are geom.rs !(range > 0.0) (two, untouched lines) and a collapsible if in render_input.rs — all pre-existing, verified by content.
  • FireTest: not run (this repo's convention here).

By hand, on a comparison tab with the broom on: a left click anywhere on a follower pane places/moves orders instead of opening the coin on Main, the wheel over it scrolls the stack rather than zooming, and with the window's Order Book toggle off its book still has depth.

The comparison broom collapses a follower chart to nothing but its order
book: the engine hides the price axis, floors the plot at one pixel and
hands the book the whole pane. Input never learned that. The panel's hit
testing derived the book's width from the Order Book toggle alone, so it
kept the book a strip along the right edge — and four fifths of a pane
that is entirely order book answered clicks as chart. Orders could only
be placed, moved, dragged or cancelled in that strip, while a click
further left panned a plot nobody can see, opened the coin on Main or
collapsed the stack's fullscreen.

The width was derived a second time because there was nowhere to read it
from. There is now: `pane_layout` returns both areas — plot and book,
placement and size — and `prepare` draws them while the panel hit-tests
them, so what is drawn and what is clickable are one statement. Chart
navigation in `chartdx/input.rs` had two further copies of the same
arithmetic; they are gone too, which fixes the double click that opened a
coin over the book's own left part whenever the price axis sat outboard
of it, and the wheel that zoomed against a width the engine does not
draw when the book is disabled.

On a broomed pane every chart gesture is now refused, whatever the
"separate control zones" setting says: there is no plot there to pan,
zoom, open on Main or leave fullscreen from, and Shift+middle would have
published the scale of a one-pixel plot to every chart in the window.
"Is this chart or is this the book" is one predicate, `chart_gesture_pane_at`,
because figure drawing, figure hit testing and the order-cross gate each
used to answer it separately.

Two adjacent defects the same flag caused. Broom mode forces the book on
even with the window's Order Book toggle cleared, but the subscription
followed the toggle, so such a pane rendered an empty book — and, with
the whole pane now its trading zone, invited orders against no depth;
demand now follows `orderbook_drawn()`, with historical viewers still
excluded. And the book's left edge was floored one pixel inside the pane
by an expression that cannot return zero, which in broom mode both
misplaced what is drawn and left a column of chart at the pane's edge.
@guyverino
guyverino merged commit eb23ae0 into main Sep 3, 2026
6 checks passed
@guyverino
guyverino deleted the fix/broom-pane-control-zone branch September 3, 2026 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant