forked from karaoke-dev/karaoke
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request karaoke-dev#2131 from andy840119/create-popover-fo…
…r-ruby-blueprint Create popover for able to edit ruby text.
- Loading branch information
Showing
7 changed files
with
178 additions
and
86 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
...eens/Edit/Beatmaps/Lyrics/Components/Lyrics/Blueprints/LyricPropertyBlueprintContainer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using osu.Framework.Allocation; | ||
using osu.Framework.Bindables; | ||
using osu.Framework.Input.Events; | ||
using osu.Game.Rulesets.Karaoke.Objects; | ||
using osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics.States; | ||
using osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics.States.Modes; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics.Components.Lyrics.Blueprints; | ||
|
||
public abstract partial class LyricPropertyBlueprintContainer<T> : BindableBlueprintContainer<T> where T : class | ||
{ | ||
[Resolved] | ||
private ILyricCaretState lyricCaretState { get; set; } = null!; | ||
|
||
private readonly BindableList<T> lyricListProperties; | ||
|
||
protected readonly Lyric Lyric; | ||
|
||
protected LyricPropertyBlueprintContainer(Lyric lyric) | ||
{ | ||
lyricListProperties = GetProperties(lyric); | ||
Lyric = lyric; | ||
} | ||
|
||
protected abstract BindableList<T> GetProperties(Lyric lyric); | ||
|
||
[BackgroundDependencyLoader] | ||
private void load() | ||
{ | ||
// Make it auto create or remove the blueprint by the list. | ||
RegisterBindable(lyricListProperties); | ||
} | ||
|
||
protected override bool OnClick(ClickEvent e) | ||
{ | ||
lyricCaretState.MoveCaretToTargetPosition(Lyric); | ||
return base.OnClick(e); | ||
} | ||
|
||
protected override bool OnDragStart(DragStartEvent e) | ||
{ | ||
lyricCaretState.MoveCaretToTargetPosition(Lyric); | ||
return base.OnDragStart(e); | ||
} | ||
|
||
protected abstract partial class LyricPropertySelectionHandler<TModeState> : BindableSelectionHandler | ||
where TModeState : IHasBlueprintSelection<T> | ||
{ | ||
[BackgroundDependencyLoader] | ||
private void load(TModeState modeState) | ||
{ | ||
SelectedItems.BindTo(modeState.SelectedItems); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.