-
-
Notifications
You must be signed in to change notification settings - Fork 65
canvas: Support custom coordinate systems #719
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
Conversation
59f0465 to
d14797a
Compare
c23e480 to
91dd180
Compare
fenjalien
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually a cool idea, feels similar to the modifier plans but I don't think theres a way we can connect them somehow.
shame about how it effects the error warnings for the user
| assert.eq(style.pos(), (), message: "Unexpected positional arguments: " + repr(style.pos())) | ||
| style = style.named() | ||
|
|
||
| (a, b, c).map(coordinate.resolve-system) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think these should be removed, they help tell the user where they've entered an invalid coordinate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually I see why they've been removed, thats a really difficult trade off.
Is there a way we could keep track of how many or which draw functions have been created and let the user know about it? Essentially create our own stack trace. It probably shouldn't go in this pr but I would like to at least explore it before this pr gets approved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could add some trace list to the context, that gets shown with any panic/assert we do. Something like element information (function name + element name, if given). This might be slow though, as we have to append and merge that list for every element.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've created a PR for a possible implementation of such functionality here: #726.
91dd180 to
645b111
Compare
|
Rebased on master. |
|
Is there any additional work needing doing on this? |
No, but we lose stack traces for bad coordinates. The problem with stack traces is, that the Typst Web-App does not show them anyway. So |
|
I want to get this into 0.4.0 and I am willing to sacrifice the stack traces for having this feature. I guess we can add better stack-traces/errors with a later PR or release. The current coordinate validation isn't that helpful anyway, as wrong element names etc. are missing the correct code location. |
645b111 to
12805a7
Compare
Proposal: Add the option to use custom coordinates by providing an option to register a callback for "pre-resolving" coordinates.
Motivation: Being able to handle plot/axis coordinates differently than "normal" coordinates in
cetz-plot. But this feature could also be used to implement a tangent system on paths etc. I have not looked at the sources of fletcher, but it may be interesting to them, too.