Fabric.js: Possible feature for free drawing ?

Created on 15 Dec 2016  路  7Comments  路  Source: fabricjs/fabric.js

Hello !

I have a question for a possible feature request. Il would like to remove a free drawing element on hover it. But actually, the area of a drawing element is like this:

feature

So, we remove an element even if "visually" we are not hover the drawing, but we are over the area he takes. It's a little bit confusing for the user.

Is it possible to imagine that the drawing has an area like this:

feature-fabric

It permits to detect the hover only if we are precisely hover the drawing, not hover an area which takes much more space.

Thanks you for your response !! And thank you for this awesome tool !

Most helpful comment

I know fabricjs is not good with docs and so has some secret feature.
But the feature to set perPixelTargetFind to true on the brush i m sure it does not exist.

https://jsfiddle.net/wxonypqw/2/

you can set that to true on the path just created using the path:created event that fires on the end of freeDrawing.

All 7 comments

One immediate solution would be to activate the transparency check for the path drawn:

fabricjs.com/docs ==> perPixelTargetFind

Ok, I will try this. Thank you for your quick response !

I have similar wish - basically to allow selecting objects "below" newer objects. I find it the natural way to select smaller objects placed below a newer larger object.

Try making freehand draw in this Fiddle - fabric freehand and perPixelTargetFind; only parts of polygons outside freehand boundry is selectable.

Thanks you for the fantastic tool and for any support!

there is something like that... try alt click?

Thanks asturur,

But I cannot find any "secret" key combo that changes that the red/green polygons can only be selected if clicking outside the overlapping freehand boundry...!?
And all 3 objects has perPixelTargetFind set true.
Fiddle - fabric freehand and perPixelTargetFind
image

I know fabricjs is not good with docs and so has some secret feature.
But the feature to set perPixelTargetFind to true on the brush i m sure it does not exist.

https://jsfiddle.net/wxonypqw/2/

you can set that to true on the path just created using the path:created event that fires on the end of freeDrawing.

asturur,

You are a hero! Being new to fabric I did not see that distinction between tool and final path when using the the freehand brush tool.
This does it. Your updated fiddle illustrates it beautifully.

Thanks a lot, asturur.

Was this page helpful?
0 / 5 - 0 ratings