Skip to content

drawing round rects on canvas #433

Discussion options

You must be logged in to vote

Hi @robertoranon - so far rounded rects were in hiccup-canvas only directly supported via vanilla hiccup shape syntax, but I've just updated the draw() function in this package to also support thi.ng/geom shapes. For those shape you just use the optional r attribute to define the corner radius (which defaults to 0).

// a rounded rect with radius=20
rect([0,0], [100, 200], { r: 20 })

Just know that this attrib is only used for canvas drawing and/or SVG conversion (just updated thi.ng/hiccup-svg to support this r attrib too) - but the attrib has no impact on any other shape calculations/transformations in thi.ng/geom. If you really do need the latter, you'll need to (manually for now) const…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
4 replies
@cdaein
Comment options

@postspectacular
Comment options

@cdaein
Comment options

@postspectacular
Comment options

Answer selected by robertoranon
Comment options

You must be logged in to vote
1 reply
@postspectacular
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants