-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
no mouseover/mouseout event on objects in groups (mousedown/mouseup exist, though) #4115
Comments
It should be possible to add them, at least for first subTarget with little or no effort. |
i will have no time to do it now, if you want to try tocontribute to the project: in the file canvas.class.js you find this function:
this function is comparing hoveredTarget with target and firing events. |
I'm just starting to play with FabricJS and I have stumbled upon this issue also. Any update on adding mouseover/out for objects in groups? Anything I can help with? |
this can probably be fixed. When you have 260+ open issues you easily forget of the low hanging fruits in the older pages |
I can help with testing :) |
@asturur Could you point me out where in the code i should put the fix. I can't find _fireOverOutEvents in /src/canvas.class.js. (has mentioned earlier) |
@alexhuot1 It is here: fabric.js/src/mixins/canvas_events.mixin.js Line 717 in abc1ca2
|
Yes i can help. Tomorrow i ll pull out some indication on where to start |
Thanks a lot, very appreciated! |
So @alexhuot1 considering that implement this will require you also to write some boring UT with Qunit, here is my suggestion: canvas_events.mixinx.js at line 711 you find this
this function will fire mouse over and out for target. It takes as argument a target and the value that represent the last time it was overed, called Ideally you go over the array of subTargets and for each of them you fire this function. This is the step1. Step 2 is that you have to verify that when moving inside a group those references to old subtargets get cleaned up or they stay attached to canvas and creates unwanted events and leaks. This is the starting point, then we need to check what happen in the PR. If you never contributed to fabric take this in mind:
|
Good thanks, I'll be working on it in a couple of weeks. I'll write you back if i need any more help. |
open pr early for review. comments and refinements will be probably requested, so the sooner you share the pr, the lesser the chance you do too much work in the wrong direction. |
Ok! I'll open the PR once i'll start. We need this feature at my job and i've managed to get me some hours to work on that. That's why i'll start in about a month. Thanks again for you heads up! |
I also need this feature for the same reason as above... changing the appearance of a button on hover. |
When the pr comes out i ll be here to review it fast. |
any updates on this? I find myself in a situation where it would be very helpful to have this feature. |
…ls _setCursorFromEvent for sub targets
…ls _setCursorFromEvent for sub targets pass linting
@jakedowns Nice work! Hope it gets merge quickly! |
* Fixes fabricjs#4115 - triggers in/out events for sub targets; and calls _setCursorFromEvent for sub targets
I have a fabric.Group to which I added a couple of fabric.Rect via group.AddWithUpdate(). (All are displayed correctly in my canvas.)
this event doesn't fire (same with 'mouseout'):
yet this event DOES fire (same with 'mouseup'):
As per http://fabricjs.com/fabric-intro-part-2#events and https://github.com/kangax/fabric.js/wiki/Working-with-events, it should work though:
"For convenience, Fabric takes event system even further, and allows you to attach listeners directly to canvas objects. [...] We're attaching event listeners directly to rectangle and circle instances. Instead of "object:selected", we're using "selected" event."
my group and rect code:
buttonsGroup.addWithUpdate(menuButton);
AndreaBogazzi confirmed on Stackoverflow, that "Sadly mouseUp, mouseDown events are for now the only one supported inside groups."
Example for use case: buttons in a button container. the container is a group, to which the buttons are added to. the buttons shall change their appearance on mouseover.
Adding these events would be greatly appreciated.
The text was updated successfully, but these errors were encountered: