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:
parent
ce68f6adb7
commit
05fe8968d8
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user