Skip to content

Conversation

@chrisj
Copy link
Contributor

@chrisj chrisj commented Aug 13, 2024

replaces #378

has a white border when widget has a set value, right click unsets the value

Screenshot 2024-08-13 at 2 31 39 PM

@chrisj chrisj marked this pull request as draft August 13, 2024 18:32
@chrisj
Copy link
Contributor Author

chrisj commented Aug 13, 2024

I still need to add the build time option to enable this feature

@stuarteberg
Copy link
Contributor

I still need to add the build time option to enable this feature

This seems like a generally useful feature... can it be enabled by default?

@chrisj chrisj marked this pull request as ready for review January 16, 2025 20:59
@chrisj chrisj force-pushed the cj_segment_list_color_selector_2 branch from 05c36bd to f804a1f Compare January 16, 2025 21:48
@chrisj chrisj force-pushed the cj_segment_list_color_selector_2 branch from f804a1f to 1519da4 Compare June 23, 2025 19:25
@fcollman
Copy link
Contributor

@jbms can we take a look at this PR? I do think having this enabled by default for neuromancer-demo.appspot.com would be a good idea, but I'll leave that up to you.

@fcollman
Copy link
Contributor

@seankmartin @jbms I think this is a fairly straightforward PR, can someone review it?

@seankmartin
Copy link
Contributor

seankmartin commented Sep 24, 2025

I can try look in more detail, but this is a really nice feature, thanks! The only comments I have at a high level is that the build flag removing this feature from the frontend seems unfortunate since I think it would be widely helpful. I read the old PR for context. Could it instead be the case that the build flag just changes the entry point into the color changer? So with the flag for the separate widget you get what you have now. And without the flag you just get that alt-click on the ID element opens a color picker?

Also would be great if the color select element had a tooltip, especially to incidate the right click to clear set color functionality

@chrisj
Copy link
Contributor Author

chrisj commented Sep 25, 2025

@seankmartin Thanks for the suggestions, looking into it again to see if there was a reason I never implemented alt click as an alternative.

@chrisj chrisj force-pushed the cj_segment_list_color_selector_2 branch 3 times, most recently from 8ae854e to c8aa823 Compare September 26, 2025 17:22
@chrisj
Copy link
Contributor Author

chrisj commented Sep 26, 2025

I added alt+click to set and alt+shift+click to unset on top of the existing optional visible widget.

I added some title attributes for both the widget and the row to show the click behavior.
Screenshot 2025-09-26 at 1 27 20 PM

One issue with the non-visible widget, it is not always clear that the row has a stated color. I added a white 1px border. Which is clear in the screenshot below but basically hidden in the screenshot above with a white segment.
Screenshot 2025-09-26 at 9 24 30 AM

One option would be to change the appearance of the visible toggle.
Screenshot 2025-09-26 at 9 21 00 AM

Or we could forgo an indicator when the widget is hidden

const { selectedSegments } = displayState.segmentationGroupState.value;
selectedSegments.set(id, !selectedSegments.has(id));
});
const trackableRGB = new TrackableRGB(vec3.fromValues(0, 0, 0));
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it would be better to just add the <input type=color> element to the template and handle mouse events in the onMoueDown handler defined above.

The ColorWidget abstraction doesn't seem to help here.

);
children[template.colorWidgetIndex] as HTMLInputElement;
if (SEGMENT_LIST_COLOR_WIDGET_ENABLED) {
setColorWidgetColor(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Currently if SEGMENT_LIST_COLOR_WIDGET_ENABLED is false, then when you open the widget via alt+click the initial color does not match the current color. That could be fixed by calling setColorWidgetColor as part of the alt+click handler.

import { makeFilterButton } from "#src/widget/filter_button.js";
import { makeStarButton } from "#src/widget/star_button.js";

declare const SEGMENT_LIST_COLOR_WIDGET: boolean | undefined;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be prefixed with NEUROGLANCER like all of the other build-time options to avoid (theoretical) name collisions, especially if neuroglancer is being embedded as a library.

@chrisj chrisj force-pushed the cj_segment_list_color_selector_2 branch 2 times, most recently from 959c56b to 3187c72 Compare October 23, 2025 15:28
@chrisj
Copy link
Contributor Author

chrisj commented Oct 23, 2025

@jbms Thanks for the review, I addressed those. One thing that was slightly awkward was needing to add template: SegmentWidgetTemplate to the onMousedown handler.

Color extends vec3 | undefined = vec3,
> extends RefCounted {
element = document.createElement("input");
static template() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the changes in this file can be reverted now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops... done!

@chrisj chrisj force-pushed the cj_segment_list_color_selector_2 branch from 3187c72 to d0f8ebd Compare October 23, 2025 17:38
show individual color picker with alt+click on segment id, alt+shift+click to unset

visible widget enabled with SEGMENT_LIST_COLOR_WIDGET option
@chrisj chrisj force-pushed the cj_segment_list_color_selector_2 branch from d0f8ebd to 09d5738 Compare December 18, 2025 05:31
@fcollman
Copy link
Contributor

@jbms can we take another look at this one?

@jbms jbms merged commit 8e032c5 into google:master Dec 19, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants