-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
mark: Mark auto offsetting #314
Conversation
493565d
to
b44078a
Compare
b44078a
to
72d97f4
Compare
db3e4e9
to
15a5bfa
Compare
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.
Wow I cannot believe how good this is :D
- I don't understand the purpose of
scale
, could you link its tikz alternative? - Would it be possible to generalise the mark placement functions to work on path drawables? Then they can just modify the drawables to shorten them?
This is a great start and covers a lot of what I wanted to address. However I think there could be many more options/stuff brought over. This PR is already a good size though so it should go into a new one. Do you want me to make an issue detailing all the options we could have?
src/mark.typ
Outdated
return -width / 2 | ||
} | ||
|
||
return 0 |
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.
unreachable
src/mark.typ
Outdated
// Get mark symbol mid length, that is the length from the tip to the mid-point | ||
// of its base. For triangular shaped marks, that is the length minus the inset. |
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.
so the distance between the inset and the tip?
src/mark.typ
Outdated
/// | ||
/// - ctx (context): Context | ||
/// - pts (array): Array of vectors | ||
/// - marks (style): Mark style dictionary |
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.
call this style
src/path-util.typ
Outdated
@@ -1,4 +1,6 @@ | |||
// This file contains utility functions for path calculation | |||
#let typst-length = length |
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.
Can this go in util.typ
?
It is here: https://tikz.dev/tikz-arrows#sec-16.3.2 - A factor that gets applied on all size-related (length, width, inset) attributes.
Yes, that would be nice. |
I applied the review annotations. |
2a5054b
to
bdee313
Compare
bdee313
to
99b3a07
Compare
aa1b801
to
bb026a8
Compare
|
#let transform-rotate-xyz(x, y, z) = { | ||
// let (pi, cos, sin) = (calc.pi, calc.cos, calc.sin) |
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 was wrong.
This is work in progress.
Changes: Remove
mark.size
in favor ofmark.width
andmark.length
+mark.scale
.width
: The width of the mark measured at the base (or mid)length
: The length of the mark on the pathscale
: A factor that scaleswidth
andlength
to make it easy changing mark size without having to (re-) calculate ratioinset
: (filled triangles and harpoons) Sets the base inset to create an arrow-head like marksep
: Extra space between multiple marksshorten
: Bézier shorting mode "LINEAR" or "CURVED", use linear or curved offsettingflex
: If true, the mark points in the direction of the secant between its base and tip (default:true
)(">", ">")
arrays instead of a single symbol string.left-harpoon
andright-harpoon
marks"o"
) now use their border as tip (before it was the center)This tries to mirror TikZ main mark size related attributes.
@fenjalien You wanted to change how marks work, what is your plan?
Fixes #247
Fixes #239
Fixes #218