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

Refactor & Improve Marks #610

Merged
merged 16 commits into from
Sep 6, 2024
Merged

Refactor & Improve Marks #610

merged 16 commits into from
Sep 6, 2024

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 force-pushed the mark-fix-center branch 2 times, most recently from 4537f2c to e41562e Compare May 25, 2024 23:50
@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
@johannes-wolf johannes-wolf added bug 🐛 Something isn't working feature 🎁 Feature Request labels Aug 17, 2024
@johannes-wolf johannes-wolf changed the title mark: Refactor mark drawing Refactor & Improve Marks Aug 17, 2024
@johannes-wolf johannes-wolf added this to the 0.3.0 milestone Aug 19, 2024
src/draw/styling.typ Outdated Show resolved Hide resolved
src/mark-shapes.typ Outdated Show resolved Hide resolved
src/mark-shapes.typ Show resolved Hide resolved
src/mark-shapes.typ Show resolved Hide resolved
src/mark.typ Outdated Show resolved Hide resolved
src/mark-shapes.typ Outdated Show resolved Hide resolved
src/draw/styling.typ Outdated Show resolved Hide resolved
src/draw/styling.typ Show resolved Hide resolved
src/mark-shapes.typ Show resolved Hide resolved
src/mark.typ Outdated Show resolved Hide resolved
@johannes-wolf johannes-wolf merged commit 0cd4394 into master Sep 6, 2024
1 check passed
@johannes-wolf johannes-wolf deleted the mark-fix-center branch September 6, 2024 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working enhancement ⬆️ New feature or request feature 🎁 Feature Request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mark: Not all marks are correctly centered Allow custom marks
2 participants