I have tried many thing like calculating location, handling with the event we do have in original fabricjs. Does any have done this before?
相关问题
- character width calculation wrong with some font w
- change button color on-click and remains same for
- fabric.js straight line and select on click
- change text once it is added on canvas
- how to implement a long click listener and onclick
相关文章
- Click event on table row - only trigger if nothing
- How to freedraw Circle in fabricjs using mouse?
- Saving JSON in canvas with fabric.js
- FabricJS image object clipTo shape object issue
- toSVG method not working on extended class with Fa
- How do I disable the onclick event
- Issue with object while restricting it to canvas b
- jQuery rotate div onclick +/-90
This worked for me:
I downloaded fabricjs from asturur repo. build fabric.js file
and it works!
Then you can use events on objects in the groups.
In my app i decided to search for events from mousedown callback
In FabricJS once the objects have been assembled into a group the Events are only happening there, even the selected events - so you cannot detect which of the items in the group are being selected. Inside the event handler
Even attaching event handlers to the objects before assembly into the group the handlers don't fire :(
May be this helps you http://jsfiddle.net/UKbaseduser/Kt9Mk/1/
Also there is similar discussion going on over here https://groups.google.com/forum/#!topic/fabricjs/hQwHxGfyx6w may be it throws you some pointers.
I do not have enough reputation to be able to comment on an existing answer so here goes. I am using v2.X of Fabric and all of the existing solutions do not work. Either console errors for methods that no longer exist or always
false
in case ofcontainsPoint
so I built my own.and the helper functions
I've tested this with simple groups, nested groups and groups inside groups inside groups.
It is possible to listen for events on the inner object by adding the option:
subTargetCheck: true
to the fabric.Group object.