The viewport maps a price to a Y pixel in two composable steps:
price ──priceToTransformed──▶ t ──linear pixel map──▶ y
Only the first step varies per mode; the linear pixel map (in
Viewport.priceToY) is shared. This keeps log / percentage /
indexed scaling localized to two pure, fully-testable functions and
means every downstream consumer of priceToY/yToPrice (candles,
overlay indicators, drawings, markers, crosshair, price lines)
inherits scale-mode correctness for free.
linear is the identity transform, so the linear render path is
bit-for-bit unchanged from before F1.
Price-scale transform core (F1).
The viewport maps a price to a Y pixel in two composable steps:
price ──priceToTransformed──▶ t ──linear pixel map──▶ y
Only the first step varies per mode; the linear pixel map (in
Viewport.priceToY) is shared. This keeps log / percentage / indexed scaling localized to two pure, fully-testable functions and means every downstream consumer ofpriceToY/yToPrice(candles, overlay indicators, drawings, markers, crosshair, price lines) inherits scale-mode correctness for free.linearis the identity transform, so the linear render path is bit-for-bit unchanged from before F1.