fabric-brush icon indicating copy to clipboard operation
fabric-brush copied to clipboard

Draw brush strokes on lower-canvas?

Open fariskas opened this issue 6 years ago • 7 comments

I noticed that the brush strokes are drawn on the upper canvas. Thus making it impossible to layer with other items on the lower canvas.

The default fabric.js drawing brush draws on the lower canvas too.

Also, is it possible to select and move the strokes once they are drawn? Similar to how the default fabric.js brush works

fariskas avatar Oct 19 '17 04:10 fariskas

agree

komagic avatar Sep 20 '18 03:09 komagic

Anyone figure this out?

sops21 avatar Oct 19 '18 12:10 sops21

not me. i just used the default drawing functions from fabric itself. while using textures to mimic the strokes (at least the crayon) on this addon

fariskas avatar Oct 19 '18 17:10 fariskas

@fariskas Would you be willing to share your code for the crayon?

sops21 avatar Oct 19 '18 19:10 sops21

@sops21 sorry for the late reply. but here's what a gist of the code. https://gist.github.com/fariskas/8a066a4adacf093e2bbe64034b41107d

fariskas avatar Oct 21 '18 15:10 fariskas

@fariskas Thanks for sharing that!

One of the devs for fabric.js also posted this possible solution. Its kinda hacky, but it works. I'm going to test performance on it later today:

https://stackoverflow.com/questions/52885498/fabric-js-and-fabric-brush-cant-add-to-lower-canvas/

sops21 avatar Oct 21 '18 18:10 sops21

@sops21 cool! let me know how that goes. might have to relook into using this if its goes well

fariskas avatar Oct 22 '18 02:10 fariskas