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

mark: Refactor mark drawing #610

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

mark: Refactor mark drawing #610

wants to merge 14 commits into from

Conversation

johannes-wolf
Copy link
Member

@johannes-wolf johannes-wolf commented May 25, 2024

Changes:

  • Marks draw functions now return elements
  • The mark tip/base offset is now calculated by using new "tip" and "base" anchors
  • The marks length is auto determined

Visual Changes:

  • Straight marks have no default extra padding anymore, can be set by via the mark-style

New Features:

  • Users can provide custom marks using the new register-mark() API
#canvas({
  import draw: *

  register-mark("face", style => {
    circle((0,0), radius: .5, fill: yellow)
    arc((0,0), start: 180deg + 30deg, delta: 180deg - 60deg, anchor: "origin", radius: .3)
    circle((-.15, +.15), radius: .1, fill: white)
    circle((-.10, +.10), radius: .025, fill: black)
    circle((+.15, +.15), radius: .1, fill: white)
    circle((+.20, +.10), radius: .025, fill: black)

    anchor("tip", (+.5, 0))
    anchor("base", (-.5, 0))
  }, mnemonic: ":)")

  catmull((-3, 0), (-1,1), (1,-1), (3,0), mark: (
    end: "face", start: (symbol: ":)", flip: true, reverse: true), ))
})

grafik

Ping: @Jollywatt

@johannes-wolf johannes-wolf added the enhancement ⬆️ New feature or request label May 25, 2024
@johannes-wolf johannes-wolf marked this pull request as draft May 25, 2024 19:51
@johannes-wolf johannes-wolf marked this pull request as ready for review May 26, 2024 00:05
@johannes-wolf johannes-wolf removed a link to an issue May 26, 2024
54 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ⬆️ New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mark: Not all marks are correctly centered Allow custom marks
1 participant