Skip to content

Snap to grid for given fraction of grid #15

@misteu

Description

@misteu

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions