Skip to content

Fix skin editor origin dropdown options applying origin in wrong coordinate space#37219

Merged
peppy merged 1 commit intoppy:masterfrom
bdach:fix-skin-origins
Apr 6, 2026
Merged

Fix skin editor origin dropdown options applying origin in wrong coordinate space#37219
peppy merged 1 commit intoppy:masterfrom
bdach:fix-skin-origins

Conversation

@bdach
Copy link
Copy Markdown
Collaborator

@bdach bdach commented Apr 6, 2026

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 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.

…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.
@bdach bdach self-assigned this Apr 6, 2026
@bdach bdach moved this from Inbox to Pending Review in osu! team task tracker Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Skinning element's origin dropdown options don't match rotation

2 participants