Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid moving already placed objects temporally when "limit distance snap to current time" is active #31743

Merged
merged 2 commits into from
Feb 3, 2025

Conversation

bdach
Copy link
Collaborator

@bdach bdach commented Jan 31, 2025


// Retrieve a snapped position.
var result = Composer.TrySnapToNearbyObjects(movePosition);
result ??= Composer.TrySnapToDistanceGrid(movePosition);
result ??= Composer.TrySnapToDistanceGrid(movePosition, limitedDistanceSnap.Value ? referenceBlueprint.Item.StartTime : null);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The specification of referenceBlueprint.Item.StartTime rather than editorClock.CurrentTime is the fix here.

@@ -437,7 +446,7 @@ public void DragInProgress(DragEvent e)
Vector2 newHeadPosition = Parent!.ToScreenSpace(e.MousePosition + (dragStartPositions[0] - dragStartPositions[draggedControlPointIndex]));

var result = positionSnapProvider?.TrySnapToNearbyObjects(newHeadPosition, oldStartTime);
result ??= positionSnapProvider?.TrySnapToDistanceGrid(newHeadPosition);
result ??= positionSnapProvider?.TrySnapToDistanceGrid(newHeadPosition, limitedDistanceSnap.Value ? oldStartTime : null);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kind of wonder if this case even makes sense. To elaborate, this is the case where you're dragging a set of slider path control points that includes the slider head control point. I debated whether applying limited distance snap even made sense in this instance, and if it did, to which time snapping should be performed.

This is partially why I tore down all the abstractions earlier in #31655 - they really cover a lot of these head-scratchers up.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure either, let's wait for someone to complain I guess.

@peppy
Copy link
Member

peppy commented Feb 3, 2025

This seems to roughly match expectations. Ignoring the part where distance snap almost never matches my expectations (but this is a separate issue).

@peppy peppy merged commit 56000dd into ppy:master Feb 3, 2025
8 of 9 checks passed
@bdach bdach deleted the fix-limit-distance-snap-to-current branch February 3, 2025 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants