antvis / antvis/G

A flaw in g-lite's createVec3 function / g-lite 的 createVec3 函数有缺陷

Open Beginner friendly
#2,243 2 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
1.2k
Forks
230
PR merge metrics
No merged PRs in 30d

Description

# Chain of invocation / 调用链路

|package 1|package 2|package 3|
|----|----|----|
|@antv/g6|@antv/g|@antv/g-lite|
|Graph.translateBy() → ViewportController.transform()|AdvancedCamera.createLandmark() → AdvancedCamera.gotoLandmark()|Camera.setFocalPoint() / Camera.setPosition() → createVec3()|

When trying to translate the camera to origin, as the coordinate passed to setFocalPoint and setPosition is [0, 0, 0], the `x[1] || y` and `x[2] || z` in createVec3 will malfunction, the values of `y` and `z` will be used instead of `x[1]` and `x[2]`, which will prevent the camera from reaching origin point.

当尝试将相机移动至原点时,由于最终传入 setFocalPoint 和 setPosition 的坐标为 [0, 0, 0] ,createVec3 中的 `x[1] || y` 和 `x[2] || z` 会失效, `x[1]` 和 `x[2]` 被忽略,直接取 `y` 和 `z` ,进而导致无法将相机移动至原点。

# Runtime environment / 运行时环境

- OS: win10
- Browser: WebView2
- Version: g-lite 2.7.0

# Reproduce / 复现

https://stackblitz.com/edit/5lgcknuk?file=index.ts

Contributor guide

Open the contributing guide

Research direction

Start by locating g-lite's createVec3 function and trace its use from Camera.setFocalPoint() and setPosition(). Reproduce the origin-coordinate case with the linked StackBlitz example, then verify that [0, 0, 0] reaches the camera unchanged and add or update coverage for zero-valued coordinates.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
computer-graphics
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.