Skip to content

Commit 09b65ca

Browse files
authored
Improve the visualization of injection and recording #189 (#1021)
* First painter * wip * Tooltip when hovering a segment * Display stimuli in the interactive view * Start to work on the zoom slider * Compoute offset for the whole section, not just the segment * Labels for the recordings * Fixed color of tip * Fixed camera issues * Enhance neurites highlight * Upgrade WebGL lib"
1 parent 2caa969 commit 09b65ca

File tree

33 files changed

+1168
-112
lines changed

33 files changed

+1168
-112
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"@tanstack/react-query-devtools": "^5.84.1",
7171
"@tanstack/react-virtual": "^3.13.12",
7272
"@testing-library/user-event": "^14.5.1",
73-
"@tolokoban/tgd": "^2.0.49",
73+
"@tolokoban/tgd": "^2.0.55",
7474
"@types/d3": "^7.4.0",
7575
"ajv": "^8.17.1",
7676
"antd": "^5.13.3",

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/icons/Center.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { CSSProperties } from 'react';
2+
3+
type Props = {
4+
className?: string;
5+
style?: CSSProperties;
6+
};
7+
8+
export function IconCenter({ className, style }: Props) {
9+
return (
10+
<svg
11+
className={className}
12+
style={{
13+
width: '1.5em',
14+
height: '1.5em',
15+
...style,
16+
}}
17+
viewBox="0 0 24 24"
18+
fill="currentColor"
19+
xmlns="http://www.w3.org/2000/svg"
20+
>
21+
<title>image-filter-center-focus</title>
22+
<path d="M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M19,19H15V21H19A2,2 0 0,0 21,19V15H19M19,3H15V5H19V9H21V5A2,2 0 0,0 19,3M5,5H9V3H5A2,2 0 0,0 3,5V9H5M5,15H3V19A2,2 0 0,0 5,21H9V19H5V15Z" />{' '}
23+
</svg>
24+
);
25+
}

src/components/neuron-viewer/neuron-viewer-with-actions.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import type {
1414
TNeuronViewerHoverData,
1515
} from '@/services/bluenaas-single-cell/renderer';
1616
import { WebglNeuronSelector } from '@/ui/segments/workflows/simulate/single-neuron/shared/steps/webgl-neuron-selector';
17-
// import { WebglNeuronSelector } from '@/ui/segments/workflows/simulate/single-neuron/shared/steps/webgl-neuron-selector/webgl-neuron-selector';
1817

