Skip to content

Commit

Permalink
prevent user pasting multi objects if vertical scale is different
Browse files Browse the repository at this point in the history
  • Loading branch information
MikiraSora committed Dec 26, 2023
1 parent 1d02b9a commit 203c835
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ internal class DefaultFumenEditorClipboard : IFumenEditorClipboard
{
private Dictionary<OngekiObjectBase, Point> currentCopiedSources = new();
private FumenVisualEditorViewModel sourceEditor;
private double prevScale;

public bool ContainPastableObjects => sourceEditor is not null && currentCopiedSources.Any();

Expand All @@ -47,6 +48,8 @@ public async Task CopyObjects(FumenVisualEditorViewModel sourceEditor, IEnumerab
return;
}

prevScale = sourceEditor.Setting.VerticalDisplayScale;

//清空一下
currentCopiedSources.Clear();
this.sourceEditor = default;
Expand Down Expand Up @@ -147,6 +150,12 @@ public async Task PasteObjects(FumenVisualEditorViewModel targetEditor, PasteMir
Log.LogWarn($"无法粘贴因为复制列表为空");
return;
}
var curScale = targetEditor.Setting.VerticalDisplayScale;
if (curScale != prevScale && currentCopiedSources.Count > 1)
{
targetEditor.ToastNotify($"原编辑器垂直缩放({prevScale:F2}x)和目标缩放({curScale:F2}x)不同,无法粘贴多个物件");
return;
}

bool isSameEditorCopy = sourceEditor == targetEditor;
//convert y form sourceEditor to targetEditor
Expand Down

0 comments on commit 203c835

Please sign in to comment.