diff --git a/OngekiFumenEditor/Modules/FumenVisualEditor/ViewModels/FumenVisualEditorViewModel.UserInteractionActions.cs b/OngekiFumenEditor/Modules/FumenVisualEditor/ViewModels/FumenVisualEditorViewModel.UserInteractionActions.cs index 02ba5ac9..b9d73e23 100644 --- a/OngekiFumenEditor/Modules/FumenVisualEditor/ViewModels/FumenVisualEditorViewModel.UserInteractionActions.cs +++ b/OngekiFumenEditor/Modules/FumenVisualEditor/ViewModels/FumenVisualEditorViewModel.UserInteractionActions.cs @@ -123,7 +123,8 @@ public Rect SelectionRect public void ClearSelection() { - foreach (var obj in SelectObjects) { + foreach (var obj in SelectObjects) + { obj.IsSelected = false; } } @@ -217,10 +218,10 @@ public enum PasteOption None } - public void KeyboardAction_PasteCopiesObjects(ActionExecutionContext ctx) - => PasteCopiesObjects(PasteOption.None, ctx); + public void MenuItemAction_PasteCopiesObjects(ActionExecutionContext ctx) + => KeyboardAction_PasteCopiesObjects(ctx); - public void MenuItemAction_PasteCopiesObjects(ActionExecutionContext e) + public void KeyboardAction_PasteCopiesObjects(ActionExecutionContext e) { var placePos = Mouse.GetPosition(GetView() as FrameworkElement); placePos.Y = ViewHeight - placePos.Y + Rect.MinY; @@ -1034,7 +1035,8 @@ public void OnMouseLeave(ActionExecutionContext e) public void OnMouseUp(ActionExecutionContext e) { var arg = e.EventArgs as MouseButtonEventArgs; - if (arg is null || arg.Handled) { + if (arg is null || arg.Handled) + { return; } @@ -1075,16 +1077,19 @@ public void OnMouseUp(ActionExecutionContext e) var compositeAction = UndoRedoManager.EndCombineAction(Resources.DragObjects); UndoRedoManager.ExecuteAction(compositeAction); } - else { + else + { //Log.LogDebug($"mouseDownHitObject = {mouseDownHitObject?.ReferenceOngekiObject}"); - if (mouseDownHitObject is not null) { + if (mouseDownHitObject is not null) + { if (mouseDownHitObjectPosition is Point p) mouseDownHitObject = NotifyObjectClicked(mouseDownHitObject, mouseDownNextHitObject); } } } - if (isMiddleMouseDown) { + if (isMiddleMouseDown) + { if (isCanvasDragging) { var diffX = pos.X - mouseCanvasStartPosition.X; @@ -1127,7 +1132,8 @@ public void OnMouseUp(ActionExecutionContext e) public void OnMouseDown(ActionExecutionContext e) { - if (e.EventArgs is not MouseButtonEventArgs arg || arg.Handled) { + if (e.EventArgs is not MouseButtonEventArgs arg || arg.Handled) + { return; } Log.LogInfo("Visual mousedown"); @@ -1242,7 +1248,8 @@ public void OnMouseDown(ActionExecutionContext e) public void OnMouseMove(ActionExecutionContext e) { - if (e.EventArgs is not MouseEventArgs args || args.Handled) { + if (e.EventArgs is not MouseEventArgs args || args.Handled) + { return; } @@ -1280,7 +1287,8 @@ public async void OnMouseMove(Point pos) //Log.LogInfo($"diffY: {diffY:F2} ScrollViewerVerticalOffset: {ScrollViewerVerticalOffset:F2}"); } - if (IsRangeSelecting) { + if (IsRangeSelecting) + { var rp = 1 - pos.Y / ViewHeight; var srp = 1 - mouseSelectRangeStartPosition.Y / ViewHeight; var offsetY = 0d; @@ -1395,7 +1403,7 @@ public void KeyboardAction_AddNewLaneColorful(bool clearSelection = true) => TryCreateObjectAtMouse(new ColorfulLaneStart(), clearSelection); public void KeyboardAction_AddNewFlick(bool switchDirection = false, bool clearSelection = false) - => TryCreateObjectAtMouse(new Flick() { Direction = switchDirection ? Flick.FlickDirection.Right : Flick.FlickDirection.Left}, clearSelection); + => TryCreateObjectAtMouse(new Flick() { Direction = switchDirection ? Flick.FlickDirection.Right : Flick.FlickDirection.Left }, clearSelection); public void KeyboardAction_AddNewBlock(bool switchDirection = false, bool clearSelection = false) => TryCreateObjectAtMouse( @@ -1413,7 +1421,8 @@ public void KeyboardAction_AddNewTap(bool clearSelection = false) private void TryCreateObjectAtMouse(OngekiObjectBase obj, bool clearSelection, bool autoSelectObj = true) { - if (!CurrentCursorPosition.HasValue) { + if (!CurrentCursorPosition.HasValue) + { return; } @@ -1421,11 +1430,13 @@ private void TryCreateObjectAtMouse(OngekiObjectBase obj, bool clearSelection, b Fumen.AddObject(obj); InteractiveManager.GetInteractive(obj).OnMoveCanvas(obj, CurrentCursorPosition.Value, this); - if (clearSelection) { + if (clearSelection) + { SelectObjects.ForEach(o => o.IsSelected = false); } - if (autoSelectObj) { + if (autoSelectObj) + { ((ISelectableObject)obj).IsSelected = true; NotifyObjectClicked(obj); } diff --git a/OngekiFumenEditor/Modules/FumenVisualEditor/Views/FumenVisualEditorView.xaml b/OngekiFumenEditor/Modules/FumenVisualEditor/Views/FumenVisualEditorView.xaml index ff480183..a2af9afb 100644 --- a/OngekiFumenEditor/Modules/FumenVisualEditor/Views/FumenVisualEditorView.xaml +++ b/OngekiFumenEditor/Modules/FumenVisualEditor/Views/FumenVisualEditorView.xaml @@ -106,20 +106,12 @@ - - + + - - - + + + @@ -136,9 +128,7 @@ Ready="glView_Ready" SizeChanged="glView_SizeChanged" /> - +