Remove automatic slider path offsetting

This commit is contained in:
smoogipoo
2019-12-09 17:54:19 +09:00
parent fa1468325e
commit 883d5bc11d
3 changed files with 8 additions and 22 deletions

View File

@ -16,6 +16,7 @@ using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Screens.Edit.Compose;
using osuTK;
using osuTK.Input;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
@ -122,6 +123,13 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
return true;
}
// The path will have a non-zero offset if the head is removed, but sliders don't support this behaviour since the head is positioned at the slider's position
// So the slider needs to be offset by this amount instead, and all control points offset backwards such that the path is re-positioned at (0, 0)
Vector2 first = slider.Path.ControlPoints[0].Position.Value;
foreach (var c in slider.Path.ControlPoints)
c.Position.Value -= first;
slider.Position += first;
// Since pieces are re-used, they will not point to the deleted control points while remaining selected
foreach (var piece in Pieces)
piece.IsSelected.Value = false;