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

Feature request: selection preserves color #870

Closed
Sam-Davidson opened this issue Jul 13, 2023 · 2 comments
Closed

Feature request: selection preserves color #870

Sam-Davidson opened this issue Jul 13, 2023 · 2 comments
Assignees
Labels
closed in dev Indicates issue is closed in the dev branch, available at: https://scadnano.org/dev/ enhancement New feature or request

Comments

@Sam-Davidson
Copy link

Currently, selecting a strand turns it pink, so the color of that strand can't be known without deselecting it or trying to change it. It would be better for selection to be displayed as a highlight or a thick black outline.

@dave-doty
Copy link
Member

dave-doty commented Jul 14, 2023

Let's solve this with a new option in the View menu that allows the color to be retained upon selection.

The relevant CSS starts at line 667 in web/scadnano-styles.css. We can make an alternate CSS selector that leaves out the stroke: hotpink; part of the formatting, and then use that selector in the proper components when rendering.

@dave-doty dave-doty added the enhancement New feature or request label Jul 14, 2023
EdwinChang24 added a commit that referenced this issue Dec 5, 2023
…-request-selection-preserves-color

 closes #870: Feature request: selection preserves color
@dave-doty
Copy link
Member

FYI, this had a fairly major bug I just discovered and fixed in another branch. Here's the commit that fixed it:

35f4e9f

The problem was that the prop retain_strand_color_on_selection was added to various view components like DesignMainLoopout and DesignMainDomain, but it was not being passed to them from the parent component DesignMainStrandPaths and caused a crash when testing if (props.retain_strand_color_on_selection), since that field was null rather than being true or false.

This really seems like the kind of thing static typing in OverReact is supposed to help prevent. There's apparently some way to get OverReact to warn us when a prop for a component is not being set, but I don't know how to do it. This is a very common bug.

Another thing that might prevent this bug is if we get rid of the prop-drilling and use "React context" instead to pass props down a view tree hierarchy. I was always afraid that would have performance problems, so have been afraid to try it. Plus it would require a big re-write of most of the view code. But the view code would hopefully be much simpler after that, since prop-drilling adds tons of boilerplate.

@dave-doty dave-doty added the closed in dev Indicates issue is closed in the dev branch, available at: https://scadnano.org/dev/ label Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed in dev Indicates issue is closed in the dev branch, available at: https://scadnano.org/dev/ enhancement New feature or request
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

5 participants