fix(chart): give a broomed compare pane to its order book - #405
Merged
Conversation
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.
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.
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_layoutreturns both areas — plot and book, placement and size — andpreparedraws 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
chartdx/input.rshad its own split inplot_metrics_forandtry_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.chart_gesture_pane_at) — figure drawing, figure hit testing and the order-cross gate each answered it separately before.orderbook_drawn()is now the one spelling; historical viewers stay excluded.Known limitations
render.rsstill derives a few logical-pixel layouts (button reserves, paddings) of its own; converting them is a separate change.PRICE_AXIS_Wstrip regardless of the axis position — pre-existing, untouched here.How to verify
chartdx::testsunit tests for the shared pane layout and a newtheme_contractcontract pinning all four hit-test readers to it.-D warningsexits non-zero onorigin/maintoo. No NEW finding: the only reports inside touched files aregeom.rs!(range > 0.0)(two, untouched lines) and a collapsibleifinrender_input.rs— all pre-existing, verified by content.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.