You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How do you make a fabricjs object "locked" such that:
It's not selectable (obj.selectable = false)
Allow 'mousedown' event for right-click (obj.evented must be true)
No hover state/event (mouse does not detect this obj on hovering or changes the cursor)
Allows mouse to click objects under it (mouse can access objects through it)
I tried looking for the code that deals with the 'evented' prop but I could not find it in the source. The evented property does make the object transparent (ie. able to click through it), but removes the 'mousedown' event.
This is needed in my situation where I need to implement a context menu with lock/unlock object feature. If the object is locked, you still need to be able to right-click on it to display the context menu again so you can unlock it. Also, when locked, you need to be able to access and click objects under it.
Fabricjs 3.6.6
The text was updated successfully, but these errors were encountered:
h-archer
changed the title
How to make an object allow for clicking object under it (without using evented property)
How to click through an object to select object under it (without using evented property)
Dec 17, 2020
h-archer
changed the title
How to click through an object to select object under it (without using evented property)
How do you make a fabricjs object "locked" (without using evented property)
Dec 20, 2020
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
There isn't such a thing for now.
The object with evented=false get removed from the findTarget function and gets excluded by everything.
What you can do is write a simple function to find the target on right click action, to run on canvas.on('mouse:down', () => {})
the function can be easily built looking at how _searchPossibleTargets works in fabricjs
How do you make a fabricjs object "locked" such that:
I tried looking for the code that deals with the 'evented' prop but I could not find it in the source. The evented property does make the object transparent (ie. able to click through it), but removes the 'mousedown' event.
This is needed in my situation where I need to implement a context menu with lock/unlock object feature. If the object is locked, you still need to be able to right-click on it to display the context menu again so you can unlock it. Also, when locked, you need to be able to access and click objects under it.
Fabricjs 3.6.6
The text was updated successfully, but these errors were encountered: