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

Method for adding a layer to a project is not documented #903

Closed
bmacnaughton opened this issue Jan 13, 2016 · 9 comments
Closed

Method for adding a layer to a project is not documented #903

bmacnaughton opened this issue Jan 13, 2016 · 9 comments

Comments

@bmacnaughton
Copy link
Contributor

project#addChild is not documented. If a layer has been removed 'addChild' seems to be the only way to add it back.

@lehni
Copy link
Member

lehni commented Jan 13, 2016

Yes, that makes sense! Although I consider #addChild() more an internal helper than anything else, as it can be called on Layer, Group and Project (See Item#bringToFront() and Item#copyTo()).

For Project, it would make more sense if it was called Project#addLayer(), and #addChild() could be an undocumented alias to it, for internal use only.

@bmacnaughton
Copy link
Contributor Author

Agreed - it makes more sense to have a function #addLayer() as it's not obvious that the #addChild() will add layers - projects have other "children".

lehni added a commit that referenced this issue Jan 16, 2016
…rtLayer()

Also replace #_addToProject() with new #_insertItem() helper, and streamline all #_insertSibling() related methods.

Relates to #903
@lehni
Copy link
Member

lehni commented Jan 16, 2016

Working on this issue just has created all kinds of simplifications in the code, and has triggered solutions to other issues, e.g. #832. I love when that happens.

@lehni
Copy link
Member

lehni commented Jan 16, 2016

Do you think we also need a #insertLayers() and #removeLayers() for reasons of symmetry? Or is that not really necessary. I think not...

@bmacnaughton
Copy link
Contributor Author

No, I don't think so. It doesn't seem like adding multiple layers is a common use case and it's easy enough to 1) add this later if it's an issue - it's non-breaking, and 2) do it in one's own code.

@lehni
Copy link
Member

lehni commented Jan 16, 2016

Great! So all that's missing is the documentation now.

@bmacnaughton
Copy link
Contributor Author

The old insertChild() documentation needs to be changed too so it doesn't say it can be used with layers.

bmacnaughton added a commit to bmacnaughton/paper.js that referenced this issue Jan 16, 2016
@lehni
Copy link
Member

lehni commented Jan 16, 2016

Well, it can: Layers can have sub-layers!

@bmacnaughton
Copy link
Contributor Author

Makes sense. I've never used it but flexibility is usually a good thing.

@lehni lehni closed this as completed in 36cb88d Jan 16, 2016
bmacnaughton added a commit to bmacnaughton/paper.js that referenced this issue Jan 31, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants