From e931aa3d9e0ee346e87f62715a199980e6c02401 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 4 Oct 2018 13:43:50 +0900 Subject: [PATCH] Move positional modifications to HitCirclePlacementMask --- .../Edit/Masks/HitCirclePlacementMask.cs | 13 +++++++++++-- osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs | 6 +++++- osu.Game/Rulesets/Edit/PlacementMask.cs | 14 -------------- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs b/osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs index 33de02af05..9082f40445 100644 --- a/osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Masks/HitCirclePlacementMask.cs @@ -21,16 +21,25 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks InternalChild = new HitCircleMask(HitObject); } + protected override void LoadComplete() + { + base.LoadComplete(); + + // Fixes a 1-frame position discrpancy due to the first mouse move event happening in the next frame + Position = GetContainingInputManager().CurrentState.Mouse.Position; + } + protected override bool OnClick(ClickEvent e) { + HitObject.Position = e.MousePosition; Finish(); return true; } protected override bool OnMouseMove(MouseMoveEvent e) { - HitObject.Position = e.MousePosition; - return base.OnMouseMove(e); + Position = e.MousePosition; + return true; } } } diff --git a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs index 55dc0c4eb0..d6e59587a4 100644 --- a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs +++ b/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs @@ -13,6 +13,7 @@ using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Edit; +using osu.Game.Rulesets.Osu.Edit.Masks; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Screens.Edit.Screens.Compose.Layers; using osu.Game.Tests.Beatmaps; @@ -29,7 +30,10 @@ namespace osu.Game.Tests.Visual typeof(HitObjectComposer), typeof(OsuHitObjectComposer), typeof(HitObjectMaskLayer), - typeof(NotNullAttribute) + typeof(NotNullAttribute), + typeof(HitCircleMask), + typeof(HitCircleSelectionMask), + typeof(HitCirclePlacementMask), }; [BackgroundDependencyLoader] diff --git a/osu.Game/Rulesets/Edit/PlacementMask.cs b/osu.Game/Rulesets/Edit/PlacementMask.cs index bfeb0c17fd..3cee09a8ee 100644 --- a/osu.Game/Rulesets/Edit/PlacementMask.cs +++ b/osu.Game/Rulesets/Edit/PlacementMask.cs @@ -40,14 +40,6 @@ namespace osu.Game.Rulesets.Edit HitObject.ApplyDefaults(workingBeatmap.Value.Beatmap.ControlPointInfo, workingBeatmap.Value.Beatmap.BeatmapInfo.BaseDifficulty); } - protected override void LoadComplete() - { - base.LoadComplete(); - - // Fixes a 1-frame position discrpancy due to the first mouse move event happening in the next frame - Position = GetContainingInputManager().CurrentState.Mouse.Position; - } - /// /// Finishes the placement of . /// @@ -75,12 +67,6 @@ namespace osu.Game.Rulesets.Edit } } - protected override bool OnMouseMove(MouseMoveEvent e) - { - Position = e.MousePosition; - return true; - } - protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing);