Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[g-plugin-device-renderer] SDF 绘制的图形设置 anchor 后存在偏移 #1377

Closed
xiaoiver opened this issue Jun 15, 2023 · 1 comment
Closed
Assignees

Comments

@xiaoiver
Copy link
Contributor

设置 Circle 的 anchor 为 [0, 0]时,WebGL 绘制效果如下:
Image

下图为正确的效果,使用 Canvas 绘制:
Image

@xiaoiver xiaoiver self-assigned this Jun 15, 2023
@xiaoiver
Copy link
Contributor Author

偏移量计算方式如下:

// sdf.vert
vec2 offset = (a_Extrude + vec2(1.0) - 2.0 * u_Anchor.xy) * a_Size
  + a_Extrude * vec2(omitStroke ? 0.0 : strokeWidth / 2.0);

xiaoiver added a commit that referenced this issue Jun 16, 2023
xiaoiver added a commit that referenced this issue Jun 19, 2023
* fix: adjust anchor of SDF #1377

* fix: remove comment from sdf.vert

* fix: use SDF to draw rect only when all the radius are the same #1367

* chore: remove material test case from CI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant