mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 16:59:53 +09:00
Refactor SelectionBlueprint
and MoveSelectionEvent
to work in screen-space coordinates
Until now, the implementation of the overrides in `SelectionBlueprint` have been confusing to the point where I would just implement by trial-and-error (or copying from an existing implementation). This was due to a combination of using "object" space coordinates (ie. the thing the `Blueprint` is operating on) and screen-space coordinates. This change switches all event related coordinates to screen-space, which is how we already handle rotation/scale operations. With the introduction of other editor types where the related objects are drawables, this also makes a lot more sense.
This commit is contained in:
@ -17,21 +17,14 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
public readonly SelectionBlueprint<T> Blueprint;
|
||||
|
||||
/// <summary>
|
||||
/// The expected screen-space position of the blueprint's item at the current cursor position.
|
||||
/// The screen-space delta of this move event.
|
||||
/// </summary>
|
||||
public readonly Vector2 ScreenSpacePosition;
|
||||
public readonly Vector2 ScreenSpaceDelta;
|
||||
|
||||
/// <summary>
|
||||
/// The distance between <see cref="ScreenSpacePosition"/> and the blueprint's current position, in the coordinate-space of the blueprint item's parent.
|
||||
/// </summary>
|
||||
public readonly Vector2 InstantDelta;
|
||||
|
||||
public MoveSelectionEvent(SelectionBlueprint<T> blueprint, Vector2 screenSpacePosition)
|
||||
public MoveSelectionEvent(SelectionBlueprint<T> blueprint, Vector2 screenSpaceDelta)
|
||||
{
|
||||
Blueprint = blueprint;
|
||||
ScreenSpacePosition = screenSpacePosition;
|
||||
|
||||
InstantDelta = Blueprint.GetInstantDelta(ScreenSpacePosition);
|
||||
ScreenSpaceDelta = screenSpaceDelta;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user