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

Allow decoration to be set with style keys. #465

Open
fenjalien opened this issue Jan 17, 2024 · 4 comments
Open

Allow decoration to be set with style keys. #465

fenjalien opened this issue Jan 17, 2024 · 4 comments

Comments

@fenjalien
Copy link
Member

You currently have to wrap the path that you want to decorate with another decoration function which effectively modifies the output drawables of the path. Instead (or alongside) I would prefer the option to set a path's decoration through a style key:

line((0,0), (1,1), decoration: "zigzag")

Styling options for the decoration could be given further as a dictionary similar to how mark styling works.

@fenjalien
Copy link
Member Author

This would effectively resolve #446

@johannes-wolf
Copy link
Member

Idea we've discussed:
Allow to register path modifiers at the context object. So libraries can add their custom path modifiers, like with user definable (define-mark) marks.

@johannes-wolf
Copy link
Member

johannes-wolf commented Apr 7, 2024

API idea

Elements have a modifier: style key. A modifier can be the name of a modifier function or a dictionary containing the name + style arguments. A user can pass a list of modifiers to an element. All modifiers share some common keys like begin and end to denote the sup section of a path to apply the modifier to.

The modifier API replaces the current path decoration lib.

There will be a separate apply-modifier(.., body) function to apply a modifier to a body.

Modifiers

A path modifier is a function with the following signature (ctx, style, segments, close) -> segments that gets called by the internals.

A user can provide custom modifier functions.

@fenjalien
Copy link
Member Author

Considering what I've detailed in #467 I don't agree. Restricting modifiers to be like this feels like a waste of potential. Decorations should really be a subset of modifiers.

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

No branches or pull requests

2 participants