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

Snap to grid for given fraction of grid #15

Open
misteu opened this issue Oct 1, 2023 · 0 comments
Open

Snap to grid for given fraction of grid #15

misteu opened this issue Oct 1, 2023 · 0 comments

Comments

@misteu
Copy link

misteu commented Oct 1, 2023

Description

Hello!

I did not find anything where I can set up some kind of Snap to grid, e.g. for snapping to half / full or whatever-fraction-of-grid steps.

If this is true and I did not overlook something, I would have a small addition for PianoRollNoteView I could add as a PR.

Also if you don't mind, can you add the "hacktoberfest" topic to the repo? I'd like to participate with that PR :)

Proposed Solution

Add a method that "clamps" the value to a given fraction inside of the existing snap(...) method.

e.g. when clamped(n.start, 0.25) is used, it would snap to 0, 0.25, 0.5, 0.75 and 1 (and so on).

This also nicely works with the preview rectangle shown when dragging around.

Describe Alternatives You've Considered

I searched for an existing implementation in the package but did not find anything.

Additional Context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant