Skip to content

Add the Magnifier drawing tool: a lower-timeframe inset area - #99

Merged
alaa-eddine merged 2 commits into
devfrom
feat/tf-magnifier
Aug 30, 2026
Merged

alaa-eddine merged 2 commits into
devfrom
feat/tf-magnifier

Conversation

@alexgrover

@alexgrover alexgrover commented Aug 27, 2026 •

Copy link
Copy Markdown
Member

Summary

  • New drawing tool: Magnifier (Measurements group, press-drag-release). The rectangle's interior redraws the same market at a lower timeframe, in the chart's own price style and colors — candles subdivide into finer candles, line/area/bars restyle accordingly, Heikin Ashi (and any chart type with a bar transform) transforms the fetched bars, and custom types without one fall back to candles — all at true time/price positions on the pane's scales.
  • Timeframe picking: a chip riding the rectangle's bottom-left corner doubles as a dropdown (caret-marked, clickable without selecting the drawing); the quick settings bar carries the same pick plus up/down color and border overrides. Both pickers offer only timeframes strictly below the chart's; Auto resolves to a clean subdivision (1h → 15m). On a chart already at the finest timeframe the tool says "No lower timeframe available" instead of guessing.
  • New neutral core seam — the drawing series gateway: a synchronous, cache-backed read of finer-timeframe bars for data-driven drawings (Projector.seriesInRange, the async sibling of barsInRange), implemented over the feed's ranged fetch with window caching, a 5000-bar request cap, throttled live-edge refreshes, coalesced in-flight fetches, best-effort partial answers while a widened window loads, and failure parking. Exposed to the renderer through one optional port method; everything is additive and named neutrally.
  • Supporting seams: DrawingTypeMeta.coversSeries (an opaque inset starts above the pane's series stack instead of just under the candles) and DrawingTypeMeta.placementHint (a bottom-center prompt while the tool is armed).

Verification

  • Four-way gate green: typecheck · lint · test (1433, incl. 15 new for the tool and the gateway) · build.
  • Browser-verified in the playground against live Binance data: placement, chip dropdown + filtered options, style/color matching on candles / line / Heikin Ashi, the 1m "no lower timeframe" notice, dark/light themes, and toJSON/fromJSON round-trips.
  • Workspace oracle suite (oracle-tests/vela): 22/22.

Test plan

  • Drag a Magnifier on a 1h chart → 15m candles render inside, chart-colored
  • Click the bottom-left chip → pick a lower timeframe (list excludes ≥ chart TF)
  • Switch the chart style to line / Heikin Ashi → the inset follows
  • Switch the chart to 1m → the inset reports no lower timeframe
  • Reload with persist on → the drawing and its timeframe survive

Note

Medium Risk
New ranged market-data fetching and canvas inset rendering add complexity and provider load, though capped and degraded safely; no auth or persistence schema breaks beyond a new drawing type.

Overview
Adds a Magnifier drawing (magnifier, Measurements group): drag a rectangle and its interior shows the same symbol at a strictly lower timeframe, styled like the main series (candles/bars/line/area, Heikin Ashi transforms, theme colors) with live background loads and in-rectangle notices when data is loading, too wide, or unavailable.

Introduces a drawing series gateway (Projector.seriesInRange, DrawingSeriesService on the engine) so drawings can synchronously read finer-TF bars from a padded, LRU-cached ranged fetch (5000-bar cap, partial bars while widening, coalesced in-flight requests). The native renderer wires the gateway, repaints on onUpdate, and paints the inset (ghost outline only while placing—no fetch spam).

Draw-order and UX seams: coversSeries places new opaque insets above the series stack; placementHint shows a bottom pill while the tool is armed. Timeframe is editable via a bottom-left chip dropdown and the quick settings bar (options filtered below the chart TF). Docs and changelog updated (~67 tools).

Reviewed by Cursor Bugbot for commit e90e31f. Bugbot is set up for automated code reviews on this repo. Configure here.

alexgrover and others added 2 commits August 27, 2026 20:44
Drag a rectangle over the chart and its interior redraws the same market
at a lower timeframe, in the chart's own price style and colors, at true
time/price positions. A timeframe chip on the rectangle's bottom-left
corner doubles as a dropdown (only timeframes below the chart's are
offered; Auto subdivides the chart timeframe), and the quick settings
bar carries the same pick plus color/border overrides.

The data rides a new neutral series gateway: a synchronous, cache-backed
read of finer-timeframe bars for data-driven drawings (an async sibling
of Projector.barsInRange), implemented over the feed's ranged fetch with
window caching, request capping, live-edge refreshes, and best-effort
partial answers while a widened window loads. Series-covering tools
start above the pane's series stack so the opaque inset is never buried,
and an armed tool can now show a placement hint at the bottom of the
chart.

Co-authored-by: Cursor <cursoragent@cursor.com>
…ing-tools doc conflicts

Co-authored-by: Cursor <cursoragent@cursor.com>
@alexgrover
alexgrover marked this pull request as ready for review August 29, 2026 17:46
@cursor

cursor Bot commented Aug 29, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_836dc553-8fa7-4b1a-ae52-23d9f7ec64a8)

@alaa-eddine
alaa-eddine merged commit df5bb96 into dev Aug 30, 2026
1 check passed
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants