neoscore icon indicating copy to clipboard operation
neoscore copied to clipboard

Create convenience class for ties

Open ajyoon opened this issue 4 years ago • 0 comments

We already support ties via the Slur class, but users do need to be careful to make sure that this tie stays horizontal. We can make this easier for users by creating a dedicated Tie class which automatically enforces horizontal-ness and asks users to only provide an end_x instead of end_pos.

Unfortunately, I don't think something as simple as this would work:

class Tie(Slur, Spanner):
    ...

because I think it would run into multiple-inheritance issues (since Slur extends Spanner2D which extends Spanner). I think the required solution would be something like:


class AbstractSlur():
    @staticmethod
    def draw_slur(params) -> Path
        ...

class Tie(AbstractSlur, Spanner):
    ...

class Slur(AbstractSlur, Spanner2D):
    ...

ajyoon avatar Apr 29 '22 14:04 ajyoon