shadergradient icon indicating copy to clipboard operation
shadergradient copied to clipboard

refactor: modify MeshType

Open anonymousRecords opened this issue 1 year ago • 4 comments

In ShaderGradient.propertyControls, position and rotation were defined as objects, but in the GradientT type, these were defined as individual properties (positionX, positionY, positionZ, rotationX, rotationY, rotationZ). This caused a type mismatch error.

anonymousRecords avatar Oct 07 '24 06:10 anonymousRecords

can you also update usages parts of the passed position & rotation props?

e.g) packages/shadergradient-v2/src/ShaderGradient/Mesh/Mesh.tsx 28-29

ruucm avatar Oct 07 '24 16:10 ruucm

@ruucm

can you also update usages parts of the passed position & rotation props?

e.g) packages/shadergradient-v2/src/ShaderGradient/Mesh/Mesh.tsx 28-29

I fixed it.

anonymousRecords avatar Oct 07 '24 16:10 anonymousRecords

we also need to update packages/shadergradient-v2/src/presets.ts

The props of shadergradient should be synced as URL queries. (similar to packages/shadergradient/src/store/presets.ts)

So if we use nested props as you suggested, we'll need a neat function to convert them into URL queries.

Please include it in the same file (packages/shadergradient-v2/src/presets.ts)

ruucm avatar Oct 08 '24 02:10 ruucm

@ruucm

we also need to update packages/shadergradient-v2/src/presets.ts

The props of shadergradient should be synced as URL queries. (similar to packages/shadergradient/src/store/presets.ts)

So if we use nested props as you suggested, we'll need a neat function to convert them into URL queries.

Please include it in the same file (packages/shadergradient-v2/src/presets.ts)

I applied types to the presets.ts file and, for separation of concerns, moved the URL conversion function to a separate urlUtils.ts file. However, as you mentioned, it's also fine to keep the URL conversion function in presets.ts, so feel free to share your opinion and I can adjust accordingly. Additionally, I encountered an issue where 'React' was referencing the UMD global, so I imported React to resolve the issue.

anonymousRecords avatar Oct 08 '24 05:10 anonymousRecords