drawing round rects on canvas #433
-
| Hi, | 
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
| Hi @robertoranon - so far rounded rects were in hiccup-canvas only directly supported via vanilla hiccup shape syntax, but I've just updated the  // 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  pathFromCubics(asCubic(rect([100,200]), { breakPoints: true, uniform: false, scale: 0.25 }))Hth! | 
Beta Was this translation helpful? Give feedback.
-
| wow, so fast, thanks! | 
Beta Was this translation helpful? Give feedback.

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 optionalrattribute to define the corner radius (which defaults to 0).Just know that this attrib is only used for canvas drawing and/or SVG conversion (just updated thi.ng/hiccup-svg to support this
rattrib 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…