Fix skin editor origin dropdown options applying origin in wrong coordinate space#37219
Merged
peppy merged 1 commit intoppy:masterfrom Apr 6, 2026
Merged
Fix skin editor origin dropdown options applying origin in wrong coordinate space#37219peppy merged 1 commit intoppy:masterfrom
peppy merged 1 commit intoppy:masterfrom
Conversation
…dinate space Closes ppy#37185. The checkboxes in the context menu's ternary states were supposed to always show the origin "in local space", even if anchor is set to "closest". The issue here was reusing a method that only really made sense with closest anchor active for explicit application of "local-space" origin. To recap: - Below I will use concepts of "local-space origin" and "screen-space origin". To understand the difference, let's use an example: Say there's a drawable with 180 degree rotation. Suppose it has the "local origin" of `TopCentre`. The "local origin" is just the `Drawable` notion of origin; you'd literally set `d.Origin = Anchor.TopCentre`. The "screen-space origin" of this drawable is `BottomCentre`, because due to the rotation, that's how the component will visually behave when its position is altered. The same sort of distinction applies forth to things like flips / negative scale and such. - When you have closest anchor selected, you can only choose the anchor to snap to. The drawable will snap to that anchor, and choose an origin closest to it *in screen space* such that the "closest" in "closest anchor" works as users would expect it to. In this state, if you open the context menu for origin, all items will be disabled, but the ternary menu items will show the origin state *as translated back to local space*. - When you have an explicit anchor selected, you can choose both the anchor and origin. In that case, the origin picked is always picked in local space. In the end, this is all consistent with how the `Origin` property on `Drawable` works, and also with what is serialised to skin jsons.
peppy
approved these changes
Apr 6, 2026
This was referenced Apr 8, 2026
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.
Closes #37185.
The checkboxes in the context menu's ternary states were supposed to always show the origin "in local space", even if anchor is set to "closest". The issue here was reusing a method that only really made sense with closest anchor active for explicit application of "local-space" origin.
To recap:
Below I will use concepts of "local-space origin" and "screen-space origin". To understand the difference, let's use an example:
Say there's a drawable with 180 degree rotation. Suppose it has the "local origin" of
TopCentre. The "local origin" is just theDrawablenotion of origin; you'd literally setd.Origin = Anchor.TopCentre.The "screen-space origin" of this drawable is
BottomCentre, because due to the rotation, that's how the component will visually behave when its position is altered.The same sort of distinction applies forth to things like flips / negative scale and such.
When you have closest anchor selected, you can only choose the anchor to snap to. The drawable will snap to that anchor, and choose an origin closest to it in screen space such that the "closest" in "closest anchor" works as users would expect it to. In this state, if you open the context menu for origin, all items will be disabled, but the ternary menu items will show the origin state as translated back to local space.
When you have an explicit anchor selected, you can choose both the anchor and origin. In that case, the origin picked is always picked in local space.
In the end, this is all consistent with how the
Originproperty onDrawableworks, and also with what is serialised to skin jsons.