Skip to content
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

[Bug]: 'added' fires when an object is added to a group via .add but not when added via group constructor array. #10203

Closed
7 tasks done
drinkspiller opened this issue Oct 11, 2024 · 3 comments

Comments

@drinkspiller
Copy link

drinkspiller commented Oct 11, 2024

CheckList

  • I agree to follow this project's Code of Conduct
  • I have read and followed the Contributing Guide
  • I have read and followed the Issue Tracker Guide
  • I have searched and referenced existing issues and discussions
  • I am filing a BUG report.
  • I have managed to reproduce the bug after upgrading to the latest version
  • I have created an accurate and minimal reproduction

Version

6.0.2

In What environments are you experiencing the problem?

Chrome

Node Version (if applicable)

None

Link To Reproduction

(2 links, see below)

Steps To Reproduce

  1. Create a fabric.Rect instance (or other fabric.FabricObject)
  2. Define an on('added', ()>{}) handler for it
  3. Add it to a fabric.Group (and add the Group to the canvas and renderAll).

Expected Behavior

A defined on('added', ()>{}) handler will fire whether the FabricObject on which the handler is defined is added to a Group via .add or is added to the group when via the group's objects argument when the Group is constructed.

Actual Behavior

(following reproduction steps above)

If the Rect is added to the group via .add, the added event fires. (demo).

If the Rect is added to the group via the group's objects argument when the Group is constructed, the added event does not fire (demo).

Error Message & Stack Trace

No response

@drinkspiller
Copy link
Author

(friendly ping on this)

@asturur
Copy link
Member

asturur commented Dec 22, 2024

I know this is 2 months old now and pointless.
I added this doc page for events
https://fabricjs.com/docs/events/

I do think the added event is pointless in general in fabricJS and i m not sure it should fire at all in general, i tried to explain it in that doc between normal documentation.

What was your case for this event? can you point it out?

@drinkspiller
Copy link
Author

Alas, I can't recall why I needed it at the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants