CSS2DRenderer: Support Rotation#33474
Open
WestLangley wants to merge 2 commits intomrdoob:devfrom
Open
Conversation
WestLangley
commented
Apr 26, 2026
| * `( 0, 0 )` is the lower left, `( 1, 1 )` is the top right. | ||
| * The object's anchor point, and the point around which the object rotates. | ||
| * A value of `(0.5, 0.5)` corresponds to the midpoint of the object. A value | ||
| * of `(0, 0)` corresponds to the upper left corner of the object. |
Collaborator
Author
There was a problem hiding this comment.
I did not change the implementation of the "center" API. (0, 0) was always the upper-left, not the lower-left, in this renderer.
The upper-left/lower-left convention is not consistent in three.js, and perhaps it would be advisable to agree to a convention going forward.
WestLangley
commented
Apr 26, 2026
| * @type {number} | ||
| * @default 0 | ||
| */ | ||
| this.rotationAngle = 0; |
Collaborator
Author
There was a problem hiding this comment.
We can't use rotation for the name. CSS3DRenderer uses rotation2D.
Collaborator
Author
|
Temporary live example. I intend to revert the changes to this example. https://raw.githack.com/westlangley/three.js/dev-css2Drenderer_rotation/examples/css2d_label.html |
Collaborator
Author
|
/ping @johnperry-math @yomotsu |
|
I like the change. My only suggestion would be to add some words to the description of the CSS2DObject to the effect of
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #33455
In this PR, the existing
.centerproperty serves a dual purpose. It is both the center of rotation and the anchor point. I am not sure there is a need to decouple them.I think "anchor" or "pivot" would be better nomenclature -- for a future PR, perhaps.