1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 08:52:55 +08:00

Only interact with clipboard via bound copy

This commit is contained in:
Bartłomiej Dach 2024-04-03 11:39:12 +02:00
parent ce68f6adb7
commit 05fe8968d8
No known key found for this signature in database

View File

@ -66,9 +66,6 @@ namespace osu.Game.Overlays.SkinEditor
[Resolved]
private RealmAccess realm { get; set; } = null!;
[Resolved]
private EditorClipboard clipboard { get; set; } = null!;
[Resolved]
private SkinEditorOverlay? skinEditorOverlay { get; set; }
@ -114,7 +111,7 @@ namespace osu.Game.Overlays.SkinEditor
}
[BackgroundDependencyLoader]
private void load()
private void load(EditorClipboard clipboard)
{
RelativeSizeAxes = Axes.Both;
@ -225,6 +222,8 @@ namespace osu.Game.Overlays.SkinEditor
}
}
};
clipboardContent = clipboard.Content.GetBoundCopy();
}
protected override void LoadComplete()
@ -244,7 +243,6 @@ namespace osu.Game.Overlays.SkinEditor
canCopy.Value = canCut.Value = SelectedComponents.Any();
}, true);
clipboardContent = clipboard.Content.GetBoundCopy();
clipboardContent.BindValueChanged(content => canPaste.Value = !string.IsNullOrEmpty(content.NewValue), true);
Show();
@ -497,7 +495,7 @@ namespace osu.Game.Overlays.SkinEditor
protected void Copy()
{
clipboard.Content.Value = JsonConvert.SerializeObject(SelectedComponents.Cast<Drawable>().Select(s => s.CreateSerialisedInfo()).ToArray());
clipboardContent.Value = JsonConvert.SerializeObject(SelectedComponents.Cast<Drawable>().Select(s => s.CreateSerialisedInfo()).ToArray());
}
protected void Clone()
@ -517,7 +515,7 @@ namespace osu.Game.Overlays.SkinEditor
changeHandler?.BeginChange();
var drawableInfo = JsonConvert.DeserializeObject<SerialisedDrawableInfo[]>(clipboard.Content.Value);
var drawableInfo = JsonConvert.DeserializeObject<SerialisedDrawableInfo[]>(clipboardContent.Value);
if (drawableInfo == null)
return;