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

feat: support cartesian3d transform #44

Merged
merged 4 commits into from
Aug 3, 2023
Merged

feat: support cartesian3d transform #44

merged 4 commits into from
Aug 3, 2023

Conversation

xiaoiver
Copy link
Contributor

@xiaoiver xiaoiver commented Jul 28, 2023

新增加了一种 transform,以便支持 3D 场景:

const coord = new Coordinate({
  transformations: [['cartesian3D']],
  z: 0, // 可选
  depth: 100, // 可选
});

暂不支持和其他 transform 进行 compose,因为参数数目不同(多出来了 z 和 depth)。
测试用例已补充。

另外移除了 @antv/matrix-util,替换成了 gl-matrix,前者其实也就是 export 了后者。

@xiaoiver xiaoiver requested a review from pearmini July 28, 2023 09:45
Copy link
Member

@pearmini pearmini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

其实我在想,是不是直接新增一个 Coordinate3d 会好一点?2d 和 3d 不会同时出现,2d 有 2d 的 transform,3d 有 3d 的 transform,架构更清晰和干净一点,也对打包体积更友好。

const coord3 = new Coordinate3D({});
coord3.transform('cartesian3D');

有点类似 gl-matrix 也有 mat3,mat4。

@xiaoiver
Copy link
Contributor Author

xiaoiver commented Aug 1, 2023

echarts-gl 也采用了同样的方式扩展 coord:

https://github.com/ecomfe/echarts-gl/blob/master/src/coord/grid3D/Cartesian3D.js

@xiaoiver
Copy link
Contributor Author

xiaoiver commented Aug 2, 2023

新增 Coordinate3D,目前支持 cartesian3D、translate3D 和 scale3D 三个 transform

const coord = new Coordinate3D({
  width: 100,
  height: 50,
  depth: 100,
  transformations: [['cartesian3D']],
});

@xiaoiver xiaoiver requested a review from pearmini August 2, 2023 03:22
Copy link
Member

@pearmini pearmini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀🚀🚀

@xiaoiver xiaoiver merged commit 2f85806 into master Aug 3, 2023
1 check passed
@xiaoiver xiaoiver deleted the feat-cartesian3d branch August 3, 2023 09:36
@@ -53,7 +54,7 @@
"rollup-plugin-typescript": "^1.0.1",
"rollup-plugin-uglify": "^6.0.4",
"ts-jest": "^26.5.1",
"typescript": "^4.1.5"
"typescript": "4.8.3"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

使用最新的 typescript 4.9.x 构建会直接报错,暂时退回 4.8.x
microsoft/TypeScript#51644

报错信息:

[!] (plugin typescript) TypeError: hostOrText.readFile is not a function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants