antfu / drauu

Headless SVG-based drawboard in browser.
https://drauu.netlify.app/
MIT License
1.2k stars 64 forks source link

How to create filled rectangle/ellipse #19

Open lalyos opened 2 years ago

lalyos commented 2 years ago

The Brush documentation hints that a rentagle can be filled:

"Color filled, only works in rectangle and ellipse mode."

But how is it activated on the ui?

haykkh commented 1 year ago

Set the brush's fill to your desired color, eg

drauu.options.brush.fill = 'red'

or

import { createDrauu } from 'drauu'

const drauu = createDrauu({ 
  el: '#svg',
  brush: {
    mode: 'rectangle', // 'reactangle', 'ellipse'
    color: 'skyblue',
    size: 5,
    fill: 'red'
  }
})