Skip to content

Conversation

@robyanne92
Copy link

With this modification I added a third parameter to the GridHelper construction, giving the possibility to set different colors to X-centerLine and Z-centerLine, like in Blender 2.80. This could be useful to mark the X-centerLine with the color of x-axis and the Z-centerLine with the color of z-axis.

image

colorGrid -- The color of the lines of the grid. This can be a [page:Color], a hexadecimal value and an CSS-Color name. Default is 0x888888
colorXCenterLine -- The color of the X-centerline. This can be a [page:Color], a hexadecimal value and an CSS-Color name. Default is 0x444444 <br />
colorGrid -- The color of the lines of the grid. This can be a [page:Color], a hexadecimal value and an CSS-Color name. Default is 0x888888 <br />
colorZCenterLine -- The color of the Z-centerline. This can be a [page:Color], a hexadecimal value and an CSS-Color name. Default is 0x444444
Copy link
Collaborator

@Mugen87 Mugen87 Jul 23, 2019

Choose a reason for hiding this comment

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

Unfortunately, the parameter order is now confusing. It should be at least: colorXCenterLine, colorZCenterLine, colorGrid. Or even better: colorGrid, colorXCenterLine, colorZCenterLine. However, this will break backwards compatibility.

Copy link
Author

Choose a reason for hiding this comment

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

Unfortunately, the parameter order is now confusing. It should be at least: colorXCenterLine, colorZCenterLine, colorGrid. Or even better: colorGrid, colorXCenterLine, colorZCenterLine. However, this will break backwards compatibility.

I had noticed it too. Let me know if you need help with any code changes.

@WestLangley
Copy link
Collaborator

I think this would be a useful new feature.

We can change the API in such a way the args can be checked and backwards-compatibility can be maintained.

var options = { color: 0xffffff, colorXAxis: 0xff0000, colorZAxis: 0x0000ff );
new THREE.GridHelper( size, divisions, options );

Or, we can just add a method to reset the z-axis color:

gridHelper.setZAxisColor( color );

Or, since it is just a helper, we can change order of the arguments and update the migration guide:

new THREE.GridHelper( size, divisions, color, colorXAxis,  colorZAxis );

My preference is the last option.

@mrdoob will have to make this decision.

@Mugen87
Copy link
Collaborator

Mugen87 commented Jul 23, 2019

Or, since it is just a helper, we can change order of the arguments and update the migration guide:

Then we have to adjust many examples (approx. 25) since instances of GridHelper are often created with both color values. This is probably also true for a lot of user level code.

@WestLangley
Copy link
Collaborator

Then we have to adjust many examples

That will take 10 minutes.

This is probably also true for a lot of user level code.

Who knows, but it is not going to kill them.

I think for this Helper we can change the order of the arguments for clarity and support the suggested feature.

@WestLangley
Copy link
Collaborator

/ping @mrdoob Can you please state your preference? Do you want the feature? Which API?

@Mugen87
Copy link
Collaborator

Mugen87 commented Mar 22, 2021

Considering #21431 (comment), this PR can be closed.

@Mugen87 Mugen87 closed this Mar 22, 2021
Repository owner deleted a comment from EkkoCrystal Jun 13, 2025
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.

3 participants