-
Notifications
You must be signed in to change notification settings - Fork 88
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
Use 'editable' theme node property as configuration #1640
Conversation
b2f0d6f
to
6a4c148
Compare
Rebased onto master, live demo updated and ready for review. |
6a4c148
to
6458c03
Compare
@pgiraud: This is ready for review. |
03bc176
to
d6d6fc0
Compare
* @return {Array.<number|string>} Layer names. | ||
*/ | ||
gmf.LayertreeController.getLayerNodeIds = function(node) { | ||
gmf.LayertreeController.getLayerNodeIds = function(node, opt_editable) { | ||
var editable = opt_editable === true; | ||
var ids = []; | ||
var children = node.children || node; | ||
if (children && children.length) { | ||
children.forEach(function(childNode) { | ||
ids = ids.concat(gmf.LayertreeController.getLayerNodeIds(childNode)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you want to use opt_editable for the children as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand. Isn't that already the case ? If a child node has no children, then we go in else if
below and they are managed, right ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When opt_editable
is true, you want to get the ids of the node which are editable and only them. Calling getLayerNodeIds
for each child of the current node without the "editable" argument will retrieve the ids of the children even if they're not editable.
I may be wrong but you'll get the editable nodes for the first level but all the nodes for level greater than 2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, you're right. I get it now. I'll fix this right away.
d6d6fc0
to
b87469e
Compare
Fixed, rebased onto master, live example updated and ready for merge. |
This PR uses the
editable
theme node property as configuration for thegmf-editfeatureselector
directive to determine which layers are editable. Adjust the other examples as well.In order to see it in action, we need the layer tree. This requires #1636 to be merged first.
Todo
Live example