Skip to content

fix(drawing): horizontal line drawable in future zone — ignore futureOffset on price-only anchors - #270

Merged
363045841 merged 1 commit into
363045841:mainfrom
EliteOtaku:pr/horizontal-anchor-future-offset
Sep 30, 2026
Merged

363045841 merged 1 commit into
363045841:mainfrom
EliteOtaku:pr/horizontal-anchor-future-offset

Conversation

@EliteOtaku

Copy link
Copy Markdown
Contributor

问题

右缘空白(未来区)落点解析会为数据区外的点击携带 futureOffset,而
DrawingDocument.resolveAnchor 对 horizontal-line 显式抛
INVALID_ANCHOR("Horizontal drawing anchors cannot use a future offset")。
叠加 completeDrawing 的执行顺序(先回置工具再 createDrawing),用户侧表现:

  • 未来区点击创建水平线无声失败(异常只进 console,工具静默弹回指针)
  • 极端场景(换品种 + 连续两次周期切换,scrollLeft 漂出数据区)下整个可视区
    都是未来区
    ,水平线在任何位置都画不出来

修复

horizontal 锚仅价格语义(持久化 shape 为 { type: 'horizontal', price },
不含时间),futureOffset 对它无意义——忽略而非抛错。未来区按价格创建
水平线与 TV 语义一致。

配套壳层修复(切品种/周期后 rAF 双帧 scrollToRight 对齐最新数据,避免视口
漂入未来区)已在 EliteOtaku/KCQ-NexusAI nexus/main,不影响本修复的正确性。

验证

  • DrawingDocument.test.ts 新增用例:horizontal 锚携带 futureOffset 不抛且
    仅落 price({ type: 'horizontal', price: 9 })
  • pnpm --filter @363045841yyt/klinechart-core test:249 文件 / 2670 测试全绿

修正实现位置:类型联合(DrawingAnchorCommandInput)里水平图元的锚是
独立变体(futureOffset?: never),文档层拒绝是正确的契约防御;错在
completeDrawing 无差别传 { timestamp, futureOffset, price }——为水平
命令剥离 futureOffset(kind === 'horizontal-line' 时仅传 price),
未来区落点即可按价格创建水平线。

- placement 测试新增:未来槽落点创建水平线,命令锚仅含 price
- 验证:core 250 文件/2674 测试全绿、type-check 三段过、attw 过
@EliteOtaku
EliteOtaku force-pushed the pr/horizontal-anchor-future-offset branch from 8c23ce3 to 4c165b8 Compare September 29, 2026 16:07
EliteOtaku added a commit to EliteOtaku/KCQ-NexusAI that referenced this pull request Sep 29, 2026
@363045841
363045841 merged commit aa7ef23 into 363045841:main Sep 30, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants