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

fabric.Group initialize does not pass options to fabric.Object superclass #926

Closed
lorenzopolidori opened this issue Oct 24, 2013 · 7 comments
Assignees

Comments

@lorenzopolidori
Copy link
Contributor

fabric.Group.prototype.initialize calls this.callSuper('initialize') instead of this.callSuper('initialize', options), effectively preventing any proper initialization of the object done by fabric.Object.prototype.initialize. Instead, it merely (and blindly) adds all options properties to the prototype with extend(this, options). Is this an intentional behavior for some reason?

I am especially thinking about all properties that need a proper initialization (e.g. 'gradient' and 'shadow') rather than simply being added to the Group prototype. More generally, any property that needs a special initialization which is implemented in fabric.Object should be initialized the same way for fabric.Group.

I suppose calling this.callSuper('initialize', options) and removing extend(this, options) would fix this problem (see an an example fabric.Image).

The same applies to fabric.Group.prototype._set which overrides fabric.Object.prototype._set. To properly initialize all properties defined in fabric.Object, this.callSuper('_set', key, value) should be called instead of this[key] = value;.

@kangax
Copy link
Member

kangax commented Oct 27, 2013

Is this an intentional behavior for some reason?

I don't recall at a moment but if you could update and test things out that would be great!

@lorenzopolidori
Copy link
Contributor Author

Ok, I'll have a look when I have a bit of time.
On 27 Oct 2013 18:23, "Juriy Zaytsev" [email protected] wrote:

Is this an intentional behavior for some reason?

I don't recall at a moment but if you could update and test things out
that would be great!


Reply to this email directly or view it on GitHubhttps://github.com//issues/926#issuecomment-27175519
.

@inssein
Copy link
Contributor

inssein commented Aug 8, 2014

Are there any updates on this? I am creating a custom element extending a group and seem to be having lots of group related issues (such as the group moving, but the contents staying put).

@asturur
Copy link
Member

asturur commented Nov 30, 2014

I think this never went in, right?

@asturur asturur self-assigned this Nov 30, 2014
@kangax
Copy link
Member

kangax commented Nov 30, 2014

Hm, you're right; looks like it didn't. I'll merge PR now if you send it ;)

@asturur
Copy link
Member

asturur commented Nov 30, 2014

Looks like a good offer :)

@asturur
Copy link
Member

asturur commented Nov 30, 2014

#1868

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

4 participants