1918
type Props = {
2019
meModelId: string;
@@ -45,7 +44,7 @@ export function NeuronViewerContainer({
4544
useState<TNeuronViewerClickData | null>(null);
4645
const [neuronViewerHoverData, setNeuronViewerOnHoverData] =
4746
useState<TNeuronViewerHoverData | null>(null);
48-
const newViewer = false;
47+
const newViewer = true;
4948

5049
return (
5150
<ErrorBoundary
@@ -123,6 +122,7 @@ export function NeuronViewerContainer({
123122
projectId={projectId}
124123
virtualLabId={virtualLabId}
125124
meModelId={meModelId}
125+
sessionId={sessionId}
126126
/>
127127
)}
128128
</DefaultLoadingSuspense>

src/components/tooltip/tooltip.module.css

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
.container {
22
position: relative;
3-
--backColor: #fff;
4-
--foreColor: #000;
3+
--custom-backColor: #fff;
4+
--custom-foreColor: #000;
55
--arrowWidth: 16px;
66
--arrowHeight: 16px;
7-
--borderColor: var(--foreColor);
8-
--borderColor: color-mix(in srgb, var(--foreColor) 50%, transparent 50%);
7+
--borderColor: var(--custom-foreColor);
8+
--borderColor: color-mix(in srgb, var(--custom-foreColor) 50%, transparent 50%);
99
}
1010

1111
.tooltip {
1212
border-radius: 0.25em;
1313
padding: 0.5em 1em;
14-
color: var(--foreColor, #000);
15-
background-color: var(--backColor, #fff);
14+
color: var(--custom-foreColor, #000);
15+
background-color: var(--custom-backColor, #fff);
1616
position: absolute;
1717
/* width: fit-content; */
1818
z-index: 999999;
@@ -45,7 +45,7 @@
4545
.arrow {
4646
width: var(--arrowWidth);
4747
height: var(--arrowHeight);
48-
fill: var(--backColor);
48+
fill: var(--custom-backColor);
4949
stroke: var(--borderColor);
5050
position: absolute;
5151

src/components/tooltip/tooltip.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import styles from './tooltip.module.css';
77
export interface TooltipProps {
88
className?: string;
99
classNameTooltip?: string;
10+
backColor?: string;
11+
foreColor?: string;
1012
arrow?: 'top' | 'topLeft' | 'topRight';
1113
arrowWidth?: number;
1214
arrowHeight?: number;
@@ -21,10 +23,18 @@ export default function Tooltip({
2123
arrow = 'top',
2224
arrowWidth = 16,
2325
arrowHeight = 16,
26+
backColor = '#fff',
27+
foreColor = '#000',
2428
children,
2529
}: TooltipProps) {
2630
return (
27-
<div className={classNames(className, styles.container)}>
31+
<div
32+
className={classNames(className, styles.container)}
33+
style={{
34+
'--custom-backColor': backColor,
35+
'--custom-foreColor': foreColor,
36+
}}
37+
>
2838
{children}
2939
<div className={classNames(styles.tooltip, styles[arrow], classNameTooltip)}>
3040
{tooltip}

src/features/brain-atlas-viewer/brain-atlas-viewer-gltf/camera.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,24 @@ export function setCamera(context: TgdContext, eventChange: GenericEvent<TgdCame
2020
};
2121
context.camera = new TgdCameraPerspective({
2222
near: 1,
23-
far: 40000,
23+
far: 80000,
2424
fovy: tgdCalcDegToRad(55),
2525
transfo: { ...restTransfo },
2626
});
2727
const controller = new TgdControllerCameraOrbit(context, {
2828
inertiaOrbit: 1000,
29-
speedZoom: 1000,
30-
minDistance: 5000,
31-
maxDistance: 30000,
29+
speedZoom: 1,
30+
minZoom: 0.5,
31+
maxZoom: 20,
3232
});
3333
controller.eventChange.addListener((camera) => eventChange.dispatch(camera));
3434
return () => {
3535
context.animSchedule({
3636
action: tgdActionCreateCameraInterpolation(context.camera, { ...restTransfo }),
3737
duration: 0.5,
38+
onEnd: () => {
39+
controller.resetZoom();
40+
},
3841
});
3942
};
4043
}

src/services/bluenaas-single-cell/labels.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ interface LabelsOptions {
3838
*
3939
* For better clarity and to avoid labels overlapping, we divide the screen
4040
* in four parts: topLeft, topRight, bottomLeft and bottomRight.
41-
* Then we distribute the lables in these regions evenly.
41+
* Then we distribute the labels in these regions evenly.
4242
*/
4343
export class Labels {
4444
private _canvas: HTMLCanvasElement | null = null;

src/ui/segments/workflows/simulate/single-neuron/shared/steps/neuron-visualizer.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@ export function NeuronVisualizer({ sessionId, memodelId }: Props) {
100100
</button>
101101
) : (
102102
<div className="relative flex h-full w-full flex-col rounded-lg">
103-
<div className="absolute top-4 right-4 left-4 z-10 flex items-center justify-between gap-2">
104-
<div>Zoom controller</div>
103+
<div className="absolute top-4 right-4 z-10 flex items-center justify-between gap-2">
105104
<div className="flex items-center gap-2">
106105
<button
107106
type="button"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
.addRecordingDialog {
2+
position: absolute;
3+
left: 0;
4+
top: 0;
5+
width: 100%;
6+
height: 100%;
7+
display: grid;
8+
place-items: center;
9+
background-color: #000a;
10+
z-index: 10;
11+
opacity: 0;
12+
pointer-events: none;
13+
transition: all 0.3s;
14+
15+
&.open {
16+
opacity: 1;
17+
pointer-events: all;
18+
}
19+
20+
> div {
21+
background-color: #3333;
22+
backdrop-filter: blur(6px);
23+
color: #fff;
24+
padding: 1em;
25+
border-radius: 0.5em;
26+
border: 2px solid #fff4;
27+
28+
> h2 {
29+
font-size: 200%;
30+
margin-bottom: 1em;
31+
}
32+
33+
hr {
34+
margin: 2em 0;
35+
width: 100%;
36+
height: 1px;
37+
border: none;
38+
background: linear-gradient(to right, transparent, currentColor, transparent);
39+
}
40+
41+
.buttons {
42+
display: grid;
43+
grid-template-columns: 1fr 1fr;
44+
gap: 1em;
45+
46+
> button {
47+
font: inherit;
48+
border: none;
49+
font-weight: bolder;
50+
text-align: center;
51+
display: grid;
52+
place-items: center;
53+
height: 3em;
54+
border-radius: 99vmax;
55+
background-color: #05a;
56+
border: 1px solid #fff7;
57+
color: #fffe;
58+
padding: 0 1em;
59+
box-shadow: 0 0.125em 0.25em #000;
60+
transition: all 0.3s;
61+
62+
&:hover,
63+
&:active {
64+
filter: brightness(120%);
65+
}
66+
}
67+
}
68+
69+
> footer {
70+
display: flex;
71+
flex-wrap: nowrap;
72+
flex-direction: row;
73+
justify-content: flex-end;
74+
75+
> button {
76+
font: inherit;
77+
font-weight: bold;
78+
color: #7bf;
79+
display: flex;
80+
flex-wrap: nowrap;
81+
flex-direction: row;
82+
justify-content: flex-start;
83+
align-items: center;
84+
gap: 0.5em;
85+
86+
&:hover {
87+
text-decoration: underline;
88+
}
89+
}
90+
}
91+
}
92+
}

0 commit comments

Comments
 (0)