diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs index 9c33435285..89d1b1fc46 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; @@ -13,6 +14,10 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components { public class HitCirclePiece : CompositeDrawable { + private readonly IBindable positionBindable = new Bindable(); + private readonly IBindable stackHeightBindable = new Bindable(); + private readonly IBindable scaleBindable = new Bindable(); + private readonly HitCircle hitCircle; public HitCirclePiece(HitCircle hitCircle) @@ -25,10 +30,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components CornerRadius = Size.X / 2; InternalChild = new RingPiece(); - - hitCircle.PositionChanged += _ => UpdatePosition(); - hitCircle.StackHeightChanged += _ => UpdatePosition(); - hitCircle.ScaleChanged += _ => Scale = new Vector2(hitCircle.Scale); } [BackgroundDependencyLoader] @@ -36,7 +37,13 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components { Colour = colours.Yellow; - UpdatePosition(); + positionBindable.BindValueChanged(_ => UpdatePosition()); + stackHeightBindable.BindValueChanged(_ => UpdatePosition()); + scaleBindable.BindValueChanged(v => Scale = new Vector2(v)); + + positionBindable.BindTo(hitCircle.PositionBindable); + stackHeightBindable.BindTo(hitCircle.StackHeightBindable); + scaleBindable.BindTo(hitCircle.ScaleBindable); } protected virtual void UpdatePosition() => Position = hitCircle.StackedPosition; diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs index db8e879126..2f3fe241e7 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs @@ -1,14 +1,19 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Osu.Objects; +using OpenTK; namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components { public class PathControlPointVisualiser : CompositeDrawable { + private readonly IBindable controlPointsBindable = new Bindable(); + private readonly Slider slider; private readonly Container pieces; @@ -18,9 +23,13 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components this.slider = slider; InternalChild = pieces = new Container { RelativeSizeAxes = Axes.Both }; + } - slider.ControlPointsChanged += _ => updatePathControlPoints(); - updatePathControlPoints(); + [BackgroundDependencyLoader] + private void load() + { + controlPointsBindable.BindValueChanged(_ => updatePathControlPoints()); + controlPointsBindable.BindTo(slider.ControlPointsBindable); } private void updatePathControlPoints() diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs index 6fc7d39e6c..206e337ab7 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Rulesets.Osu.Objects; @@ -14,6 +15,9 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components { public class SliderBodyPiece : CompositeDrawable { + private readonly IBindable positionBindable = new Bindable(); + private readonly IBindable scaleBindable = new Bindable(); + private readonly Slider slider; private readonly ManualSliderBody body; @@ -26,9 +30,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components AccentColour = Color4.Transparent, PathWidth = slider.Scale * 64 }; - - slider.PositionChanged += _ => updatePosition(); - slider.ScaleChanged += _ => body.PathWidth = slider.Scale * 64; } [BackgroundDependencyLoader] @@ -36,7 +37,11 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components { body.BorderColour = colours.Yellow; - updatePosition(); + positionBindable.BindValueChanged(_ => updatePosition()); + scaleBindable.BindValueChanged(v => body.PathWidth = v * 64); + + positionBindable.BindTo(slider.PositionBindable); + scaleBindable.BindTo(slider.ScaleBindable); } private void updatePosition() => Position = slider.StackedPosition; diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderCirclePiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderCirclePiece.cs index a91739737f..17e823603f 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderCirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderCirclePiece.cs @@ -1,13 +1,18 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components; using osu.Game.Rulesets.Osu.Objects; +using OpenTK; namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components { public class SliderCirclePiece : HitCirclePiece { + private readonly IBindable controlPointsBindable = new Bindable(); + private readonly Slider slider; private readonly SliderPosition position; @@ -16,8 +21,13 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components { this.slider = slider; this.position = position; + } - slider.ControlPointsChanged += _ => UpdatePosition(); + [BackgroundDependencyLoader] + private void load() + { + controlPointsBindable.BindValueChanged(_ => UpdatePosition()); + controlPointsBindable.BindTo(slider.ControlPointsBindable); } protected override void UpdatePosition() diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs index bd63a3e607..d6104a5926 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -14,8 +15,13 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components { public class SpinnerPiece : CompositeDrawable { + private readonly IBindable positionBindable = new Bindable(); + private readonly IBindable stackHeightBindable = new Bindable(); + private readonly IBindable scaleBindable = new Bindable(); + private readonly Spinner spinner; private readonly CircularContainer circle; + private readonly RingPiece ring; public SpinnerPiece(Spinner spinner) { @@ -27,7 +33,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components FillMode = FillMode.Fit; Size = new Vector2(1.3f); - RingPiece ring; InternalChildren = new Drawable[] { circle = new CircularContainer @@ -45,18 +50,20 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components }; ring.Scale = new Vector2(spinner.Scale); - - spinner.PositionChanged += _ => updatePosition(); - spinner.StackHeightChanged += _ => updatePosition(); - spinner.ScaleChanged += _ => ring.Scale = new Vector2(spinner.Scale); - - updatePosition(); } [BackgroundDependencyLoader] private void load(OsuColour colours) { Colour = colours.Yellow; + + positionBindable.BindValueChanged(_ => updatePosition()); + stackHeightBindable.BindValueChanged(_ => updatePosition()); + scaleBindable.BindValueChanged(v => ring.Scale = new Vector2(v)); + + positionBindable.BindTo(spinner.PositionBindable); + stackHeightBindable.BindTo(spinner.StackHeightBindable); + scaleBindable.BindTo(spinner.ScaleBindable); } private void updatePosition() => Position = spinner.Position; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index e663989eeb..bf662adf1e 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -2,6 +2,8 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; @@ -21,6 +23,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables private readonly NumberPiece number; private readonly GlowPiece glow; + private readonly IBindable positionBindable = new Bindable(); + private readonly IBindable stackHeightBindable = new Bindable(); + private readonly IBindable scaleBindable = new Bindable(); + public DrawableHitCircle(HitCircle h) : base(h) { @@ -59,10 +65,18 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables //may not be so correct Size = circle.DrawSize; + } - HitObject.PositionChanged += _ => Position = HitObject.StackedPosition; - HitObject.StackHeightChanged += _ => Position = HitObject.StackedPosition; - HitObject.ScaleChanged += s => Scale = new Vector2(s); + [BackgroundDependencyLoader] + private void load() + { + positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition); + stackHeightBindable.BindValueChanged(_ => Position = HitObject.StackedPosition); + scaleBindable.BindValueChanged(v => Scale = new Vector2(v)); + + positionBindable.BindTo(HitObject.PositionBindable); + stackHeightBindable.BindTo(HitObject.StackHeightBindable); + scaleBindable.BindTo(HitObject.ScaleBindable); } public override Color4 AccentColour diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 514ae09064..63506a57a7 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -8,6 +8,7 @@ using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics.Containers; using osu.Game.Configuration; using osu.Game.Rulesets.Scoring; @@ -26,6 +27,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables public readonly SnakingSliderBody Body; public readonly SliderBall Ball; + private readonly IBindable positionBindable = new Bindable(); + private readonly IBindable scaleBindable = new Bindable(); + private readonly IBindable controlPointsBindable = new Bindable(); + public DrawableSlider(Slider s) : base(s) { @@ -83,15 +88,26 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables components.Add(drawableRepeatPoint); AddNested(drawableRepeatPoint); } + } - HitObject.PositionChanged += _ => Position = HitObject.StackedPosition; - HitObject.ScaleChanged += _ => + [BackgroundDependencyLoader] + private void load(OsuConfigManager config) + { + config.BindWith(OsuSetting.SnakingInSliders, Body.SnakingIn); + config.BindWith(OsuSetting.SnakingOutSliders, Body.SnakingOut); + + positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition); + scaleBindable.BindValueChanged(v => { Body.PathWidth = HitObject.Scale * 64; Ball.Scale = new Vector2(HitObject.Scale); - }; + }); - slider.ControlPointsChanged += _ => Body.Refresh(); + controlPointsBindable.BindValueChanged(_ => Body.Refresh()); + + positionBindable.BindTo(HitObject.PositionBindable); + scaleBindable.BindTo(HitObject.ScaleBindable); + controlPointsBindable.BindTo(slider.ControlPointsBindable); } public override Color4 AccentColour @@ -108,13 +124,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables } } - [BackgroundDependencyLoader] - private void load(OsuConfigManager config) - { - config.BindWith(OsuSetting.SnakingInSliders, Body.SnakingIn); - config.BindWith(OsuSetting.SnakingOutSliders, Body.SnakingOut); - } - public bool Tracking; protected override void Update() diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.cs index 6a836679a2..ab63c2b67e 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.cs @@ -2,6 +2,8 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Game.Rulesets.Objects.Types; using OpenTK; @@ -9,17 +11,25 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { public class DrawableSliderHead : DrawableHitCircle { + private readonly IBindable positionBindable = new Bindable(); + private readonly IBindable controlPointsBindable = new Bindable(); + private readonly Slider slider; public DrawableSliderHead(Slider slider, HitCircle h) : base(h) { this.slider = slider; + } - h.PositionChanged += _ => updatePosition(); - slider.ControlPointsChanged += _ => updatePosition(); + [BackgroundDependencyLoader] + private void load() + { + positionBindable.BindValueChanged(_ => updatePosition()); + controlPointsBindable.BindValueChanged(_ => updatePosition()); - updatePosition(); + positionBindable.BindTo(HitObject.PositionBindable); + controlPointsBindable.BindTo(slider.ControlPointsBindable); } protected override void Update() diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs index cc88a6718b..c15f2e3704 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs @@ -1,8 +1,10 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Game.Rulesets.Scoring; +using OpenTK; namespace osu.Game.Rulesets.Osu.Objects.Drawables { @@ -17,6 +19,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables public bool Tracking { get; set; } + private readonly IBindable positionBindable = new Bindable(); + private readonly IBindable controlPointsBindable = new Bindable(); + public DrawableSliderTail(Slider slider, SliderTailCircle hitCircle) : base(hitCircle) { @@ -29,10 +34,11 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables AlwaysPresent = true; - hitCircle.PositionChanged += _ => updatePosition(); - slider.ControlPointsChanged += _ => updatePosition(); + positionBindable.BindValueChanged(_ => updatePosition()); + controlPointsBindable.BindValueChanged(_ => updatePosition()); - updatePosition(); + positionBindable.BindTo(hitCircle.PositionBindable); + controlPointsBindable.BindTo(slider.ControlPointsBindable); } protected override void CheckForResult(bool userTriggered, double timeOffset) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index f3846bd52f..56a85c3983 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -11,6 +11,7 @@ using OpenTK.Graphics; using osu.Game.Graphics; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Game.Screens.Ranking; using osu.Game.Rulesets.Scoring; @@ -36,6 +37,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables private readonly Color4 baseColour = OsuColour.FromHex(@"002c3c"); private readonly Color4 fillColour = OsuColour.FromHex(@"005b7c"); + private readonly IBindable positionBindable = new Bindable(); + private Color4 normalColour; private Color4 completeColour; @@ -112,8 +115,23 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables Alpha = 0 } }; + } - s.PositionChanged += _ => Position = s.Position; + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + normalColour = baseColour; + + Background.AccentColour = normalColour; + + completeColour = colours.YellowLight.Opacity(0.75f); + + Disc.AccentColour = fillColour; + circle.Colour = colours.BlueDark; + glow.Colour = colours.BlueDark; + + positionBindable.BindValueChanged(v => Position = v); + positionBindable.BindTo(HitObject.PositionBindable); } public float Progress => MathHelper.Clamp(Disc.RotationAbsolute / 360 / Spinner.SpinsRequired, 0, 1); @@ -153,20 +171,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables }); } - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - normalColour = baseColour; - - Background.AccentColour = normalColour; - - completeColour = colours.YellowLight.Opacity(0.75f); - - Disc.AccentColour = fillColour; - circle.Colour = colours.BlueDark; - glow.Colour = colours.BlueDark; - } - protected override void Update() { Disc.Tracking = OsuActionInputManager?.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton) ?? false; diff --git a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs index 61d199a7dc..b7f9b2fa47 100644 --- a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; +using osu.Framework.Configuration; using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects; using OpenTK; @@ -14,26 +14,15 @@ namespace osu.Game.Rulesets.Osu.Objects { public const double OBJECT_RADIUS = 64; - public event Action PositionChanged; - public event Action StackHeightChanged; - public event Action ScaleChanged; - public double TimePreempt = 600; public double TimeFadeIn = 400; - private Vector2 position; + public readonly Bindable PositionBindable = new Bindable(); public virtual Vector2 Position { - get => position; - set - { - if (position == value) - return; - position = value; - - PositionChanged?.Invoke(value); - } + get => PositionBindable; + set => PositionBindable.Value = value; } public float X => Position.X; @@ -45,38 +34,24 @@ namespace osu.Game.Rulesets.Osu.Objects public Vector2 StackedEndPosition => EndPosition + StackOffset; - private int stackHeight; + public readonly Bindable StackHeightBindable = new Bindable(); public int StackHeight { - get => stackHeight; - set - { - if (stackHeight == value) - return; - stackHeight = value; - - StackHeightChanged?.Invoke(value); - } + get => StackHeightBindable; + set => StackHeightBindable.Value = value; } public Vector2 StackOffset => new Vector2(StackHeight * Scale * -6.4f); public double Radius => OBJECT_RADIUS * Scale; - private float scale = 1; + public readonly Bindable ScaleBindable = new Bindable(1); public float Scale { - get => scale; - set - { - if (scale == value) - return; - scale = value; - - ScaleChanged?.Invoke(value); - } + get => ScaleBindable; + set => ScaleBindable.Value = value; } public virtual bool NewCombo { get; set; } diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index cff742ca29..133a2e57ab 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -7,6 +7,7 @@ using osu.Game.Rulesets.Objects.Types; using System.Collections.Generic; using osu.Game.Rulesets.Objects; using System.Linq; +using osu.Framework.Configuration; using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; @@ -22,8 +23,6 @@ namespace osu.Game.Rulesets.Osu.Objects /// private const float base_scoring_distance = 100; - public event Action ControlPointsChanged; - public double EndTime => StartTime + this.SpanCount() * Path.Distance / Velocity; public double Duration => EndTime - StartTime; @@ -54,17 +53,16 @@ namespace osu.Game.Rulesets.Osu.Objects public SliderPath Path { get; } = new SliderPath(); + public readonly Bindable ControlPointsBindable = new Bindable(Array.Empty()); + public Vector2[] ControlPoints { - get => Path.ControlPoints; + get => ControlPointsBindable; set { - if (Path.ControlPoints == value) - return; + ControlPointsBindable.Value = value; Path.ControlPoints = value; - ControlPointsChanged?.Invoke(value); - if (TailCircle != null) TailCircle.Position = EndPosition; }