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

CC-158 PoC move color control from Annotation to Rendering fo annotation layers #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion src/layer/annotation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import { getWatchableRenderLayerTransform } from "#src/render_coordinate_transfo
import { RenderLayerRole } from "#src/renderlayer.js";
import type { SegmentationDisplayState } from "#src/segmentation_display_state/frontend.js";
import type { TrackableBoolean } from "#src/trackable_boolean.js";
import { TrackableBooleanCheckbox } from "#src/trackable_boolean.js";
import { ElementVisibilityFromTrackableBoolean, TrackableBooleanCheckbox } from "#src/trackable_boolean.js";
import { makeCachedLazyDerivedWatchableValue } from "#src/trackable_value.js";
import type {
AnnotationLayerView,
Expand All @@ -67,6 +67,7 @@ import {
verifyStringArray,
} from "#src/util/json.js";
import { NullarySignal } from "#src/util/signal.js";
import { ColorWidget } from "#src/widget/color.js";
import { DependentViewWidget } from "#src/widget/dependent_view_widget.js";
import { makeHelpButton } from "#src/widget/help_button.js";
import { LayerReferenceWidget } from "#src/widget/layer_reference.js";
Expand Down Expand Up @@ -776,6 +777,22 @@ class RenderingOptionsTab extends Tab {
),
).element,
);

const colorPicker = this.registerDisposer(
new ColorWidget(layer.annotationDisplayState.color),
);
colorPicker.element.title = "Change annotation display color";
this.registerDisposer(
new ElementVisibilityFromTrackableBoolean(
makeCachedLazyDerivedWatchableValue(
(shader) => shader.match(/\bdefaultColor\b/) !== null,
layer.annotationDisplayState.shaderControls.processedFragmentMain,
),
colorPicker.element,
),
);
element.appendChild(colorPicker.element);

const topRow = document.createElement("div");
topRow.className =
"neuroglancer-segmentation-dropdown-skeleton-shader-header";
Expand Down
16 changes: 0 additions & 16 deletions src/ui/annotations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ import {
registerCallbackWhenSegmentationDisplayStateChanged,
SegmentWidgetFactory,
} from "#src/segmentation_display_state/frontend.js";
import { ElementVisibilityFromTrackableBoolean } from "#src/trackable_boolean.js";
import type { WatchableValueInterface } from "#src/trackable_value.js";
import {
AggregateWatchableValue,
Expand Down Expand Up @@ -101,7 +100,6 @@ import { NullarySignal, Signal } from "#src/util/signal.js";
import { Uint64 } from "#src/util/uint64.js";
import * as vector from "#src/util/vector.js";
import { makeAddButton } from "#src/widget/add_button.js";
import { ColorWidget } from "#src/widget/color.js";
import { makeCopyButton } from "#src/widget/copy_button.js";
import { makeDeleteButton } from "#src/widget/delete_button.js";
import type { DependentViewContext } from "#src/widget/dependent_view_widget.js";
Expand Down Expand Up @@ -394,20 +392,6 @@ export class AnnotationLayerView extends Tab {
toolbox.className = "neuroglancer-annotation-toolbox";

layer.initializeAnnotationLayerViewTab(this);
const colorPicker = this.registerDisposer(
new ColorWidget(this.displayState.color),
);
colorPicker.element.title = "Change annotation display color";
this.registerDisposer(
new ElementVisibilityFromTrackableBoolean(
makeCachedLazyDerivedWatchableValue(
(shader) => shader.match(/\bdefaultColor\b/) !== null,
displayState.shaderControls.processedFragmentMain,
),
colorPicker.element,
),
);
toolbox.appendChild(colorPicker.element);
const { mutableControls } = this;
const pointButton = makeIcon({
text: annotationTypeHandlers[AnnotationType.POINT].icon,
Expand Down
Loading