[Bug] Arc motion: rounded arcs snap and lose their round caps, and enter `delay` runs once per arc group
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- typescript
調査の方向性
Start with createArcTracks in packages/charts-core/src/motion.ts (around line 1638), which builds one enter track per g.ts-chart__arc group, and compare it with createBarTracks (around line 1238), which makes one call per datum. Run the reproduction test in part A to see that delay fires once. Done for part A means one enter track and one delay call per sector, with datumIndex, datumCount and datum set. Parts B and C also need public API decisions on SceneArea and the enter/exit seeds, so check with maintainers before writing those.
索引モデルが issue の本文から書いたものです。
説明
Version: @tanstack/charts 1.1.0 (57774e1).
Built-in polar arcs (radialArc, ring progress arcs, pie wedges, sunburst sectors) animate worse than bars: a sunburst cannot stagger its sectors on enter (A), a rounded arc snaps when its sweep changes (F, moved here from #193), and the enter sweep cuts round caps flat (E). B asks for the arc geometry that would fix F and E to be public, so custom marks get the arc tween too.
A. Enter delay is called once per arc group, not per sector
createArcTracksmakes one enter track perg.ts-chart__arcgroup, withdatumIndex: 0,datumCount: 1,datum: undefined(motion.ts:1638-1641).- The sunburst emits one group holding all sectors (
hierarchy-sunburst.ts:322-329), sodelay(context)(types.ts:873) cannot tell sectors apart. Bars get one call per datum. - Polar marks use the same group class (
polar.ts:552,polar.ts:831).
Repro: save as packages/charts-core/src/repro.test.ts, run pnpm vitest run packages/charts-core/src/repro.test.ts (fails on main).
import { expect, it } from 'vitest'
import { motion } from './motion'
import { polar } from './polar'
import { sunburst } from './hierarchy-sunburst'
import { createChartScene, defineChart } from './scene'
import type { ChartMotionContext } from './types'
const rows = [
{ name: 'a', size: 0 }, { name: 'a.x', size: 3 }, { name: 'a.y', size: 2 },
{ name: 'b', size: 0 }, { name: 'b.x', size: 4 }, { name: 'b.y', size: 1 },
]
it('A: enter delay is called once per sector', () => {
const calls: ChartMotionContext[] = []
const scene = createChartScene(
defineChart({
marks: [polar({
marks: [sunburst(rows, {
path: 'name', delimiter: '.', value: 'size',
motion: { delay: (ctx) => (calls.push(ctx), ctx.datumIndex * 80) },
})],
scales: { angle: null, radius: null },
})],
scales: { x: null, y: null },
}),
{ width: 200, height: 200 },
)
const container = document.createElement('div')
motion({ transition: { type: 'tween', duration: 100, easing: 'linear' } })
.mount(container, () => {})
.render(scene, { ariaLabel: 'Sunburst' })
const enter = calls.filter((c) => c.phase === 'enter')
console.log(enter.map((c) => [c.role, c.datumIndex, c.datumCount]))
expect(container.querySelectorAll('g.ts-chart__arc path').length).toBe(6)
expect(enter.length).toBe(6) // one call per sector
})
Actual output:
[ [ 'arc', 0, 1 ] ]
AssertionError: expected 1 to be 6
Expected: delay is called per sector on enter, with datumIndex, datumCount and datum set, as for bars. Proposed: one enter track per sector, as createBarTracks does (motion.ts:1238).
F. Rounded polar arcs snap (moved here from #193 C)
radialArcbuilds a plain d3arc()with.cornerRadius(...)(polar.ts:445-453) and attaches no path geometry, soaddSemanticPathUpdateTrackreturns false (motion.ts:2386-2399).- The generic path needs identical command skeletons (
motion.ts:3650-3658); otherwisedis set directly. - Measured skeletons with
cornerRadius(6), radii 60/80: sweep 0 radMLZ, 0.012MALAZ, 1 to 5MAAALAAAZ, full circleMAAMAAZ. Crossing a threshold, including 0 to N, snaps.
Expected: a keyed arc whose angle changes animates. At minimum, document that a skeleton mismatch snaps.
Fix: radialArc, radialBarRadius and radialBarAngle attach arc geometry including corner radius so they use addSemanticPathUpdateTrack.
Repro: same file and command as A. With cornerRadius: 6 it fails; the cornerRadius: 0 control passes.
import { expect, it, vi } from 'vitest'
import { motion } from './motion'
import { polar, radialArc } from './polar'
import { createChartScene, defineChart } from './scene'
it.each([6, 0])('F: arc sweep tweens with cornerRadius %i', (cornerRadius) => {
const queue: FrameRequestCallback[] = []
const tick = (t: number) => queue.splice(0).forEach((f) => f(t))
vi.spyOn(window, 'requestAnimationFrame').mockImplementation((f) => queue.push(f))
vi.spyOn(window, 'cancelAnimationFrame').mockImplementation(() => {})
const el = document.createElement('div')
const s = motion({ transition: { type: 'tween', duration: 1000, easing: 'linear' } }).mount(el, () => {})
const render = (e: number) => s.render(createChartScene(defineChart({
scales: { x: null, y: null }, guides: false,
marks: [polar({ scales: { angle: null, radius: null }, marks: [radialArc([{ id: 'a', s: 0, e }],
{ key: 'id', startAngle: 's', endAngle: 'e', innerRadius: 60, outerRadius: 80, cornerRadius })] })],
}), { width: 300, height: 200 }), { ariaLabel: 'x' })
render(0.012); tick(0); tick(2000)
render(5); tick(0)
const seen = new Set<string>()
for (const t of [250, 500, 750]) { tick(t); seen.add(el.querySelector('path')!.getAttribute('d')!) }
expect(seen.size).toBeGreaterThan(1)
})
Output on 57774e14: F: distinct d values at 250/500/750 ms with cornerRadius 6 = 1 (expected > 1); with cornerRadius: 0, 3 distinct values.
E. The arc enter sweep is a straight wedge clip, so rounded caps are cut flat (from this comment)
For built-in polar arcs (radialArc with cornerRadius, ring progress arcs, pie wedges), the enter animation does not draw an arc of growing sweep. createArcTracks clips the whole g.ts-chart__arc group with a <clipPath> whose path is a centre-anchored wedge, rebuilt per frame by radialSweepClipPath (motion.ts:1618-1700, motion.ts:1803-1820). The final shape is therefore revealed by a straight radial edge, and the leading end of a rounded arc shows a flat cut instead of a round cap until the sweep completes.
Read from source, not run (jsdom has no paint): render a radialArc with cornerRadius: 6 and a large sweep under motion() and inspect the group's clip-path mid-enter.
Expected: the same arc geometry that F needs (and B proposes exposing) would let the enter animate the arc's own end angle, so the cap stays round, instead of clipping. At minimum, document that the enter is a wedge clip.
B. The arc tween metadata is private
- The arc tween needs angles and radii on the node under the
sceneMotionNodesymbol; without itaddSemanticPathUpdateTrackreturns false (motion.ts:2397-2398). - The symbol is not exported (
scene-motion-internal.ts:3); only built-ins set it (hierarchy-sunburst.ts:301,bar.ts:385). SceneAreahas no field for it (types.ts:1551-1556), so custom nodes only getpath: 'morph', a command-by-command path interpolation (motion.md:287).
Expected: a documented optional field on SceneArea (arc values and projector) so custom marks get the arc tween.
C. Sunburst enter/exit seeds cannot be supplied
Moved to #214, together with the scale enter from #193 D.
D. Arc state styles have no angle or radius keys
Moved to #213, together with the geometry keys from #186 E.
A and F were run; B and E are read from source.
Related: polar states are in released code as commit 265b20e (see this comment); #126 and PR #158 do not yet reflect that.
- 主要言語
- TypeScript
- スター
- 870
- フォーク
- 57
- 平均マージ
- 11時間 58分
- マージ済み PR(30日)
- 18
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
TanStack/charts のほかの issue
-
[Perf] Canvas layer composition is quadratic: splitRenderLayers re-copies the node array per nodeオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
[Bug] Focus guides: `url(#id)` paints ignore `idPrefix`対応中かも @getdownandcode が 37 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
TanStack/charts#211 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Add reverse options to waffleY and waffleX対応中かも @tannerlinsley が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 25/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
メンテナーはふだん 1 日以内に返信
TanStack/charts の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
fb55/htmlparser2#2579 ·
メンテナーはふだん 1 日以内に返信
-
bug good first issue needs-review
難易度 1/5 1〜3時間 初心者へのやさしさ 83/100
メンテナーはふだん 1 日以内に返信
-
Add Module DB Rulesオープンdocumentation public
難易度 1/5 1〜3時間 初心者へのやさしさ 68/100
midnightntwrk/umbradb#65 ·
メンテナーはふだん 2 日以内に返信
-
area/channels kind/bug priority/medium
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
nanocoai/nanoclaw#4501 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
needs verification
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 13 日以内に返信