public override bool HandleMovement(MoveSelectionEvent moveEvent) { foreach (var h in SelectedHitObjects.OfType <TauHitObject>()) { if (h is HardBeat) { continue; } h.Angle = ScreenSpaceDrawQuad.Centre.GetDegreesFromPosition(moveEvent.ScreenSpacePosition); EditorBeatmap?.UpdateHitObject(h); } return(true); }
public void SetStrongState(bool state) { var hits = SelectedHitObjects.OfType <Hit>(); ChangeHandler.BeginChange(); foreach (var h in hits) { if (h.IsStrong != state) { h.IsStrong = state; EditorBeatmap.UpdateHitObject(h); } } ChangeHandler.EndChange(); }
private void performColumnMovement(int lastColumn, MoveSelectionEvent moveEvent) { var maniaPlayfield = ((ManiaHitObjectComposer)composer).Playfield; var currentColumn = maniaPlayfield.GetColumnByPosition(moveEvent.ScreenSpacePosition); if (currentColumn == null) { return; } int columnDelta = currentColumn.Index - lastColumn; if (columnDelta == 0) { return; } int minColumn = int.MaxValue; int maxColumn = int.MinValue; foreach (var obj in SelectedHitObjects.OfType <ManiaHitObject>()) { if (obj.Column < minColumn) { minColumn = obj.Column; } if (obj.Column > maxColumn) { maxColumn = obj.Column; } } columnDelta = Math.Clamp(columnDelta, -minColumn, maniaPlayfield.TotalColumns - 1 - maxColumn); foreach (var obj in SelectedHitObjects.OfType <ManiaHitObject>()) { obj.Column += columnDelta; } }
private void performColumnMovement(DragEvent dragEvent) { var lastColumn = composer.ColumnAt(dragEvent.ScreenSpaceLastMousePosition); var currentColumn = composer.ColumnAt(dragEvent.ScreenSpaceMousePosition); if (lastColumn == null || currentColumn == null) { return; } int columnDelta = currentColumn.Index - lastColumn.Index; if (columnDelta == 0) { return; } int minColumn = int.MaxValue; int maxColumn = int.MinValue; foreach (var obj in SelectedHitObjects.OfType <CrossHitObject>()) { if (obj.Column < minColumn) { minColumn = obj.Column; } if (obj.Column > maxColumn) { maxColumn = obj.Column; } } columnDelta = MathHelper.Clamp(columnDelta, -minColumn, composer.TotalColumns - 1 - maxColumn); foreach (var obj in SelectedHitObjects.OfType <CrossHitObject>()) { obj.Column += columnDelta; } }
public override bool HandleMovement(MoveSelectionEvent moveEvent) { Vector2 minPosition = new Vector2(float.MaxValue, float.MaxValue); Vector2 maxPosition = new Vector2(float.MinValue, float.MinValue); // Go through all hitobjects to make sure they would remain in the bounds of the editor after movement, before any movement is attempted foreach (var h in SelectedHitObjects.OfType <OsuHitObject>()) { if (h is Spinner) { // Spinners don't support position adjustments continue; } // Stacking is not considered minPosition = Vector2.ComponentMin(minPosition, Vector2.ComponentMin(h.EndPosition + moveEvent.InstantDelta, h.Position + moveEvent.InstantDelta)); maxPosition = Vector2.ComponentMax(maxPosition, Vector2.ComponentMax(h.EndPosition + moveEvent.InstantDelta, h.Position + moveEvent.InstantDelta)); } if (minPosition.X < 0 || minPosition.Y < 0 || maxPosition.X > DrawWidth || maxPosition.Y > DrawHeight) { return(false); } foreach (var h in SelectedHitObjects.OfType <OsuHitObject>()) { if (h is Spinner) { // Spinners don't support position adjustments continue; } h.Position += moveEvent.InstantDelta; } return(true); }