From b9c6674a5885f6fda92acf72002d68f78006a47e Mon Sep 17 00:00:00 2001 From: OliBomby Date: Thu, 4 Jul 2024 11:47:45 +0200 Subject: [PATCH 01/22] Allow seeking to sample point on double-click --- .../Components/Timeline/NodeSamplePointPiece.cs | 10 ++++++++++ .../Compose/Components/Timeline/SamplePointPiece.cs | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/NodeSamplePointPiece.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/NodeSamplePointPiece.cs index ae3838bc413e..e9999df76dda 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/NodeSamplePointPiece.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/NodeSamplePointPiece.cs @@ -2,7 +2,9 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; +using osu.Framework.Extensions; using osu.Framework.Graphics.UserInterface; +using osu.Framework.Input.Events; using osu.Game.Audio; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; @@ -22,6 +24,14 @@ public NodeSamplePointPiece(HitObject hitObject, int nodeIndex) NodeIndex = nodeIndex; } + protected override bool OnDoubleClick(DoubleClickEvent e) + { + var hasRepeats = (IHasRepeats)HitObject; + EditorClock?.SeekSmoothlyTo(HitObject.StartTime + hasRepeats.Duration * NodeIndex / hasRepeats.SpanCount()); + this.ShowPopover(); + return true; + } + protected override IList GetSamples() { var hasRepeats = (IHasRepeats)HitObject; diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs index 930b78b4680f..0507f3d3d0bb 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs @@ -32,6 +32,9 @@ public partial class SamplePointPiece : HitObjectPointPiece, IHasPopover { public readonly HitObject HitObject; + [Resolved] + protected EditorClock? EditorClock { get; private set; } + public SamplePointPiece(HitObject hitObject) { HitObject = hitObject; @@ -54,6 +57,13 @@ protected override bool OnClick(ClickEvent e) return true; } + protected override bool OnDoubleClick(DoubleClickEvent e) + { + EditorClock?.SeekSmoothlyTo(HitObject.StartTime); + this.ShowPopover(); + return true; + } + private void updateText() { Label.Text = $"{abbreviateBank(GetBankValue(GetSamples()))} {GetVolumeValue(GetSamples())}"; From 00f7a34139f1a8c4d2e0112b23b7e26464893495 Mon Sep 17 00:00:00 2001 From: OliBomby Date: Thu, 4 Jul 2024 15:25:43 +0200 Subject: [PATCH 02/22] Add test coverage --- .../TestSceneHitObjectSampleAdjustments.cs | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectSampleAdjustments.cs b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectSampleAdjustments.cs index 9988c1cb59a9..28bafb79ee70 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectSampleAdjustments.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectSampleAdjustments.cs @@ -7,6 +7,7 @@ using NUnit.Framework; using osu.Framework.Input; using osu.Framework.Testing; +using osu.Framework.Utils; using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Graphics.UserInterface; @@ -307,6 +308,40 @@ public void TestNodeSamplePopover() hitObjectNodeHasSampleVolume(0, 1, 10); } + [Test] + public void TestSamplePointSeek() + { + AddStep("add slider", () => + { + EditorBeatmap.Clear(); + EditorBeatmap.Add(new Slider + { + Position = new Vector2(256, 256), + StartTime = 0, + Path = new SliderPath(new[] { new PathControlPoint(Vector2.Zero), new PathControlPoint(new Vector2(250, 0)) }), + Samples = + { + new HitSampleInfo(HitSampleInfo.HIT_NORMAL) + }, + NodeSamples = + { + new List { new HitSampleInfo(HitSampleInfo.HIT_NORMAL) }, + new List { new HitSampleInfo(HitSampleInfo.HIT_NORMAL) }, + }, + RepeatCount = 1 + }); + }); + + doubleClickNodeSamplePiece(0, 0); + editorTimeIs(0); + doubleClickNodeSamplePiece(0, 1); + editorTimeIs(813); + doubleClickNodeSamplePiece(0, 2); + editorTimeIs(1627); + doubleClickSamplePiece(0); + editorTimeIs(0); + } + [Test] public void TestHotkeysMultipleSelectionWithSameSampleBank() { @@ -500,6 +535,24 @@ private void clickNodeSamplePiece(int objectIndex, int nodeIndex) => AddStep($"c InputManager.Click(MouseButton.Left); }); + private void doubleClickSamplePiece(int objectIndex) => AddStep($"double-click {objectIndex.ToOrdinalWords()} sample piece", () => + { + var samplePiece = this.ChildrenOfType().Single(piece => piece is not NodeSamplePointPiece && piece.HitObject == EditorBeatmap.HitObjects.ElementAt(objectIndex)); + + InputManager.MoveMouseTo(samplePiece); + InputManager.Click(MouseButton.Left); + InputManager.Click(MouseButton.Left); + }); + + private void doubleClickNodeSamplePiece(int objectIndex, int nodeIndex) => AddStep($"double-click {objectIndex.ToOrdinalWords()} object {nodeIndex.ToOrdinalWords()} node sample piece", () => + { + var samplePiece = this.ChildrenOfType().Where(piece => piece.HitObject == EditorBeatmap.HitObjects.ElementAt(objectIndex)).ToArray()[nodeIndex]; + + InputManager.MoveMouseTo(samplePiece); + InputManager.Click(MouseButton.Left); + InputManager.Click(MouseButton.Left); + }); + private void samplePopoverHasNoFocus() => AddUntilStep("sample popover textbox not focused", () => { var popover = this.ChildrenOfType().SingleOrDefault(); @@ -644,5 +697,7 @@ private void hitObjectNodeHasSampleAdditionBank(int objectIndex, int nodeIndex, var h = EditorBeatmap.HitObjects.ElementAt(objectIndex) as IHasRepeats; return h is not null && h.NodeSamples[nodeIndex].Where(o => o.Name != HitSampleInfo.HIT_NORMAL).All(o => o.Bank == bank); }); + + private void editorTimeIs(double time) => AddAssert($"editor time is {time}", () => Precision.AlmostEquals(EditorClock.CurrentTimeAccurate, time, 1)); } } From 98610f4f6d1536842febaec22659bcf75b021872 Mon Sep 17 00:00:00 2001 From: OliBomby Date: Fri, 5 Jul 2024 12:41:50 +0200 Subject: [PATCH 03/22] alt left/right or scroll to seek to neighbouring hit objects --- osu.Game/Screens/Edit/Editor.cs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index c00b7ac4f2e8..c50cd09dd87f 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -593,7 +593,7 @@ public void OnReleased(KeyBindingReleaseEvent e) protected override bool OnKeyDown(KeyDownEvent e) { - if (e.ControlPressed || e.AltPressed || e.SuperPressed) return false; + if (e.ControlPressed || e.SuperPressed) return false; switch (e.Key) { @@ -674,7 +674,7 @@ protected override bool OnKeyDown(KeyDownEvent e) protected override bool OnScroll(ScrollEvent e) { - if (e.ControlPressed || e.AltPressed || e.SuperPressed) + if (e.ControlPressed || e.SuperPressed) return false; const double precision = 1; @@ -1064,8 +1064,24 @@ private void seekControlPoint(int direction) clock.Seek(found.Time); } + private void seekHitObject(int direction) + { + var found = direction < 1 + ? editorBeatmap.HitObjects.LastOrDefault(p => p.StartTime < clock.CurrentTimeAccurate) + : editorBeatmap.HitObjects.FirstOrDefault(p => p.StartTime > clock.CurrentTimeAccurate); + + if (found != null) + clock.SeekSmoothlyTo(found.StartTime); + } + private void seek(UIEvent e, int direction) { + if (e.AltPressed) + { + seekHitObject(direction); + return; + } + double amount = e.ShiftPressed ? 4 : 1; bool trackPlaying = clock.IsRunning; From 7d6ade7e844df0abde9a4a25e0725c26db62d4d5 Mon Sep 17 00:00:00 2001 From: OliBomby Date: Fri, 5 Jul 2024 14:16:51 +0200 Subject: [PATCH 04/22] shift alt seek to open next sample edit popover --- .../Timeline/NodeSamplePointPiece.cs | 8 +-- .../Components/Timeline/SamplePointPiece.cs | 27 ++++++++- osu.Game/Screens/Edit/Editor.cs | 58 ++++++++++++++++++- 3 files changed, 84 insertions(+), 9 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/NodeSamplePointPiece.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/NodeSamplePointPiece.cs index e9999df76dda..1245d94a920f 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/NodeSamplePointPiece.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/NodeSamplePointPiece.cs @@ -2,9 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; -using osu.Framework.Extensions; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.Events; using osu.Game.Audio; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; @@ -24,12 +22,10 @@ public NodeSamplePointPiece(HitObject hitObject, int nodeIndex) NodeIndex = nodeIndex; } - protected override bool OnDoubleClick(DoubleClickEvent e) + protected override double GetTime() { var hasRepeats = (IHasRepeats)HitObject; - EditorClock?.SeekSmoothlyTo(HitObject.StartTime + hasRepeats.Duration * NodeIndex / hasRepeats.SpanCount()); - this.ShowPopover(); - return true; + return HitObject.StartTime + hasRepeats.Duration * NodeIndex / hasRepeats.SpanCount(); } protected override IList GetSamples() diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs index 0507f3d3d0bb..8c05a8806e98 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs @@ -21,6 +21,7 @@ using osu.Game.Rulesets.Objects; using osu.Game.Screens.Edit.Components.TernaryButtons; using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Objects.Types; using osu.Game.Screens.Edit.Timing; using osuTK; using osuTK.Graphics; @@ -33,7 +34,10 @@ public partial class SamplePointPiece : HitObjectPointPiece, IHasPopover public readonly HitObject HitObject; [Resolved] - protected EditorClock? EditorClock { get; private set; } + private EditorClock? editorClock { get; set; } + + [Resolved] + private Editor? editor { get; set; } public SamplePointPiece(HitObject hitObject) { @@ -44,11 +48,30 @@ public SamplePointPiece(HitObject hitObject) protected override Color4 GetRepresentingColour(OsuColour colours) => AlternativeColor ? colours.Pink2 : colours.Pink1; + protected virtual double GetTime() => HitObject is IHasRepeats r ? HitObject.StartTime + r.Duration / r.SpanCount() / 2 : HitObject.StartTime; + [BackgroundDependencyLoader] private void load() { HitObject.DefaultsApplied += _ => updateText(); updateText(); + + if (editor != null) + editor.ShowSampleEditPopoverRequested += OnShowSampleEditPopoverRequested; + } + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + + if (editor != null) + editor.ShowSampleEditPopoverRequested -= OnShowSampleEditPopoverRequested; + } + + private void OnShowSampleEditPopoverRequested(double time) + { + if (time == GetTime()) + this.ShowPopover(); } protected override bool OnClick(ClickEvent e) @@ -59,7 +82,7 @@ protected override bool OnClick(ClickEvent e) protected override bool OnDoubleClick(DoubleClickEvent e) { - EditorClock?.SeekSmoothlyTo(HitObject.StartTime); + editorClock?.SeekSmoothlyTo(GetTime()); this.ShowPopover(); return true; } diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index c50cd09dd87f..973908dfcbe9 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -43,6 +43,7 @@ using osu.Game.Rulesets; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Objects.Types; using osu.Game.Screens.Edit.Components.Menus; using osu.Game.Screens.Edit.Compose; using osu.Game.Screens.Edit.Compose.Components.Timeline; @@ -1074,11 +1075,66 @@ private void seekHitObject(int direction) clock.SeekSmoothlyTo(found.StartTime); } + [CanBeNull] + public event Action ShowSampleEditPopoverRequested; + + private void seekSamplePoint(int direction) + { + double currentTime = clock.CurrentTimeAccurate; + + var current = direction < 1 + ? editorBeatmap.HitObjects.LastOrDefault(p => p is IHasRepeats r && p.StartTime < currentTime && r.EndTime >= currentTime) + : editorBeatmap.HitObjects.LastOrDefault(p => p is IHasRepeats r && p.StartTime <= currentTime && r.EndTime > currentTime); + + if (current == null) + { + if (direction < 1) + { + current = editorBeatmap.HitObjects.LastOrDefault(p => p.StartTime < currentTime); + if (current != null) + clock.SeekSmoothlyTo(current is IHasRepeats r ? r.EndTime : current.StartTime); + } + else + { + current = editorBeatmap.HitObjects.FirstOrDefault(p => p.StartTime > currentTime); + if (current != null) + clock.SeekSmoothlyTo(current.StartTime); + } + } + else + { + // Find the next node sample point + var r = (IHasRepeats)current; + double[] nodeSamplePointTimes = new double[r.RepeatCount + 3]; + + nodeSamplePointTimes[0] = current.StartTime; + // The sample point for the main samples is sandwiched between the head and the first repeat + nodeSamplePointTimes[1] = current.StartTime + r.Duration / r.SpanCount() / 2; + + for (int i = 0; i < r.SpanCount(); i++) + { + nodeSamplePointTimes[i + 2] = current.StartTime + r.Duration / r.SpanCount() * (i + 1); + } + + double found = direction < 1 + ? nodeSamplePointTimes.Last(p => p < currentTime) + : nodeSamplePointTimes.First(p => p > currentTime); + + clock.SeekSmoothlyTo(found); + } + + // Show the sample edit popover at the current time + ShowSampleEditPopoverRequested?.Invoke(clock.CurrentTimeAccurate); + } + private void seek(UIEvent e, int direction) { if (e.AltPressed) { - seekHitObject(direction); + if (e.ShiftPressed) + seekSamplePoint(direction); + else + seekHitObject(direction); return; } From 8d46d6c6976039975414e34b54678293f2f9b574 Mon Sep 17 00:00:00 2001 From: OliBomby Date: Fri, 5 Jul 2024 14:18:17 +0200 Subject: [PATCH 05/22] always seek on click --- .../Edit/Compose/Components/Timeline/SamplePointPiece.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs index 8c05a8806e98..a3c781260df3 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs @@ -75,12 +75,6 @@ private void OnShowSampleEditPopoverRequested(double time) } protected override bool OnClick(ClickEvent e) - { - this.ShowPopover(); - return true; - } - - protected override bool OnDoubleClick(DoubleClickEvent e) { editorClock?.SeekSmoothlyTo(GetTime()); this.ShowPopover(); From c05f48979bec3377c68fc462d17a95ce87c9a35d Mon Sep 17 00:00:00 2001 From: OliBomby Date: Fri, 5 Jul 2024 14:33:05 +0200 Subject: [PATCH 06/22] fix naming violation --- .../Edit/Compose/Components/Timeline/SamplePointPiece.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs index a3c781260df3..731fe8ae6a7b 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs @@ -57,7 +57,7 @@ private void load() updateText(); if (editor != null) - editor.ShowSampleEditPopoverRequested += OnShowSampleEditPopoverRequested; + editor.ShowSampleEditPopoverRequested += onShowSampleEditPopoverRequested; } protected override void Dispose(bool isDisposing) @@ -65,10 +65,10 @@ protected override void Dispose(bool isDisposing) base.Dispose(isDisposing); if (editor != null) - editor.ShowSampleEditPopoverRequested -= OnShowSampleEditPopoverRequested; + editor.ShowSampleEditPopoverRequested -= onShowSampleEditPopoverRequested; } - private void OnShowSampleEditPopoverRequested(double time) + private void onShowSampleEditPopoverRequested(double time) { if (time == GetTime()) this.ShowPopover(); From 9013c119ab586684e74a2d94aabd1c522a17f4b9 Mon Sep 17 00:00:00 2001 From: OliBomby Date: Fri, 5 Jul 2024 14:33:15 +0200 Subject: [PATCH 07/22] update tests --- .../TestSceneHitObjectSampleAdjustments.cs | 46 ++++++++++++------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectSampleAdjustments.cs b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectSampleAdjustments.cs index 28bafb79ee70..af68948bb780 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectSampleAdjustments.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectSampleAdjustments.cs @@ -332,14 +332,29 @@ public void TestSamplePointSeek() }); }); - doubleClickNodeSamplePiece(0, 0); + clickNodeSamplePiece(0, 0); editorTimeIs(0); - doubleClickNodeSamplePiece(0, 1); + clickNodeSamplePiece(0, 1); editorTimeIs(813); - doubleClickNodeSamplePiece(0, 2); + clickNodeSamplePiece(0, 2); editorTimeIs(1627); - doubleClickSamplePiece(0); + clickSamplePiece(0); + editorTimeIs(406); + + seekSamplePiece(-1); editorTimeIs(0); + samplePopoverIsOpen(); + seekSamplePiece(-1); + editorTimeIs(0); + samplePopoverIsOpen(); + seekSamplePiece(1); + editorTimeIs(406); + seekSamplePiece(1); + editorTimeIs(813); + seekSamplePiece(1); + editorTimeIs(1627); + seekSamplePiece(1); + editorTimeIs(1627); } [Test] @@ -521,7 +536,7 @@ public void TestHotkeysAffectNodeSamples() private void clickSamplePiece(int objectIndex) => AddStep($"click {objectIndex.ToOrdinalWords()} sample piece", () => { - var samplePiece = this.ChildrenOfType().Single(piece => piece.HitObject == EditorBeatmap.HitObjects.ElementAt(objectIndex)); + var samplePiece = this.ChildrenOfType().Single(piece => piece is not NodeSamplePointPiece && piece.HitObject == EditorBeatmap.HitObjects.ElementAt(objectIndex)); InputManager.MoveMouseTo(samplePiece); InputManager.Click(MouseButton.Left); @@ -535,22 +550,19 @@ private void clickNodeSamplePiece(int objectIndex, int nodeIndex) => AddStep($"c InputManager.Click(MouseButton.Left); }); - private void doubleClickSamplePiece(int objectIndex) => AddStep($"double-click {objectIndex.ToOrdinalWords()} sample piece", () => + private void seekSamplePiece(int direction) => AddStep($"seek sample piece {direction}", () => { - var samplePiece = this.ChildrenOfType().Single(piece => piece is not NodeSamplePointPiece && piece.HitObject == EditorBeatmap.HitObjects.ElementAt(objectIndex)); - - InputManager.MoveMouseTo(samplePiece); - InputManager.Click(MouseButton.Left); - InputManager.Click(MouseButton.Left); + InputManager.PressKey(Key.ShiftLeft); + InputManager.PressKey(Key.AltLeft); + InputManager.Key(direction < 1 ? Key.Left : Key.Right); + InputManager.ReleaseKey(Key.AltLeft); + InputManager.ReleaseKey(Key.ShiftLeft); }); - private void doubleClickNodeSamplePiece(int objectIndex, int nodeIndex) => AddStep($"double-click {objectIndex.ToOrdinalWords()} object {nodeIndex.ToOrdinalWords()} node sample piece", () => + private void samplePopoverIsOpen() => AddUntilStep("sample popover is open", () => { - var samplePiece = this.ChildrenOfType().Where(piece => piece.HitObject == EditorBeatmap.HitObjects.ElementAt(objectIndex)).ToArray()[nodeIndex]; - - InputManager.MoveMouseTo(samplePiece); - InputManager.Click(MouseButton.Left); - InputManager.Click(MouseButton.Left); + var popover = this.ChildrenOfType().SingleOrDefault(o => o.IsPresent); + return popover != null; }); private void samplePopoverHasNoFocus() => AddUntilStep("sample popover textbox not focused", () => From ba44757c86f6a36e0debb7b88a6ce7b06f162dff Mon Sep 17 00:00:00 2001 From: OliBomby Date: Fri, 5 Jul 2024 15:24:39 +0200 Subject: [PATCH 08/22] clarify logic --- osu.Game/Screens/Edit/Editor.cs | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 973908dfcbe9..847ad3eba84c 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -1082,26 +1082,12 @@ private void seekSamplePoint(int direction) { double currentTime = clock.CurrentTimeAccurate; + // Check if we are currently inside a hit object with node samples, if so seek to the next node sample point var current = direction < 1 ? editorBeatmap.HitObjects.LastOrDefault(p => p is IHasRepeats r && p.StartTime < currentTime && r.EndTime >= currentTime) : editorBeatmap.HitObjects.LastOrDefault(p => p is IHasRepeats r && p.StartTime <= currentTime && r.EndTime > currentTime); - if (current == null) - { - if (direction < 1) - { - current = editorBeatmap.HitObjects.LastOrDefault(p => p.StartTime < currentTime); - if (current != null) - clock.SeekSmoothlyTo(current is IHasRepeats r ? r.EndTime : current.StartTime); - } - else - { - current = editorBeatmap.HitObjects.FirstOrDefault(p => p.StartTime > currentTime); - if (current != null) - clock.SeekSmoothlyTo(current.StartTime); - } - } - else + if (current != null) { // Find the next node sample point var r = (IHasRepeats)current; @@ -1122,6 +1108,21 @@ private void seekSamplePoint(int direction) clock.SeekSmoothlyTo(found); } + else + { + if (direction < 1) + { + current = editorBeatmap.HitObjects.LastOrDefault(p => p.StartTime < currentTime); + if (current != null) + clock.SeekSmoothlyTo(current is IHasRepeats r ? r.EndTime : current.StartTime); + } + else + { + current = editorBeatmap.HitObjects.FirstOrDefault(p => p.StartTime > currentTime); + if (current != null) + clock.SeekSmoothlyTo(current.StartTime); + } + } // Show the sample edit popover at the current time ShowSampleEditPopoverRequested?.Invoke(clock.CurrentTimeAccurate); From 5da8bb5becf461f571257c0bbd2041f7781e57cf Mon Sep 17 00:00:00 2001 From: OliBomby Date: Sun, 7 Jul 2024 21:33:27 +0200 Subject: [PATCH 09/22] prevent volume control from eating inputs --- osu.Game/Overlays/Volume/VolumeControlReceptor.cs | 8 ++++---- osu.Game/Overlays/VolumeOverlay.cs | 12 ++++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/osu.Game/Overlays/Volume/VolumeControlReceptor.cs b/osu.Game/Overlays/Volume/VolumeControlReceptor.cs index 4ddbc9dd4876..2e8d86d4c7fd 100644 --- a/osu.Game/Overlays/Volume/VolumeControlReceptor.cs +++ b/osu.Game/Overlays/Volume/VolumeControlReceptor.cs @@ -23,15 +23,15 @@ public bool OnPressed(KeyBindingPressEvent e) { case GlobalAction.DecreaseVolume: case GlobalAction.IncreaseVolume: - ActionRequested?.Invoke(e.Action); - return true; + return ActionRequested?.Invoke(e.Action) == true; case GlobalAction.ToggleMute: case GlobalAction.NextVolumeMeter: case GlobalAction.PreviousVolumeMeter: if (!e.Repeat) - ActionRequested?.Invoke(e.Action); - return true; + return ActionRequested?.Invoke(e.Action) == true; + + return false; } return false; diff --git a/osu.Game/Overlays/VolumeOverlay.cs b/osu.Game/Overlays/VolumeOverlay.cs index 5470c70400a1..fa6e797c9cd9 100644 --- a/osu.Game/Overlays/VolumeOverlay.cs +++ b/osu.Game/Overlays/VolumeOverlay.cs @@ -120,14 +120,18 @@ public bool Adjust(GlobalAction action, float amount = 1, bool isPrecise = false return true; case GlobalAction.NextVolumeMeter: - if (State.Value == Visibility.Visible) - volumeMeters.SelectNext(); + if (State.Value != Visibility.Visible) + return false; + + volumeMeters.SelectNext(); Show(); return true; case GlobalAction.PreviousVolumeMeter: - if (State.Value == Visibility.Visible) - volumeMeters.SelectPrevious(); + if (State.Value != Visibility.Visible) + return false; + + volumeMeters.SelectPrevious(); Show(); return true; From f36321a8ea74a599f77263ef4d127bc58263006b Mon Sep 17 00:00:00 2001 From: OliBomby Date: Sun, 7 Jul 2024 21:33:43 +0200 Subject: [PATCH 10/22] allow alt scroll for volume in editor --- osu.Game/Screens/Edit/Editor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 847ad3eba84c..acb9b93114f2 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -675,7 +675,7 @@ protected override bool OnKeyDown(KeyDownEvent e) protected override bool OnScroll(ScrollEvent e) { - if (e.ControlPressed || e.SuperPressed) + if (e.ControlPressed || e.AltPressed || e.SuperPressed) return false; const double precision = 1; From 306dc37ab5159d825adf9d5db29d50ab491e1e83 Mon Sep 17 00:00:00 2001 From: OliBomby Date: Tue, 9 Jul 2024 12:28:23 +0200 Subject: [PATCH 11/22] Make hit object and sample point seek keybinds configurable --- .../Input/Bindings/GlobalActionContainer.cs | 16 +++++++++++ .../GlobalActionKeyBindingStrings.cs | 20 ++++++++++++++ osu.Game/Screens/Edit/Editor.cs | 27 ++++++++++++------- 3 files changed, 53 insertions(+), 10 deletions(-) diff --git a/osu.Game/Input/Bindings/GlobalActionContainer.cs b/osu.Game/Input/Bindings/GlobalActionContainer.cs index ef0c60cd2060..542073476f5b 100644 --- a/osu.Game/Input/Bindings/GlobalActionContainer.cs +++ b/osu.Game/Input/Bindings/GlobalActionContainer.cs @@ -147,6 +147,10 @@ public static IEnumerable GetGlobalActionsFor(GlobalActionCategory new KeyBinding(new[] { InputKey.Control, InputKey.Shift, InputKey.MouseWheelLeft }, GlobalAction.EditorCycleNextBeatSnapDivisor), new KeyBinding(new[] { InputKey.Control, InputKey.R }, GlobalAction.EditorToggleRotateControl), new KeyBinding(new[] { InputKey.Control, InputKey.E }, GlobalAction.EditorToggleScaleControl), + new KeyBinding(new[] { InputKey.Alt, InputKey.Left }, GlobalAction.EditorSeekToPreviousHitObject), + new KeyBinding(new[] { InputKey.Alt, InputKey.Right }, GlobalAction.EditorSeekToNextHitObject), + new KeyBinding(new[] { InputKey.Alt, InputKey.Shift, InputKey.Left }, GlobalAction.EditorSeekToPreviousSamplePoint), + new KeyBinding(new[] { InputKey.Alt, InputKey.Shift, InputKey.Right }, GlobalAction.EditorSeekToNextSamplePoint), }; private static IEnumerable editorTestPlayKeyBindings => new[] @@ -456,6 +460,18 @@ public enum GlobalAction [LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorTestPlayQuickExitToCurrentTime))] EditorTestPlayQuickExitToCurrentTime, + + [LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorSeekToPreviousHitObject))] + EditorSeekToPreviousHitObject, + + [LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorSeekToNextHitObject))] + EditorSeekToNextHitObject, + + [LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorSeekToPreviousSamplePoint))] + EditorSeekToPreviousSamplePoint, + + [LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorSeekToNextSamplePoint))] + EditorSeekToNextSamplePoint, } public enum GlobalActionCategory diff --git a/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs b/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs index 450585f79abf..206db1a16674 100644 --- a/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs +++ b/osu.Game/Localisation/GlobalActionKeyBindingStrings.cs @@ -404,6 +404,26 @@ public static class GlobalActionKeyBindingStrings /// public static LocalisableString DecreaseModSpeed => new TranslatableString(getKey(@"decrease_mod_speed"), @"Decrease mod speed"); + /// + /// "Seek to previous hit object" + /// + public static LocalisableString EditorSeekToPreviousHitObject => new TranslatableString(getKey(@"editor_seek_to_previous_hit_object"), @"Seek to previous hit object"); + + /// + /// "Seek to next hit object" + /// + public static LocalisableString EditorSeekToNextHitObject => new TranslatableString(getKey(@"editor_seek_to_next_hit_object"), @"Seek to next hit object"); + + /// + /// "Seek to previous sample point" + /// + public static LocalisableString EditorSeekToPreviousSamplePoint => new TranslatableString(getKey(@"editor_seek_to_previous_sample_point"), @"Seek to previous sample point"); + + /// + /// "Seek to next sample point" + /// + public static LocalisableString EditorSeekToNextSamplePoint => new TranslatableString(getKey(@"editor_seek_to_next_sample_point"), @"Seek to next sample point"); + private static string getKey(string key) => $@"{prefix}:{key}"; } } diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index acb9b93114f2..214549a68d0c 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -594,7 +594,7 @@ public void OnReleased(KeyBindingReleaseEvent e) protected override bool OnKeyDown(KeyDownEvent e) { - if (e.ControlPressed || e.SuperPressed) return false; + if (e.ControlPressed || e.AltPressed || e.SuperPressed) return false; switch (e.Key) { @@ -746,6 +746,22 @@ public bool OnPressed(KeyBindingPressEvent e) bottomBar.TestGameplayButton.TriggerClick(); return true; + case GlobalAction.EditorSeekToPreviousHitObject: + seekHitObject(-1); + return true; + + case GlobalAction.EditorSeekToNextHitObject: + seekHitObject(1); + return true; + + case GlobalAction.EditorSeekToPreviousSamplePoint: + seekSamplePoint(-1); + return true; + + case GlobalAction.EditorSeekToNextSamplePoint: + seekSamplePoint(1); + return true; + default: return false; } @@ -1130,15 +1146,6 @@ private void seekSamplePoint(int direction) private void seek(UIEvent e, int direction) { - if (e.AltPressed) - { - if (e.ShiftPressed) - seekSamplePoint(direction); - else - seekHitObject(direction); - return; - } - double amount = e.ShiftPressed ? 4 : 1; bool trackPlaying = clock.IsRunning; From 1ce9e97fd45bb81f13a8e6a799af43d6342922af Mon Sep 17 00:00:00 2001 From: OliBomby Date: Tue, 20 Aug 2024 23:38:38 +0200 Subject: [PATCH 12/22] add arrow indicator --- .../Edit/Compose/Components/Timeline/SamplePointPiece.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs index 6cd70449432a..9c42d072d128 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs @@ -12,6 +12,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; +using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; using osu.Game.Audio; @@ -165,6 +166,13 @@ public partial class SampleEditPopover : OsuPopover [Resolved(canBeNull: true)] private EditorBeatmap beatmap { get; set; } = null!; + protected override Drawable CreateArrow() => new Triangle + { + Size = new Vector2(20), + Anchor = Anchor.Centre, + Origin = Anchor.TopCentre, + }; + public SampleEditPopover(HitObject hitObject) { this.hitObject = hitObject; From 423feadd64032a0dd6bfb08302c3aba58d7e2798 Mon Sep 17 00:00:00 2001 From: OliBomby Date: Wed, 21 Aug 2024 14:12:58 +0200 Subject: [PATCH 13/22] Revert "add arrow indicator" This reverts commit 1ce9e97fd45bb81f13a8e6a799af43d6342922af. --- .../Edit/Compose/Components/Timeline/SamplePointPiece.cs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs index 9c42d072d128..6cd70449432a 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs @@ -12,7 +12,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; -using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; using osu.Game.Audio; @@ -166,13 +165,6 @@ public partial class SampleEditPopover : OsuPopover [Resolved(canBeNull: true)] private EditorBeatmap beatmap { get; set; } = null!; - protected override Drawable CreateArrow() => new Triangle - { - Size = new Vector2(20), - Anchor = Anchor.Centre, - Origin = Anchor.TopCentre, - }; - public SampleEditPopover(HitObject hitObject) { this.hitObject = hitObject; From 0db068e423024d35bb4e2145d134e8f7dc7e2988 Mon Sep 17 00:00:00 2001 From: OliBomby Date: Thu, 22 Aug 2024 19:15:53 +0200 Subject: [PATCH 14/22] allow repeating on seek actions --- osu.Game/Screens/Edit/Editor.cs | 41 ++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 2933c89cd881..355d72443462 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -714,6 +714,26 @@ protected override bool OnScroll(ScrollEvent e) public bool OnPressed(KeyBindingPressEvent e) { + // Repeatable actions + switch (e.Action) + { + case GlobalAction.EditorSeekToPreviousHitObject: + seekHitObject(-1); + return true; + + case GlobalAction.EditorSeekToNextHitObject: + seekHitObject(1); + return true; + + case GlobalAction.EditorSeekToPreviousSamplePoint: + seekSamplePoint(-1); + return true; + + case GlobalAction.EditorSeekToNextSamplePoint: + seekSamplePoint(1); + return true; + } + if (e.Repeat) return false; @@ -751,26 +771,9 @@ public bool OnPressed(KeyBindingPressEvent e) case GlobalAction.EditorTestGameplay: bottomBar.TestGameplayButton.TriggerClick(); return true; - - case GlobalAction.EditorSeekToPreviousHitObject: - seekHitObject(-1); - return true; - - case GlobalAction.EditorSeekToNextHitObject: - seekHitObject(1); - return true; - - case GlobalAction.EditorSeekToPreviousSamplePoint: - seekSamplePoint(-1); - return true; - - case GlobalAction.EditorSeekToNextSamplePoint: - seekSamplePoint(1); - return true; - - default: - return false; } + + return false; } public void OnReleased(KeyBindingReleaseEvent e) From adbdb39e9f57ce6e548ddba58798f797e9430de6 Mon Sep 17 00:00:00 2001 From: OliBomby Date: Thu, 22 Aug 2024 19:18:38 +0200 Subject: [PATCH 15/22] move public member to top of file --- osu.Game/Screens/Edit/Editor.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 355d72443462..6b8ea7e97e09 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -225,6 +225,9 @@ protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnl /// public Bindable ComposerFocusMode { get; } = new Bindable(); + [CanBeNull] + public event Action ShowSampleEditPopoverRequested; + public Editor(EditorLoader loader = null) { this.loader = loader; @@ -1107,9 +1110,6 @@ private void seekHitObject(int direction) clock.SeekSmoothlyTo(found.StartTime); } - [CanBeNull] - public event Action ShowSampleEditPopoverRequested; - private void seekSamplePoint(int direction) { double currentTime = clock.CurrentTimeAccurate; From 71044a0766fdfe39274de1ea3c6babb8dfb78a39 Mon Sep 17 00:00:00 2001 From: OliBomby Date: Tue, 27 Aug 2024 19:02:40 +0200 Subject: [PATCH 16/22] fix difference in sample time calculation --- osu.Game/Screens/Edit/Editor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 6b8ea7e97e09..9bb91af80652 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -1131,7 +1131,7 @@ private void seekSamplePoint(int direction) for (int i = 0; i < r.SpanCount(); i++) { - nodeSamplePointTimes[i + 2] = current.StartTime + r.Duration / r.SpanCount() * (i + 1); + nodeSamplePointTimes[i + 2] = current.StartTime + r.Duration * (i + 1) / r.SpanCount(); } double found = direction < 1 From daad4765938f5f3bd04148706af65e35e47620ce Mon Sep 17 00:00:00 2001 From: OliBomby Date: Tue, 27 Aug 2024 19:04:16 +0200 Subject: [PATCH 17/22] Add float comparison leniency just in case --- .../Edit/Compose/Components/Timeline/SamplePointPiece.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs index 6cd70449432a..121cc0a301c9 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs @@ -14,6 +14,7 @@ using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; +using osu.Framework.Utils; using osu.Game.Audio; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; @@ -71,7 +72,7 @@ protected override void Dispose(bool isDisposing) private void onShowSampleEditPopoverRequested(double time) { - if (time == GetTime()) + if (Precision.AlmostEquals(time, GetTime())) this.ShowPopover(); } From 1117fd56a10c3b93a11f572d49b99e9533669f07 Mon Sep 17 00:00:00 2001 From: OliBomby Date: Tue, 27 Aug 2024 19:40:18 +0200 Subject: [PATCH 18/22] change default seek hotkeys --- osu.Game/Input/Bindings/GlobalActionContainer.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Input/Bindings/GlobalActionContainer.cs b/osu.Game/Input/Bindings/GlobalActionContainer.cs index 542073476f5b..27d026ac9c48 100644 --- a/osu.Game/Input/Bindings/GlobalActionContainer.cs +++ b/osu.Game/Input/Bindings/GlobalActionContainer.cs @@ -147,10 +147,10 @@ public static IEnumerable GetGlobalActionsFor(GlobalActionCategory new KeyBinding(new[] { InputKey.Control, InputKey.Shift, InputKey.MouseWheelLeft }, GlobalAction.EditorCycleNextBeatSnapDivisor), new KeyBinding(new[] { InputKey.Control, InputKey.R }, GlobalAction.EditorToggleRotateControl), new KeyBinding(new[] { InputKey.Control, InputKey.E }, GlobalAction.EditorToggleScaleControl), - new KeyBinding(new[] { InputKey.Alt, InputKey.Left }, GlobalAction.EditorSeekToPreviousHitObject), - new KeyBinding(new[] { InputKey.Alt, InputKey.Right }, GlobalAction.EditorSeekToNextHitObject), - new KeyBinding(new[] { InputKey.Alt, InputKey.Shift, InputKey.Left }, GlobalAction.EditorSeekToPreviousSamplePoint), - new KeyBinding(new[] { InputKey.Alt, InputKey.Shift, InputKey.Right }, GlobalAction.EditorSeekToNextSamplePoint), + new KeyBinding(new[] { InputKey.Control, InputKey.Left }, GlobalAction.EditorSeekToPreviousHitObject), + new KeyBinding(new[] { InputKey.Control, InputKey.Right }, GlobalAction.EditorSeekToNextHitObject), + new KeyBinding(new[] { InputKey.Alt, InputKey.Left }, GlobalAction.EditorSeekToPreviousSamplePoint), + new KeyBinding(new[] { InputKey.Alt, InputKey.Right }, GlobalAction.EditorSeekToNextSamplePoint), }; private static IEnumerable editorTestPlayKeyBindings => new[] From b5b4f915a94b19c40b1d2fae32954a0dcbd0047c Mon Sep 17 00:00:00 2001 From: OliBomby Date: Tue, 27 Aug 2024 19:40:33 +0200 Subject: [PATCH 19/22] Automatic seek to sample point on right-click --- .../Edit/Compose/Components/Timeline/SamplePointPiece.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs index 121cc0a301c9..488cd288e460 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs @@ -78,11 +78,18 @@ private void onShowSampleEditPopoverRequested(double time) protected override bool OnClick(ClickEvent e) { - editorClock?.SeekSmoothlyTo(GetTime()); this.ShowPopover(); return true; } + protected override void OnMouseUp(MouseUpEvent e) + { + if (e.Button != MouseButton.Right) return; + + editorClock?.SeekSmoothlyTo(GetTime()); + this.ShowPopover(); + } + private void updateText() { Label.Text = $"{abbreviateBank(GetBankValue(GetSamples()))} {GetVolumeValue(GetSamples())}"; From cadbb0f27ab2937e930e86083a42a8e76101b613 Mon Sep 17 00:00:00 2001 From: OliBomby Date: Wed, 28 Aug 2024 09:57:13 +0200 Subject: [PATCH 20/22] change sample seek keybind to ctrl shift --- osu.Game/Input/Bindings/GlobalActionContainer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Input/Bindings/GlobalActionContainer.cs b/osu.Game/Input/Bindings/GlobalActionContainer.cs index 27d026ac9c48..aca0984e0fd4 100644 --- a/osu.Game/Input/Bindings/GlobalActionContainer.cs +++ b/osu.Game/Input/Bindings/GlobalActionContainer.cs @@ -149,8 +149,8 @@ public static IEnumerable GetGlobalActionsFor(GlobalActionCategory new KeyBinding(new[] { InputKey.Control, InputKey.E }, GlobalAction.EditorToggleScaleControl), new KeyBinding(new[] { InputKey.Control, InputKey.Left }, GlobalAction.EditorSeekToPreviousHitObject), new KeyBinding(new[] { InputKey.Control, InputKey.Right }, GlobalAction.EditorSeekToNextHitObject), - new KeyBinding(new[] { InputKey.Alt, InputKey.Left }, GlobalAction.EditorSeekToPreviousSamplePoint), - new KeyBinding(new[] { InputKey.Alt, InputKey.Right }, GlobalAction.EditorSeekToNextSamplePoint), + new KeyBinding(new[] { InputKey.Control, InputKey.Shift, InputKey.Left }, GlobalAction.EditorSeekToPreviousSamplePoint), + new KeyBinding(new[] { InputKey.Control, InputKey.Shift, InputKey.Right }, GlobalAction.EditorSeekToNextSamplePoint), }; private static IEnumerable editorTestPlayKeyBindings => new[] From 8fe7ab131ca810d3397603aa6dee0e67237b5911 Mon Sep 17 00:00:00 2001 From: OliBomby Date: Thu, 29 Aug 2024 19:34:14 +0200 Subject: [PATCH 21/22] dont seek on right-click, only on keyboard request --- .../Components/Timeline/SamplePointPiece.cs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs index 488cd288e460..a8cf8723f2d0 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/SamplePointPiece.cs @@ -72,22 +72,16 @@ protected override void Dispose(bool isDisposing) private void onShowSampleEditPopoverRequested(double time) { - if (Precision.AlmostEquals(time, GetTime())) - this.ShowPopover(); - } + if (!Precision.AlmostEquals(time, GetTime())) return; - protected override bool OnClick(ClickEvent e) - { + editorClock?.SeekSmoothlyTo(GetTime()); this.ShowPopover(); - return true; } - protected override void OnMouseUp(MouseUpEvent e) + protected override bool OnClick(ClickEvent e) { - if (e.Button != MouseButton.Right) return; - - editorClock?.SeekSmoothlyTo(GetTime()); this.ShowPopover(); + return true; } private void updateText() From 3a1afda2b3c41a9756675b85d878b9d21901fdeb Mon Sep 17 00:00:00 2001 From: OliBomby Date: Thu, 29 Aug 2024 22:22:15 +0200 Subject: [PATCH 22/22] fix test --- .../Editing/TestSceneHitObjectSampleAdjustments.cs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectSampleAdjustments.cs b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectSampleAdjustments.cs index 3e663aea0fcc..3c5277a4d9ad 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneHitObjectSampleAdjustments.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneHitObjectSampleAdjustments.cs @@ -332,15 +332,6 @@ public void TestSamplePointSeek() }); }); - clickNodeSamplePiece(0, 0); - editorTimeIs(0); - clickNodeSamplePiece(0, 1); - editorTimeIs(813); - clickNodeSamplePiece(0, 2); - editorTimeIs(1627); - clickSamplePiece(0); - editorTimeIs(406); - seekSamplePiece(-1); editorTimeIs(0); samplePopoverIsOpen(); @@ -692,11 +683,11 @@ private void clickNodeSamplePiece(int objectIndex, int nodeIndex) => AddStep($"c private void seekSamplePiece(int direction) => AddStep($"seek sample piece {direction}", () => { + InputManager.PressKey(Key.ControlLeft); InputManager.PressKey(Key.ShiftLeft); - InputManager.PressKey(Key.AltLeft); InputManager.Key(direction < 1 ? Key.Left : Key.Right); - InputManager.ReleaseKey(Key.AltLeft); InputManager.ReleaseKey(Key.ShiftLeft); + InputManager.ReleaseKey(Key.ControlLeft); }); private void samplePopoverIsOpen() => AddUntilStep("sample popover is open", () =>