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

Add Tree Group Color Shuffling #6586

Merged
merged 14 commits into from
Nov 1, 2022
Merged

Add Tree Group Color Shuffling #6586

merged 14 commits into from
Nov 1, 2022

Conversation

hotzenklotz
Copy link
Member

@hotzenklotz hotzenklotz commented Oct 24, 2022

PR adds the functionality to set and shuffle the colors of a whole tree group. I also fixed/added some more TS type hints for that file.

URL of deployed dev instance (used for testing):

Steps to test:

  • Open annotation
  • Create a new group and create a few trees
  • Alternatively, use this NML of single node annotations ~400 trees
    lgn_c_22_demo_synapses.nml.zip
  • Right click on any group or sub-group and play around with shuffle / set tree group colors

Issues:


(Please delete unneeded items, merge only when none are left open)

@hotzenklotz hotzenklotz self-assigned this Oct 24, 2022
@hotzenklotz hotzenklotz changed the title Group colors Add Tree Group Color Shuffling Oct 24, 2022
…up_colors

* 'master' of github.com:scalableminds/webknossos:
  suppress error toasts in isDatasetAccessibleBySwitching API call (#6580)
>
<i className="fas fa-adjust" /> Shuffle Tree Group Colors
</Menu.Item>
{id !== MISSING_GROUP_ID ? (
Copy link
Member Author

Choose a reason for hiding this comment

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

The group to tree accessors/helpers do not work with the root group. Hence, we can not offer this option on the root group.

Copy link
Member

Choose a reason for hiding this comment

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

For the sake of completeness/consistency, I'd add an extra method for this case (similar to the shuffle-all-trees case). I think, it should quite short. Something like:

function ... {
    const setTreeColorActions = Object.keys(this.props.trees).map((treeId) => setTreeColorAction(treeId, color));
    this.props.onBatchActions(setTreeColorActions, "SET_TREE_COLOR");
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea. I added such a method.

getNodeStyleClassForBackground = (id: number) => {
const isTreeSelected = this.props.selectedTrees.includes(id);

if (isTreeSelected) {
return "selected-tree-node";
}

return null;
return undefined;
Copy link
Member Author

Choose a reason for hiding this comment

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

Change for type compatibility

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! props for improving the typing, too 👍 only left two minor suggestions.

>
<i className="fas fa-adjust" /> Shuffle Tree Group Colors
</Menu.Item>
{id !== MISSING_GROUP_ID ? (
Copy link
Member

Choose a reason for hiding this comment

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

For the sake of completeness/consistency, I'd add an extra method for this case (similar to the shuffle-all-trees case). I think, it should quite short. Something like:

function ... {
    const setTreeColorActions = Object.keys(this.props.trees).map((treeId) => setTreeColorAction(treeId, color));
    this.props.onBatchActions(setTreeColorActions, "SET_TREE_COLOR");
}

@hotzenklotz hotzenklotz enabled auto-merge (squash) October 25, 2022 11:44
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.

👍 Only see my one suggestion before merging.

hotzenklotz and others added 2 commits November 1, 2022 10:06
…chy_view.tsx

Co-authored-by: Philipp Otto <philippotto@users.noreply.github.com>
@hotzenklotz hotzenklotz enabled auto-merge (squash) November 1, 2022 09:07
@hotzenklotz hotzenklotz merged commit 84b4346 into master Nov 1, 2022
@hotzenklotz hotzenklotz deleted the group_colors branch November 1, 2022 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow to set color for all trees in a group Shuffle tree colors within a group
2 participants