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

Added set active tree action by name to api and cross origin api #4317

Merged
merged 4 commits into from
Nov 14, 2019

Conversation

MichaelBuessemeyer
Copy link
Contributor

@MichaelBuessemeyer MichaelBuessemeyer commented Nov 11, 2019

This PR adds an action to set a tree with a given name. active.

URL of deployed dev instance (used for testing):

  • https://___.webknossos.xyz

Steps to test:

  • open a skeleton tracing and create some trees.
  • Then use the following script in your console to check whether the selection works:
    window.webknossos.apiReady(3).then(async (api) => { api.tracing.setActiveTreeByName(<tree_name>)});

Issues:

  • This PR has no issue.

Copy link
Member

@philippotto philippotto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool stuff! See my one nitpick before merging :)

if (trees[treeIdAsNumber].name === treeName) {
treeWithMatchingName = trees[treeIdAsNumber];
}
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, this block can be shortened to:

const treeWithMatchingName = Object.values(trees).find(tree => tree.name == treeName)

(in case, flow doesn't get the type information object.values() might be replacable with _.values)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this feedback/nagging about this 👍

@bulldozer-boy bulldozer-boy bot merged commit 416c103 into master Nov 14, 2019
@bulldozer-boy bulldozer-boy bot deleted the set-active-tree-by-name branch November 14, 2019 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants