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

feat: Add snapping to workspace comments. #8070

Merged
merged 4 commits into from
May 12, 2024

Conversation

NeilFraser
Copy link
Contributor

Now that there are two things that snap (blocks and WS comments), the alignment code in being moved to a common place.

Resolves #8060

Now that there are two things that snap (blocks and WS comments), the alignment code in being moved to a common place.
@NeilFraser NeilFraser requested a review from a team as a code owner May 7, 2024 14:57
@NeilFraser NeilFraser requested a review from cpcallen May 7, 2024 14:57
@github-actions github-actions bot added the PR: feature Adds a feature label May 7, 2024
Copy link
Contributor

@cpcallen cpcallen left a comment

Choose a reason for hiding this comment

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

LGTM modulo some nits.

core/grid.ts Outdated Show resolved Hide resolved
core/grid.ts Outdated
* @returns Object with .x and .y properties in workspace coordinates,
* or null if no change.
*/
alignXY(xy: Coordinate): Coordinate | null {
Copy link
Contributor

Choose a reason for hiding this comment

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

This name seems OK but doesn't really hint at the fact that the function will return null if the argument was already a grid point.

core/comments/rendered_workspace_comment.ts Outdated Show resolved Hide resolved
NeilFraser and others added 3 commits May 12, 2024 21:59
Co-authored-by: Christopher Allen <cpcallen+git@google.com>
Co-authored-by: Christopher Allen <cpcallen+git@google.com>
The point of null was to avoid creating a new coordinate object and avoid a more complicated check.  But this can also be achieved by returning the original input coordinate object.
@NeilFraser NeilFraser merged commit c029865 into rc/v11.0.0 May 12, 2024
9 checks passed
@NeilFraser NeilFraser deleted the fraser-snap-ws-comment branch May 12, 2024 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: feature Adds a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants