@vitessce/layer-controller 3.5.11 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/deflate-DcFBP_ON.js +10 -0
- package/dist/{index-9f5d422b.js → index-BYqNjxB4.js} +68409 -65627
- package/dist/index.js +1 -4
- package/dist/{jpeg-de2a446b.js → jpeg-BRMnDFy7.js} +20 -4
- package/dist/lerc-edG1hf7C.js +2020 -0
- package/dist/{lzw-fcb90a13.js → lzw-ByU_vDUr.js} +1 -4
- package/dist/{packbits-37339fac.js → packbits-6stor0im.js} +1 -4
- package/dist/{pako.esm-68f84e2a.js → pako.esm-SxljTded.js} +33 -1839
- package/dist/{raw-043cf610.js → raw-CTEIV_TP.js} +1 -4
- package/dist/{webimage-22a3672d.js → webimage-BPClhqkm.js} +1 -4
- package/dist-tsc/BitmaskChannelController.d.ts.map +1 -1
- package/dist-tsc/BitmaskChannelController.js +2 -3
- package/dist-tsc/ChannelOptions.d.ts.map +1 -1
- package/dist-tsc/ChannelOptions.js +4 -5
- package/dist-tsc/ColorPalette.d.ts.map +1 -1
- package/dist-tsc/ColorPalette.js +4 -5
- package/dist-tsc/ImageAddButton.d.ts.map +1 -1
- package/dist-tsc/ImageAddButton.js +3 -4
- package/dist-tsc/LayerController.d.ts.map +1 -1
- package/dist-tsc/LayerController.js +16 -23
- package/dist-tsc/LayerControllerSubscriber.d.ts.map +1 -1
- package/dist-tsc/LayerControllerSubscriber.js +11 -9
- package/dist-tsc/LayerOptions.d.ts.map +1 -1
- package/dist-tsc/LayerOptions.js +15 -15
- package/dist-tsc/RasterChannelController.js +4 -4
- package/dist-tsc/VectorLayerController.js +4 -4
- package/dist-tsc/VolumeOptions.d.ts.map +1 -1
- package/dist-tsc/VolumeOptions.js +7 -7
- package/dist-tsc/shared-channel-controls.d.ts.map +1 -1
- package/dist-tsc/shared-channel-controls.js +6 -4
- package/dist-tsc/styles.d.ts +72 -8
- package/dist-tsc/styles.d.ts.map +1 -1
- package/dist-tsc/styles.js +31 -16
- package/package.json +10 -11
- package/src/BitmaskChannelController.js +4 -5
- package/src/ChannelOptions.js +4 -5
- package/src/ColorPalette.js +4 -5
- package/src/ImageAddButton.js +3 -4
- package/src/LayerController.js +34 -37
- package/src/LayerControllerSubscriber.js +13 -7
- package/src/LayerOptions.js +21 -24
- package/src/RasterChannelController.js +8 -8
- package/src/VectorLayerController.js +7 -7
- package/src/VolumeOptions.js +12 -14
- package/src/shared-channel-controls.js +8 -6
- package/src/styles.js +31 -16
- package/dist/deflate-8a6ed1b8.js +0 -13
- package/dist/lerc-e50baa38.js +0 -2014
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitmaskChannelController.d.ts","sourceRoot":"","sources":["../src/BitmaskChannelController.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"BitmaskChannelController.d.ts","sourceRoot":"","sources":["../src/BitmaskChannelController.js"],"names":[],"mappings":";AAIA;;;;;;;;;GASG;AACH;;;;;;;;gBAgDC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { RemoveCircle as RemoveCircleIcon } from '@
|
|
4
|
-
import { IconButton, Grid } from '@material-ui/core';
|
|
3
|
+
import { RemoveCircle as RemoveCircleIcon, IconButton, Grid } from '@vitessce/styles';
|
|
5
4
|
import { ChannelSelectionDropdown, ChannelVisibilityCheckbox } from './shared-channel-controls.js';
|
|
6
5
|
/**
|
|
7
6
|
* Controller for the handling the bitmask channels.
|
|
@@ -25,6 +24,6 @@ function BitmaskChannelController({ visibility = false, dimName, channelOptions,
|
|
|
25
24
|
* e.g { channel: 2 } // channel dimension, third channel
|
|
26
25
|
*/
|
|
27
26
|
const createSelection = index => ({ [dimName]: index });
|
|
28
|
-
return (_jsxs(Grid, { container: true, direction: "row", justifyContent: "space-between", children: [_jsx(Grid, {
|
|
27
|
+
return (_jsxs(Grid, { container: true, direction: "row", justifyContent: "space-between", children: [_jsx(Grid, { size: 2, children: _jsx(ChannelVisibilityCheckbox, { color: [220, 220, 220], checked: visibility, toggle: () => handlePropertyChange('visible', !visibility) }) }), _jsx(Grid, { size: 9, children: _jsx(ChannelSelectionDropdown, { handleChange: v => handlePropertyChange('selection', createSelection(v)), selectionIndex: selectionIndex, disableOptions: disableOptions, channelOptions: channelOptions }) }), _jsx(Grid, { size: 1, children: _jsx(IconButton, { onClick: handleChannelRemove, style: { padding: '6px 6px 6px 0px' }, "aria-label": "Remove channel", children: _jsx(RemoveCircleIcon, {}) }) })] }));
|
|
29
28
|
}
|
|
30
29
|
export default BitmaskChannelController;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChannelOptions.d.ts","sourceRoot":"","sources":["../src/ChannelOptions.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"ChannelOptions.d.ts","sourceRoot":"","sources":["../src/ChannelOptions.js"],"names":[],"mappings":";AAyBA;;;;;GAKG;AACH;;;;gBA2CC"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
|
-
import { makeStyles, MenuItem } from '@
|
|
4
|
-
import { MoreVert as MoreVertIcon } from '@material-ui/icons';
|
|
3
|
+
import { makeStyles, MenuItem, MoreVert as MoreVertIcon } from '@vitessce/styles';
|
|
5
4
|
import { PopperMenu } from '@vitessce/vit-s';
|
|
6
5
|
import { useSpanStyles } from './styles.js';
|
|
7
6
|
import ColorPalette from './ColorPalette.js';
|
|
8
|
-
const useStyles = makeStyles(() => ({
|
|
7
|
+
const useStyles = makeStyles()(() => ({
|
|
9
8
|
menuButton: {
|
|
10
9
|
backgroundColor: 'transparent',
|
|
11
10
|
},
|
|
@@ -19,7 +18,7 @@ const useStyles = makeStyles(() => ({
|
|
|
19
18
|
}));
|
|
20
19
|
function MuiSpan(props) {
|
|
21
20
|
const { children } = props;
|
|
22
|
-
const classes = useSpanStyles();
|
|
21
|
+
const { classes } = useSpanStyles();
|
|
23
22
|
return _jsx("span", { className: classes.span, children: children });
|
|
24
23
|
}
|
|
25
24
|
/**
|
|
@@ -30,7 +29,7 @@ function MuiSpan(props) {
|
|
|
30
29
|
*/
|
|
31
30
|
function ChannelOptions({ handlePropertyChange, handleChannelRemove, handleIQRUpdate }) {
|
|
32
31
|
const [open, setOpen] = useState(false);
|
|
33
|
-
const classes = useStyles();
|
|
32
|
+
const { classes } = useStyles();
|
|
34
33
|
const handleColorSelect = (color) => {
|
|
35
34
|
handlePropertyChange('color', color);
|
|
36
35
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPalette.d.ts","sourceRoot":"","sources":["../src/ColorPalette.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"ColorPalette.d.ts","sourceRoot":"","sources":["../src/ColorPalette.js"],"names":[],"mappings":";AAyBA;;gBAoBC"}
|
package/dist-tsc/ColorPalette.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { IconButton, makeStyles } from '@
|
|
4
|
-
import { Lens as LensIcon } from '@material-ui/icons';
|
|
3
|
+
import { IconButton, makeStyles, Lens as LensIcon } from '@vitessce/styles';
|
|
5
4
|
import { VIEWER_PALETTE } from '@vitessce/utils';
|
|
6
|
-
const useStyles = makeStyles(theme => ({
|
|
5
|
+
const useStyles = makeStyles()(theme => ({
|
|
7
6
|
paletteContainer: {
|
|
8
7
|
width: '70px',
|
|
9
8
|
height: '40px',
|
|
@@ -20,11 +19,11 @@ const useStyles = makeStyles(theme => ({
|
|
|
20
19
|
width: '17px',
|
|
21
20
|
height: '17px',
|
|
22
21
|
stroke: theme.palette.action.selected,
|
|
23
|
-
|
|
22
|
+
strokeWidth: '1px',
|
|
24
23
|
},
|
|
25
24
|
}));
|
|
26
25
|
const ColorPalette = ({ handleChange }) => {
|
|
27
|
-
const classes = useStyles();
|
|
26
|
+
const { classes } = useStyles();
|
|
28
27
|
return (_jsx("div", { className: classes.paletteContainer, "aria-label": "Color swatch", children: VIEWER_PALETTE.map(color => (_jsx(IconButton, { className: classes.button, onClick: () => handleChange(color), "aria-label": `Change color to ${color}`, children: _jsx(LensIcon, { fontSize: "small", style: { color: `rgb(${color})` }, className: classes.icon }) }, color))) }));
|
|
29
28
|
};
|
|
30
29
|
export default ColorPalette;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageAddButton.d.ts","sourceRoot":"","sources":["../src/ImageAddButton.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"ImageAddButton.d.ts","sourceRoot":"","sources":["../src/ImageAddButton.js"],"names":[],"mappings":";AAqBA;;;uBA0BC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
|
-
import { makeStyles, MenuItem } from '@
|
|
4
|
-
import { Add as AddIcon } from '@material-ui/icons';
|
|
3
|
+
import { makeStyles, MenuItem, Add as AddIcon } from '@vitessce/styles';
|
|
5
4
|
import { PopperMenu } from '@vitessce/vit-s';
|
|
6
|
-
const useStyles = makeStyles(() => ({
|
|
5
|
+
const useStyles = makeStyles()(() => ({
|
|
7
6
|
addButton: {
|
|
8
7
|
marginTop: '10px',
|
|
9
8
|
marginBottom: '10px',
|
|
@@ -15,7 +14,7 @@ function ImageAddIcon() {
|
|
|
15
14
|
}
|
|
16
15
|
function ImageAddButton({ imageOptions, handleImageAdd }) {
|
|
17
16
|
const [open, setOpen] = useState(false);
|
|
18
|
-
const classes = useStyles();
|
|
17
|
+
const { classes } = useStyles();
|
|
19
18
|
const handleAdd = (imgData) => {
|
|
20
19
|
setOpen(prev => !prev);
|
|
21
20
|
handleImageAdd(imgData);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LayerController.d.ts","sourceRoot":"","sources":["../src/LayerController.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LayerController.d.ts","sourceRoot":"","sources":["../src/LayerController.js"],"names":[],"mappings":"AA2EA;;;;;;;GAOG;AACH,iEAshBC"}
|
|
@@ -2,9 +2,8 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import React, { useState, useRef, useEffect } from 'react';
|
|
3
3
|
import { useId } from 'react-aria';
|
|
4
4
|
import { viv } from '@vitessce/gl';
|
|
5
|
-
import { GLOBAL_LABELS, getSourceFromLoader,
|
|
6
|
-
import { Grid, Button, Slider, Tabs, Tab, InputLabel, Accordion, AccordionDetails, AccordionSummary, } from '@
|
|
7
|
-
import { Add as AddIcon, ExpandMore as ExpandMoreIcon, Visibility as VisibilityIcon, VisibilityOff as VisibilityOffIcon, } from '@material-ui/icons';
|
|
5
|
+
import { GLOBAL_LABELS, getSourceFromLoader, getMultiSelectionStats, DOMAINS, canLoadResolution, } from '@vitessce/spatial-utils';
|
|
6
|
+
import { Grid, Button, Slider, Tabs, Tab, InputLabel, Accordion, AccordionDetails, AccordionSummary, Box, Add as AddIcon, ExpandMore as ExpandMoreIcon, Visibility as VisibilityIcon, VisibilityOff as VisibilityOffIcon, } from '@vitessce/styles';
|
|
8
7
|
import LayerOptions from './LayerOptions.js';
|
|
9
8
|
import VolumeOptions from './VolumeOptions.js';
|
|
10
9
|
import { useControllerSectionStyles, useInputLabelStyles, useOverflowEllipsisGridStyles, useAccordionStyles, } from './styles.js';
|
|
@@ -45,7 +44,7 @@ const buttonStyles = {
|
|
|
45
44
|
* @prop {function} handleLayerChange Callback for handling the changing of layer properties.
|
|
46
45
|
*/
|
|
47
46
|
export default function LayerController(props) {
|
|
48
|
-
const { layer, name, loader, theme, handleLayerRemove, handleLayerChange, shouldShowTransparentColor, shouldShowDomain, shouldShowColormap, ChannelController, setViewState, disable3d, setImageLayerCallback, setAreLayerChannelsLoading, areLayerChannelsLoading, disabled, spatialHeight, spatialWidth,
|
|
47
|
+
const { layer, name, loader, theme, handleLayerRemove, handleLayerChange, shouldShowTransparentColor, shouldShowDomain, shouldShowColormap, ChannelController, setViewState, disable3d, setImageLayerCallback, setAreLayerChannelsLoading, areLayerChannelsLoading, disabled, spatialHeight, spatialWidth, photometricInterpretation, shouldShowRemoveLayerButton, } = props;
|
|
49
48
|
const { colormap, opacity, channels, transparentColor, renderingMode, xSlice, ySlice, zSlice, resolution, use3d, modelMatrix, } = layer;
|
|
50
49
|
// Channels are used in a lot of callbacks and change handlers
|
|
51
50
|
// so ensuring they have an up to date copy of the data ensures consistency.
|
|
@@ -260,10 +259,10 @@ export default function LayerController(props) {
|
|
|
260
259
|
, { dimName: channelLabel, visibility: c.visible, selectionIndex: c.selection[channelLabel], slider: c.slider, color: c.color, channels: channels, channelId: channelId, domainType: domainType, loader: loader, globalLabelValues: globalLabelValues, theme: theme, channelOptions: channelOptions, colormapOn: Boolean(colormap), handlePropertyChange: handleChannelPropertyChange, handleChannelRemove: handleChannelRemove, handleIQRUpdate: handleIQRUpdate, setRasterLayerCallback: setImageLayerCallback, isLoading: areLayerChannelsLoading[channelId], use3d: use3d }, `channel-controller-${channelId}`));
|
|
261
260
|
});
|
|
262
261
|
}
|
|
263
|
-
const controllerSectionClasses = useControllerSectionStyles();
|
|
264
|
-
const accordionClasses = useAccordionStyles();
|
|
265
|
-
const inputLabelClasses = useInputLabelStyles();
|
|
266
|
-
const overflowEllipsisGridClasses = useOverflowEllipsisGridStyles();
|
|
262
|
+
const { classes: controllerSectionClasses } = useControllerSectionStyles();
|
|
263
|
+
const { classes: accordionClasses } = useAccordionStyles();
|
|
264
|
+
const { classes: inputLabelClasses } = useInputLabelStyles();
|
|
265
|
+
const { classes: overflowEllipsisGridClasses } = useOverflowEllipsisGridStyles();
|
|
267
266
|
const { visible } = layer;
|
|
268
267
|
const visibleSetting = typeof visible === 'boolean' ? visible : true;
|
|
269
268
|
const Visibility = visibleSetting ? VisibilityIcon : VisibilityOffIcon;
|
|
@@ -275,28 +274,22 @@ export default function LayerController(props) {
|
|
|
275
274
|
const FullController = (_jsxs(_Fragment, { children: [_jsx(LayerOptions, { channels: channels, opacity: opacity, colormap: colormap, transparentColor: transparentColor, domainType: domainType,
|
|
276
275
|
// Only allow for global dimension controllers that
|
|
277
276
|
// exist in the `dimensions` part of the loader.
|
|
278
|
-
globalControlLabels: labels.filter(label => GLOBAL_LABELS.includes(label)), globalLabelValues: globalLabelValues, handleOpacityChange: setOpacity, handleColormapChange: setColormap, handleGlobalChannelsSelectionChange: handleGlobalChannelsSelectionChange, handleTransparentColorChange: setTransparentColor, disableChannelsIfRgbDetected:
|
|
277
|
+
globalControlLabels: labels.filter(label => GLOBAL_LABELS.includes(label)), globalLabelValues: globalLabelValues, handleOpacityChange: setOpacity, handleColormapChange: setColormap, handleGlobalChannelsSelectionChange: handleGlobalChannelsSelectionChange, handleTransparentColorChange: setTransparentColor, disableChannelsIfRgbDetected: photometricInterpretation === 'RGB', handleDomainChange: handleDomainChange, shouldShowTransparentColor: shouldShowTransparentColor, shouldShowDomain: shouldShowDomain, shouldShowColormap: shouldShowColormap, use3d: use3d, loader: loader, handleMultiPropertyChange: handleMultiPropertyChange, resolution: resolution, disable3d: disable3d, setRasterLayerCallback: setImageLayerCallback, setAreAllChannelsLoading: setAreAllChannelsLoading, setViewState: setViewState, spatialHeight: spatialHeight, spatialWidth: spatialWidth, modelMatrix: modelMatrix }), photometricInterpretation === 'RGB'
|
|
279
278
|
? null
|
|
280
|
-
: channelControllers,
|
|
281
|
-
return (_jsxs(Accordion, {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
}, expandIcon: _jsx(ExpandMoreIcon, { role: "presentation" }), "aria-controls": `layer-${name}-controls`, "aria-expanded": isExpanded, children: _jsxs(Grid, { container: true, direction: "column", m: 1, justifyContent: "center", children: [_jsxs(Grid, { item: true, classes: { item: overflowEllipsisGridClasses.item }, children: [_jsx(Button, { "aria-label": "Toggle layer visibility", onClick: (e) => {
|
|
279
|
+
: channelControllers, photometricInterpretation === 'RGB' ? null : (_jsx(Button, { disabled: channels.length === viv.MAX_CHANNELS, onClick: handleChannelAdd, fullWidth: true, variant: "outlined", style: buttonStyles, startIcon: _jsx(AddIcon, {}), size: "small", children: "Add Channel" }))] }));
|
|
280
|
+
return (_jsxs(Accordion, { slotProps: {
|
|
281
|
+
root: { elevation: 4, className: controllerSectionClasses.accordionRoot },
|
|
282
|
+
}, onChange: (e, expanded) => !disabled
|
|
283
|
+
&& setIsExpanded(expanded && e?.target?.attributes?.role?.value === 'presentation'), expanded: !disabled && isExpanded, id: `layer-controls-accordion-${layerControlsId}`, children: [_jsx(AccordionSummary, { slotProps: {
|
|
284
|
+
content: { className: accordionClasses.content },
|
|
285
|
+
}, expandIcon: _jsx(ExpandMoreIcon, { role: "presentation" }), "aria-controls": `layer-${name}-controls`, "aria-expanded": isExpanded, children: _jsxs(Grid, { container: true, direction: "column", justifyContent: "center", sx: { flexGrow: 1 }, children: [_jsxs(Grid, { container: true, size: 12, direction: "row", alignItems: "flex-start", classes: { item: overflowEllipsisGridClasses.item }, children: [_jsx(Box, { component: "div", role: "button", "aria-label": "Toggle layer visibility", onClick: (e) => {
|
|
288
286
|
if (!disabled) {
|
|
289
287
|
// Needed to prevent affecting the expansion panel from changing
|
|
290
288
|
e.stopPropagation();
|
|
291
289
|
const nextVisible = typeof visible === 'boolean' ? !visible : false;
|
|
292
290
|
setVisible(nextVisible);
|
|
293
291
|
}
|
|
294
|
-
}, style: {
|
|
295
|
-
marginRight: 8,
|
|
296
|
-
marginBottom: 2,
|
|
297
|
-
padding: 0,
|
|
298
|
-
minWidth: 0,
|
|
299
|
-
}, children: _jsx(Visibility, {}) }), name] }), !disabled && !isExpanded && !use3d && (_jsxs(Grid, { container: true, direction: "row", alignItems: "center", justifyContent: "center", children: [_jsx(Grid, { item: true, xs: 6, children: _jsx(InputLabel, { htmlFor: `layer-${name}-opacity-closed`, classes: { root: inputLabelClasses.inputLabelRoot }, children: "Opacity:" }) }), _jsx(Grid, { item: true, xs: 6, children: _jsx(Slider, { id: `layer-${name}-opacity-closed`, value: opacity, onChange: (e, v) => setOpacity(v), valueLabelDisplay: "auto", "aria-label": `Adjust opacity for layer ${name}`, min: 0, max: 1, step: 0.01, orientation: "horizontal" }) })] }))] }) }), _jsxs(AccordionDetails, { classes: { root: accordionClasses.accordionDetailsRoot }, id: `layer-${name}-controls`, children: [useVolumeTabs ? (_jsxs(_Fragment, { children: [_jsxs(Tabs, { value: tab, onChange: handleTabChange, "aria-label": "Change the layer tab type", style: { height: '24px', minHeight: '24px' }, children: [_jsx(Tab, { label: "Channels", "aria-label": "Channels tab", style: {
|
|
292
|
+
}, className: accordionClasses.accordionVisibilityIconBox, children: _jsx(Visibility, {}) }), _jsx(Box, { component: "div", className: accordionClasses.accordionNameBox, children: name })] }), !disabled && !isExpanded && !use3d && (_jsxs(Grid, { container: true, direction: "row", sx: { justifyContent: 'flex-start', flexGrow: 1 }, children: [_jsx(Grid, { size: 5, children: _jsx(InputLabel, { htmlFor: `layer-${name}-opacity-closed`, classes: { root: inputLabelClasses.inputLabelRoot }, children: "Opacity:" }) }), _jsx(Grid, { size: 6, children: _jsx(Slider, { id: `layer-${name}-opacity-closed`, value: opacity, onChange: (e, v) => setOpacity(v), valueLabelDisplay: "auto", "aria-label": `Adjust opacity for layer ${name}`, min: 0, max: 1, step: 0.01, orientation: "horizontal" }) })] }))] }) }), _jsxs(AccordionDetails, { id: `layer-${name}-controls`, children: [useVolumeTabs ? (_jsxs(_Fragment, { children: [_jsxs(Tabs, { value: tab, onChange: handleTabChange, "aria-label": "Change the layer tab type", style: { height: '24px', minHeight: '24px' }, children: [_jsx(Tab, { label: "Channels", "aria-label": "Channels tab", style: {
|
|
300
293
|
fontSize: '.75rem',
|
|
301
294
|
bottom: 12,
|
|
302
295
|
width: '50%',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LayerControllerSubscriber.d.ts","sourceRoot":"","sources":["../src/LayerControllerSubscriber.js"],"names":[],"mappings":"AAuSA;;;;;;;;;;;;;;;GAeG;AACH,iDAbG;IAAsB,KAAK,EAAnB,MAAM;IACQ,kBAAkB,EAAhC,MAAM;IAEU,mBAAmB;IAErB,KAAK,EAAnB,MAAM;IACQ,SAAS,EAAvB,MAAM;IACS,eAAe,EAA9B,OAAO;IACQ,4BAA4B,EAA3C,OAAO;IAEQ,8BAA8B,EAA7C,OAAO;CAEjB,
|
|
1
|
+
{"version":3,"file":"LayerControllerSubscriber.d.ts","sourceRoot":"","sources":["../src/LayerControllerSubscriber.js"],"names":[],"mappings":"AAuSA;;;;;;;;;;;;;;;GAeG;AACH,iDAbG;IAAsB,KAAK,EAAnB,MAAM;IACQ,kBAAkB,EAAhC,MAAM;IAEU,mBAAmB;IAErB,KAAK,EAAnB,MAAM;IACQ,SAAS,EAAvB,MAAM;IACS,eAAe,EAA9B,OAAO;IACQ,4BAA4B,EAA3C,OAAO;IAEQ,8BAA8B,EAA7C,OAAO;CAEjB,eAgNA"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
/* eslint-disable dot-notation */
|
|
3
3
|
/* eslint-disable no-unused-vars */
|
|
4
4
|
import React, { useCallback, useRef, forwardRef, } from 'react';
|
|
5
|
-
import { Grid } from '@
|
|
5
|
+
import { Grid } from '@vitessce/styles';
|
|
6
6
|
import { TitleInfo, useReady, useClosestVitessceContainerSize, useWindowDimensions, useImageData, useObsLocationsData, useObsSegmentationsData, useCoordination, useLoaders, useAuxiliaryCoordination, useComponentLayout, } from '@vitessce/vit-s';
|
|
7
7
|
import { ViewType, COMPONENT_COORDINATION_TYPES, ViewHelpMapping } from '@vitessce/constants-internal';
|
|
8
8
|
import { capitalize } from '@vitessce/utils';
|
|
@@ -18,7 +18,7 @@ import ImageAddButton from './ImageAddButton.js';
|
|
|
18
18
|
// expensive so we have to be careful with props in this file in general.
|
|
19
19
|
const LayerControllerMemoized = React.memo(forwardRef((props, ref) => {
|
|
20
20
|
const { title, closeButtonVisible, downloadButtonVisible, removeGridComponent, theme, isReady, dataset, obsType, moleculesLayer, setMoleculesLayer, cellsLayer, // May be one polygon layer object or an array of bitmask layers.
|
|
21
|
-
setCellsLayer, rasterLayers, imageLayerLoaders, imageLayerMeta, imageLayerCallbacks, setImageLayerCallbacks, areLoadingImageChannels, setAreLoadingImageChannels, handleRasterLayerChange, handleRasterLayerRemove, obsSegmentationsType, segmentationLayerLoaders, segmentationLayerMeta, segmentationLayerCallbacks, setSegmentationLayerCallbacks, areLoadingSegmentationChannels, setAreLoadingSegmentationChannels, handleSegmentationLayerChange, handleSegmentationLayerRemove, disable3d, globalDisable3d, disableChannelsIfRgbDetected, layerIs3DIndex, setZoom, setTargetX, setTargetY, setTargetZ, setRotationX, setRotationOrbit, componentHeight, componentWidth, spatialLayout, handleImageAdd, enableLayerButtonsWithOneLayer, helpText, } = props;
|
|
21
|
+
setCellsLayer, rasterLayers, imageLayerLoaders, imageLayerMeta, imageLayerCallbacks, setImageLayerCallbacks, areLoadingImageChannels, setAreLoadingImageChannels, handleRasterLayerChange, handleRasterLayerRemove, photometricInterpretation, obsSegmentationsType, segmentationLayerLoaders, segmentationLayerMeta, segmentationLayerCallbacks, setSegmentationLayerCallbacks, areLoadingSegmentationChannels, setAreLoadingSegmentationChannels, handleSegmentationLayerChange, handleSegmentationLayerRemove, disable3d, globalDisable3d, disableChannelsIfRgbDetected, layerIs3DIndex, setZoom, setTargetX, setTargetY, setTargetZ, setRotationX, setRotationOrbit, componentHeight, componentWidth, spatialLayout, handleImageAdd, enableLayerButtonsWithOneLayer, helpText, } = props;
|
|
22
22
|
const shouldShowImageLayerButton = Boolean(enableLayerButtonsWithOneLayer || imageLayerLoaders?.length > 1);
|
|
23
23
|
return (_jsx(TitleInfo, { title: title, isScroll: true, closeButtonVisible: closeButtonVisible, downloadButtonVisible: downloadButtonVisible, removeGridComponent: removeGridComponent, theme: theme, isReady: isReady, helpText: helpText, children: _jsxs("div", { className: "layer-controller-container", ref: ref, children: [moleculesLayer && (_jsx(VectorLayerController, { label: "Molecules", layerType: "molecules", layer: moleculesLayer, handleLayerChange: setMoleculesLayer }, `${dataset}-molecules`)), cellsLayer && obsSegmentationsType === 'polygon' && (_jsx(VectorLayerController, { label: `${capitalize(obsType)} Segmentations`, layerType: "cells", layer: cellsLayer, handleLayerChange: setCellsLayer }, `${dataset}-cells`)), cellsLayer && obsSegmentationsType === 'bitmask'
|
|
24
24
|
&& cellsLayer.map((layer, i) => {
|
|
@@ -45,7 +45,7 @@ const LayerControllerMemoized = React.memo(forwardRef((props, ref) => {
|
|
|
45
45
|
};
|
|
46
46
|
return loader && layerMeta ? (_jsx(Grid
|
|
47
47
|
// eslint-disable-next-line react/no-array-index-key
|
|
48
|
-
, {
|
|
48
|
+
, { sx: { marginTop: '10px' }, children: _jsx(LayerController, { name: layerMeta.name, layer: layer, loader: loader, theme: theme, handleLayerChange: v => handleSegmentationLayerChange(v, i), handleLayerRemove: () => handleSegmentationLayerRemove(i), ChannelController: BitmaskChannelController, shouldShowTransparentColor: isRaster, shouldShowDomain: isRaster, shouldShowColormap: isRaster,
|
|
49
49
|
// Disable 3D if given explicit instructions to do so
|
|
50
50
|
// or if another layer is using 3D mode.
|
|
51
51
|
disable3d: globalDisable3d
|
|
@@ -88,7 +88,7 @@ const LayerControllerMemoized = React.memo(forwardRef((props, ref) => {
|
|
|
88
88
|
};
|
|
89
89
|
return loader && layerMeta ? (_jsx(Grid
|
|
90
90
|
// eslint-disable-next-line react/no-array-index-key
|
|
91
|
-
, {
|
|
91
|
+
, { sx: { marginTop: '10px' }, children: _jsx(LayerController, { name: layerMeta.name, layer: layer, loader: loader, theme: theme, handleLayerChange: v => handleRasterLayerChange(v, i), handleLayerRemove: () => handleRasterLayerRemove(i), ChannelController: RasterChannelController, shouldShowTransparentColor: isRaster, shouldShowDomain: isRaster, shouldShowColormap: isRaster,
|
|
92
92
|
// Disable 3D if given explicit instructions to do so
|
|
93
93
|
// or if another layer is using 3D mode.
|
|
94
94
|
disable3d: globalDisable3d
|
|
@@ -97,7 +97,7 @@ const LayerControllerMemoized = React.memo(forwardRef((props, ref) => {
|
|
|
97
97
|
&& layerIs3DIndex !== -1
|
|
98
98
|
&& layerIs3DIndex !== i), disabled: typeof layerIs3DIndex === 'number'
|
|
99
99
|
&& layerIs3DIndex !== -1
|
|
100
|
-
&& layerIs3DIndex !== i, disableChannelsIfRgbDetected: disableChannelsIfRgbDetected, imageLayerCallbacks: imageLayerCallbacks, setImageLayerCallback: setImageLayerCallback, setViewState: ({ zoom: newZoom, target, rotationX: newRotationX, rotationOrbit: newRotationOrbit, }) => {
|
|
100
|
+
&& layerIs3DIndex !== i, disableChannelsIfRgbDetected: disableChannelsIfRgbDetected, photometricInterpretation: photometricInterpretation, imageLayerCallbacks: imageLayerCallbacks, setImageLayerCallback: setImageLayerCallback, setViewState: ({ zoom: newZoom, target, rotationX: newRotationX, rotationOrbit: newRotationOrbit, }) => {
|
|
101
101
|
setZoom(newZoom);
|
|
102
102
|
setTargetX(target[0]);
|
|
103
103
|
setTargetY(target[1]);
|
|
@@ -106,7 +106,7 @@ const LayerControllerMemoized = React.memo(forwardRef((props, ref) => {
|
|
|
106
106
|
setRotationOrbit(newRotationOrbit);
|
|
107
107
|
}, setAreLayerChannelsLoading: setAreLayerChannelsLoading, areLayerChannelsLoading: areLayerChannelsLoading, spatialHeight: (componentHeight * (spatialLayout ? spatialLayout.h : 1)) / 12, spatialWidth: (componentWidth * (spatialLayout ? spatialLayout.w : 1)) / 12, shouldShowRemoveLayerButton: shouldShowImageLayerButton }) }, `${dataset}-raster-${index}-${i}`)) : null;
|
|
108
108
|
}), shouldShowImageLayerButton
|
|
109
|
-
? (_jsx(Grid, {
|
|
109
|
+
? (_jsx(Grid, { children: _jsx(ImageAddButton, { imageOptions: imageLayerMeta, handleImageAdd: handleImageAdd }) })) : null] }) }));
|
|
110
110
|
}));
|
|
111
111
|
/**
|
|
112
112
|
* A subscriber component for the spatial layer controller.
|
|
@@ -128,7 +128,7 @@ export function LayerControllerSubscriber(props) {
|
|
|
128
128
|
const { coordinationScopes, closeButtonVisible, downloadButtonVisible, removeGridComponent, theme, title = 'Spatial Layers', disable3d, globalDisable3d, disableChannelsIfRgbDetected, enableLayerButtonsWithOneLayer, helpText = ViewHelpMapping.LAYER_CONTROLLER, } = props;
|
|
129
129
|
const loaders = useLoaders();
|
|
130
130
|
// Get "props" from the coordination space.
|
|
131
|
-
const [{ dataset, obsType, spatialImageLayer: rasterLayers, spatialSegmentationLayer: cellsLayer, spatialPointLayer: moleculesLayer, }, { setSpatialImageLayer: setRasterLayers, setSpatialSegmentationLayer: setCellsLayer, setSpatialPointLayer: setMoleculesLayer, setSpatialTargetX: setTargetX, setSpatialTargetY: setTargetY, setSpatialTargetZ: setTargetZ, setSpatialRotationX: setRotationX, setSpatialRotationOrbit: setRotationOrbit, setSpatialZoom: setZoom, },] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType.LAYER_CONTROLLER], coordinationScopes);
|
|
131
|
+
const [{ dataset, obsType, spatialImageLayer: rasterLayers, spatialSegmentationLayer: cellsLayer, spatialPointLayer: moleculesLayer, photometricInterpretation: photometricInterpretationFromCoordination, }, { setSpatialImageLayer: setRasterLayers, setSpatialSegmentationLayer: setCellsLayer, setSpatialPointLayer: setMoleculesLayer, setSpatialTargetX: setTargetX, setSpatialTargetY: setTargetY, setSpatialTargetZ: setTargetZ, setSpatialRotationX: setRotationX, setSpatialRotationOrbit: setRotationOrbit, setSpatialZoom: setZoom, },] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType.LAYER_CONTROLLER], coordinationScopes);
|
|
132
132
|
const [{ imageLayerCallbacks, areLoadingImageChannels, segmentationLayerCallbacks, areLoadingSegmentationChannels, }, { setImageLayerCallbacks, setAreLoadingImageChannels, setSegmentationLayerCallbacks, setAreLoadingSegmentationChannels, },] = useAuxiliaryCoordination(COMPONENT_COORDINATION_TYPES.layerController, coordinationScopes);
|
|
133
133
|
// Spatial layout + window size is needed for the "re-center" button to work properly.
|
|
134
134
|
// Dimensions of the Spatial component can be inferred and used for resetting view state to
|
|
@@ -142,12 +142,14 @@ export function LayerControllerSubscriber(props) {
|
|
|
142
142
|
const [obsLocationsData, obsLocationsStatus] = useObsLocationsData(loaders, dataset, false, { setSpatialPointLayer: setMoleculesLayer }, { spatialPointLayer: moleculesLayer }, {});
|
|
143
143
|
const [{ obsSegmentations, obsSegmentationsType }, obsSegmentationsStatus,] = useObsSegmentationsData(loaders, dataset, false, { setSpatialSegmentationLayer: setCellsLayer }, { spatialSegmentationLayer: cellsLayer }, {});
|
|
144
144
|
const [{ image }, imageStatus] = useImageData(loaders, dataset, false, { setSpatialImageLayer: setRasterLayers }, { spatialImageLayer: rasterLayers }, {});
|
|
145
|
-
const { loaders: imageLayerLoaders, meta: imageLayerMeta } = image || {};
|
|
145
|
+
const { loaders: imageLayerLoaders, meta: imageLayerMeta, instance } = image || {};
|
|
146
146
|
const isReady = useReady([
|
|
147
147
|
obsLocationsStatus,
|
|
148
148
|
obsSegmentationsStatus,
|
|
149
149
|
imageStatus,
|
|
150
150
|
]);
|
|
151
|
+
const photometricInterpretation = (photometricInterpretationFromCoordination
|
|
152
|
+
?? instance?.getPhotometricInterpretation());
|
|
151
153
|
const segmentationLayerLoaders = obsSegmentations && obsSegmentationsType === 'bitmask' ? obsSegmentations.loaders : null;
|
|
152
154
|
const segmentationLayerMeta = obsSegmentations && obsSegmentationsType === 'bitmask' ? obsSegmentations.meta : null;
|
|
153
155
|
// useCallback prevents new functions from propogating
|
|
@@ -188,7 +190,7 @@ export function LayerControllerSubscriber(props) {
|
|
|
188
190
|
setCellsLayer(newLayers);
|
|
189
191
|
}, [cellsLayer, setCellsLayer]);
|
|
190
192
|
const layerIs3DIndex = rasterLayers?.findIndex && rasterLayers.findIndex(layer => layer.use3d);
|
|
191
|
-
return (_jsx(LayerControllerMemoized, { ref: layerControllerRef, title: title, closeButtonVisible: closeButtonVisible, downloadButtonVisible: downloadButtonVisible, removeGridComponent: removeGridComponent, theme: theme, isReady: isReady, moleculesLayer: moleculesLayer, dataset: dataset, obsType: obsType, setMoleculesLayer: setMoleculesLayer, cellsLayer: cellsLayer, setCellsLayer: setCellsLayer, helpText: helpText, rasterLayers: rasterLayers, imageLayerLoaders: imageLayerLoaders, imageLayerMeta: imageLayerMeta, imageLayerCallbacks: imageLayerCallbacks, setImageLayerCallbacks: setImageLayerCallbacks, areLoadingImageChannels: areLoadingImageChannels, setAreLoadingImageChannels: setAreLoadingImageChannels, handleRasterLayerChange: handleRasterLayerChange, handleRasterLayerRemove: handleRasterLayerRemove, obsSegmentationsType: obsSegmentationsType, segmentationLayerLoaders: segmentationLayerLoaders, segmentationLayerMeta: segmentationLayerMeta, segmentationLayerCallbacks: segmentationLayerCallbacks, setSegmentationLayerCallbacks: setSegmentationLayerCallbacks, areLoadingSegmentationChannels: areLoadingSegmentationChannels, setAreLoadingSegmentationChannels: setAreLoadingSegmentationChannels, handleSegmentationLayerChange: handleSegmentationLayerChange, handleSegmentationLayerRemove: handleSegmentationLayerRemove, disable3d: disable3d, globalDisable3d: globalDisable3d, layerIs3DIndex: layerIs3DIndex, disableChannelsIfRgbDetected: disableChannelsIfRgbDetected, enableLayerButtonsWithOneLayer: enableLayerButtonsWithOneLayer, setZoom: setZoom, setTargetX: setTargetX, setTargetY: setTargetY, setTargetZ: setTargetZ, setRotationX: setRotationX, setRotationOrbit: setRotationOrbit,
|
|
193
|
+
return (_jsx(LayerControllerMemoized, { ref: layerControllerRef, title: title, closeButtonVisible: closeButtonVisible, downloadButtonVisible: downloadButtonVisible, removeGridComponent: removeGridComponent, theme: theme, isReady: isReady, moleculesLayer: moleculesLayer, dataset: dataset, obsType: obsType, setMoleculesLayer: setMoleculesLayer, cellsLayer: cellsLayer, setCellsLayer: setCellsLayer, helpText: helpText, rasterLayers: rasterLayers, imageLayerLoaders: imageLayerLoaders, imageLayerMeta: imageLayerMeta, imageLayerCallbacks: imageLayerCallbacks, setImageLayerCallbacks: setImageLayerCallbacks, areLoadingImageChannels: areLoadingImageChannels, setAreLoadingImageChannels: setAreLoadingImageChannels, handleRasterLayerChange: handleRasterLayerChange, handleRasterLayerRemove: handleRasterLayerRemove, photometricInterpretation: photometricInterpretation, obsSegmentationsType: obsSegmentationsType, segmentationLayerLoaders: segmentationLayerLoaders, segmentationLayerMeta: segmentationLayerMeta, segmentationLayerCallbacks: segmentationLayerCallbacks, setSegmentationLayerCallbacks: setSegmentationLayerCallbacks, areLoadingSegmentationChannels: areLoadingSegmentationChannels, setAreLoadingSegmentationChannels: setAreLoadingSegmentationChannels, handleSegmentationLayerChange: handleSegmentationLayerChange, handleSegmentationLayerRemove: handleSegmentationLayerRemove, disable3d: disable3d, globalDisable3d: globalDisable3d, layerIs3DIndex: layerIs3DIndex, disableChannelsIfRgbDetected: disableChannelsIfRgbDetected, enableLayerButtonsWithOneLayer: enableLayerButtonsWithOneLayer, setZoom: setZoom, setTargetX: setTargetX, setTargetY: setTargetY, setTargetZ: setTargetZ, setRotationX: setRotationX, setRotationOrbit: setRotationOrbit,
|
|
192
194
|
// Fall back to window for height and width.
|
|
193
195
|
componentHeight: componentHeight || windowHeight, componentWidth: componentWidth || windowWidth, spatialLayout: spatialLayout, handleImageAdd: handleImageAdd }));
|
|
194
196
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LayerOptions.d.ts","sourceRoot":"","sources":["../src/LayerOptions.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"LayerOptions.d.ts","sourceRoot":"","sources":["../src/LayerOptions.js"],"names":[],"mappings":";AA4UA;;;;;;;;;;;;;GAaG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAyIC"}
|
package/dist-tsc/LayerOptions.js
CHANGED
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { useId } from 'react-aria';
|
|
4
4
|
import { range } from 'lodash-es';
|
|
5
5
|
import { Matrix4 } from 'math.gl';
|
|
6
|
-
import { Grid, Slider, InputLabel,
|
|
6
|
+
import { Grid, Slider, InputLabel, NativeSelect, Checkbox } from '@vitessce/styles';
|
|
7
7
|
import { viv } from '@vitessce/gl';
|
|
8
8
|
import { getBoundingCube, getMultiSelectionStats, DEFAULT_RASTER_DOMAIN_TYPE, canLoadResolution, getStatsForResolution, } from '@vitessce/spatial-utils';
|
|
9
9
|
import { COLORMAP_OPTIONS, formatBytes, } from '@vitessce/utils';
|
|
@@ -25,7 +25,7 @@ const DOMAIN_OPTIONS = ['Full', 'Min/Max'];
|
|
|
25
25
|
* @prop {boolean} use3d Whether or not 3D is enabled for this layer.
|
|
26
26
|
*/
|
|
27
27
|
function VolumeDropdown({ loader: loaderWithMeta, handleMultiPropertyChange, resolution: currResolution, disable3d, setRasterLayerCallback, setAreAllChannelsLoading, setViewState, spatialHeight, spatialWidth, channels, use3d, modelMatrix, }) {
|
|
28
|
-
const classes = useSelectStyles();
|
|
28
|
+
const { classes } = useSelectStyles();
|
|
29
29
|
const selections = channels.map(i => i.selection);
|
|
30
30
|
const { data: loader } = loaderWithMeta;
|
|
31
31
|
const handleChange = async (val) => {
|
|
@@ -94,7 +94,7 @@ function VolumeDropdown({ loader: loaderWithMeta, handleMultiPropertyChange, res
|
|
|
94
94
|
};
|
|
95
95
|
const { labels, shape } = Array.isArray(loader) ? loader[0] : loader;
|
|
96
96
|
const hasZStack = shape[labels.indexOf('z')] > 1;
|
|
97
|
-
return (_jsx(_Fragment, { children: _jsxs(
|
|
97
|
+
return (_jsx(_Fragment, { children: _jsxs(NativeSelect, { value: currResolution, onChange: e => handleChange(e.target.value === '2D' ? e.target.value : Number(e.target.value)), inputProps: { 'aria-label': 'Resolution selector' }, classes: { root: classes.selectRoot }, children: [_jsx("option", { value: "2D", children: "2D Visualization" }, "2D"), Array.from({ length: loader.length })
|
|
98
98
|
.fill(0)
|
|
99
99
|
// eslint-disable-next-line no-unused-vars
|
|
100
100
|
.map((_, resolution) => {
|
|
@@ -115,8 +115,8 @@ function VolumeDropdown({ loader: loaderWithMeta, handleMultiPropertyChange, res
|
|
|
115
115
|
* @prop {function} handleChange Callback for every change in colormap.
|
|
116
116
|
*/
|
|
117
117
|
function ColormapSelect({ value, inputId, handleChange }) {
|
|
118
|
-
const classes = useSelectStyles();
|
|
119
|
-
return (_jsxs(
|
|
118
|
+
const { classes } = useSelectStyles();
|
|
119
|
+
return (_jsxs(NativeSelect, { onChange: e => handleChange(e.target.value === '' ? null : e.target.value), value: value, inputProps: { name: 'colormap', id: inputId, 'aria-label': 'Colormap selector' }, style: { width: '100%' }, classes: { root: classes.selectRoot }, children: [_jsx("option", { "aria-label": "None", value: "", children: "None" }), COLORMAP_OPTIONS.map(name => (_jsx("option", { value: name, children: name }, name)))] }));
|
|
120
120
|
}
|
|
121
121
|
function TransparentColorCheckbox({ value, inputId, handleChange }) {
|
|
122
122
|
return (_jsx(Checkbox, { style: { float: 'left', padding: 0 }, color: "default", onChange: () => {
|
|
@@ -126,7 +126,7 @@ function TransparentColorCheckbox({ value, inputId, handleChange }) {
|
|
|
126
126
|
else {
|
|
127
127
|
handleChange([0, 0, 0]);
|
|
128
128
|
}
|
|
129
|
-
}, checked: Boolean(value), id: inputId,
|
|
129
|
+
}, checked: Boolean(value), id: inputId, slotProps: { input: { 'aria-label': 'Enable or disable color transparency' } } }));
|
|
130
130
|
}
|
|
131
131
|
/**
|
|
132
132
|
* Wrapper for the slider that updates opacity.
|
|
@@ -134,8 +134,8 @@ function TransparentColorCheckbox({ value, inputId, handleChange }) {
|
|
|
134
134
|
* @prop {function} handleChange Callback for every change in opacity.
|
|
135
135
|
*/
|
|
136
136
|
function OpacitySlider({ value, inputId, handleChange }) {
|
|
137
|
-
const classes = useChannelSliderStyles();
|
|
138
|
-
return (_jsx(Slider, {
|
|
137
|
+
const { classes } = useChannelSliderStyles();
|
|
138
|
+
return (_jsx(Slider, { slotProps: { valueLabel: { className: classes.sliderValueLabel } }, value: value, onChange: (e, v) => handleChange(v), valueLabelDisplay: "auto", "aria-label": "Layer opacity slider", id: inputId, min: 0, max: 1, step: 0.01, orientation: "horizontal" }));
|
|
139
139
|
}
|
|
140
140
|
/**
|
|
141
141
|
* Wrapper for the dropdown that chooses the domain type.
|
|
@@ -144,8 +144,8 @@ function OpacitySlider({ value, inputId, handleChange }) {
|
|
|
144
144
|
* @prop {function} handleChange Callback for every change in domain.
|
|
145
145
|
*/
|
|
146
146
|
function SliderDomainSelector({ value, inputId, handleChange }) {
|
|
147
|
-
const classes = useSelectStyles();
|
|
148
|
-
return (_jsx(
|
|
147
|
+
const { classes } = useSelectStyles();
|
|
148
|
+
return (_jsx(NativeSelect, { onChange: e => handleChange(e.target.value), value: value, id: inputId, inputProps: { name: 'domain-selector', 'aria-label': 'Domain type selector' }, style: { width: '100%' }, classes: { root: classes.selectRoot }, children: DOMAIN_OPTIONS.map(name => (_jsx("option", { value: name, children: name }, name))) }));
|
|
149
149
|
}
|
|
150
150
|
/**
|
|
151
151
|
* Wrapper for the slider that chooses global selections (z, t etc.).
|
|
@@ -155,7 +155,7 @@ function SliderDomainSelector({ value, inputId, handleChange }) {
|
|
|
155
155
|
* @prop {function} possibleValues All available values for the field.
|
|
156
156
|
*/
|
|
157
157
|
function GlobalSelectionSlider({ field, value, inputId, handleChange, possibleValues, }) {
|
|
158
|
-
const classes = useSelectionSliderStyles();
|
|
158
|
+
const { classes } = useSelectionSliderStyles();
|
|
159
159
|
return (_jsx(Slider, { classes: { root: classes.selectionSliderRoot, markActive: classes.markActive }, value: value,
|
|
160
160
|
// See https://github.com/hms-dbmi/viv/issues/176 for why
|
|
161
161
|
// we have the two handlers.
|
|
@@ -173,7 +173,7 @@ function GlobalSelectionSlider({ field, value, inputId, handleChange, possibleVa
|
|
|
173
173
|
* @prop {object} children Components to be rendered next to the name (slider, dropdown etc.).
|
|
174
174
|
*/
|
|
175
175
|
function LayerOption({ name, inputId, children }) {
|
|
176
|
-
return (_jsxs(Grid, { container: true, direction: "row", alignItems: "center", justifyContent: "center", children: [_jsx(Grid, {
|
|
176
|
+
return (_jsxs(Grid, { container: true, direction: "row", alignItems: "center", justifyContent: "center", children: [_jsx(Grid, { size: 6, children: _jsxs(InputLabel, { htmlFor: inputId, children: [name, ":"] }) }), _jsx(Grid, { size: 6, children: children })] }));
|
|
177
177
|
}
|
|
178
178
|
/**
|
|
179
179
|
* Gloabl options for all channels (opacity, colormap, etc.).
|
|
@@ -202,13 +202,13 @@ function LayerOptions({ colormap, opacity, handleColormapChange, handleOpacityCh
|
|
|
202
202
|
const domainSelectorId = useId();
|
|
203
203
|
const opacitySliderId = useId();
|
|
204
204
|
const zeroTransparentId = useId();
|
|
205
|
-
return (_jsxs(Grid, { container: true, direction: "column",
|
|
205
|
+
return (_jsxs(Grid, { container: true, direction: "column", sx: { width: '100%' }, children: [hasZStack
|
|
206
206
|
&& !disable3d
|
|
207
207
|
&& hasViewableResolutions
|
|
208
208
|
&& (_jsx(VolumeDropdown, { loader: loader, handleSliderChange: handleSliderChange, handleDomainChange: handleDomainChange, channels: channels, handleMultiPropertyChange: handleMultiPropertyChange, resolution: resolution, disable3d: disable3d, setRasterLayerCallback: setRasterLayerCallback, setAreAllChannelsLoading: setAreAllChannelsLoading, setViewState: setViewState, spatialHeight: spatialHeight, spatialWidth: spatialWidth, use3d: use3d, modelMatrix: modelMatrix })), hasDimensionsAndChannels
|
|
209
209
|
&& !use3d
|
|
210
|
-
&& globalControlLabels.map(field => shape[labels.indexOf(field)] > 1 && (_jsx(LayerOption, { name: field, inputId: `${field}-${globalSelectionSliderId}`, children: _jsx(GlobalSelectionSlider, { field: field, inputId: `${field}-${globalSelectionSliderId}`, value: globalLabelValues[field], handleChange: handleGlobalChannelsSelectionChange, possibleValues: range(shape[labels.indexOf(field)]) }) }, field))), !disableChannelsIfRgbDetected ? (_jsxs(_Fragment, { children: [shouldShowColormap && (_jsx(Grid, {
|
|
210
|
+
&& globalControlLabels.map(field => shape[labels.indexOf(field)] > 1 && (_jsx(LayerOption, { name: field, inputId: `${field}-${globalSelectionSliderId}`, children: _jsx(GlobalSelectionSlider, { field: field, inputId: `${field}-${globalSelectionSliderId}`, value: globalLabelValues[field], handleChange: handleGlobalChannelsSelectionChange, possibleValues: range(shape[labels.indexOf(field)]) }) }, field))), !disableChannelsIfRgbDetected ? (_jsxs(_Fragment, { children: [shouldShowColormap && (_jsx(Grid, { children: _jsx(LayerOption, { name: "Colormap", inputId: colormapSelectId, children: _jsx(ColormapSelect, { value: colormap || '', inputId: colormapSelectId, handleChange: handleColormapChange }) }) })), shouldShowDomain && (_jsx(Grid, { children: _jsx(LayerOption, { name: "Domain", inputId: domainSelectorId, children: _jsx(SliderDomainSelector, { value: domainType || DEFAULT_RASTER_DOMAIN_TYPE, inputId: domainSelectorId, handleChange: (value) => {
|
|
211
211
|
handleDomainChange(value);
|
|
212
|
-
} }) }) }))] })) : null, !use3d && (_jsx(Grid, {
|
|
212
|
+
} }) }) }))] })) : null, !use3d && (_jsx(Grid, { children: _jsx(LayerOption, { name: "Opacity", inputId: opacitySliderId, children: _jsx(OpacitySlider, { value: opacity, handleChange: handleOpacityChange, inputId: opacitySliderId }) }) })), shouldShowTransparentColor && !use3d && (_jsx(Grid, { children: _jsx(LayerOption, { name: "Zero Transparent", inputId: zeroTransparentId, children: _jsx(TransparentColorCheckbox, { value: transparentColor, handleChange: handleTransparentColorChange, inputId: zeroTransparentId }) }) }))] }));
|
|
213
213
|
}
|
|
214
214
|
export default LayerOptions;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React, { useCallback, useState, useEffect } from 'react';
|
|
3
|
-
import { Grid, Slider } from '@
|
|
3
|
+
import { Grid, Slider } from '@vitessce/styles';
|
|
4
4
|
import { debounce, isEqual } from 'lodash-es';
|
|
5
5
|
import { getSourceFromLoader, getMultiSelectionStats, toRgbUIString, abbreviateNumber, DOMAINS, } from '@vitessce/spatial-utils';
|
|
6
6
|
import ChannelOptions from './ChannelOptions.js';
|
|
@@ -23,9 +23,9 @@ function ChannelSlider({ color, slider = [0, 0], handleChange, domain = [0, 0],
|
|
|
23
23
|
sliderCopy[1] = max;
|
|
24
24
|
}
|
|
25
25
|
const handleChangeDebounced = useCallback(debounce(handleChange, 3, { trailing: true }), [handleChange]);
|
|
26
|
-
const classes = useChannelSliderStyles();
|
|
26
|
+
const { classes } = useChannelSliderStyles();
|
|
27
27
|
const step = max - min < 500 && dtype.startsWith('Float') ? (max - min) / 500 : 1;
|
|
28
|
-
return (_jsx(Slider, {
|
|
28
|
+
return (_jsx(Slider, { slotProps: { valueLabel: { className: classes.valueLabel } }, value: slider, valueLabelFormat: abbreviateNumber, onChange: (e, v) => handleChangeDebounced(v), valueLabelDisplay: "auto", getAriaLabel: (index) => {
|
|
29
29
|
const labelPrefix = index === 0 ? 'Low value slider' : 'High value slider';
|
|
30
30
|
return `${labelPrefix} for ${color} colormap channel`;
|
|
31
31
|
}, getAriaValueText: () => `Current colormap values: ${color}-${slider}`, min: min, max: max, step: step, orientation: "horizontal", style: { color, marginTop: '7px' }, disabled: disabled }));
|
|
@@ -126,6 +126,6 @@ function RasterChannelController({ visibility = false, slider, color, channels,
|
|
|
126
126
|
* e.g { channel: 2 } // channel dimension, third channel
|
|
127
127
|
*/
|
|
128
128
|
const createSelection = index => ({ [dimName]: index });
|
|
129
|
-
return (_jsxs(Grid, { container: true, direction: "column",
|
|
129
|
+
return (_jsxs(Grid, { container: true, direction: "column", justifyContent: "center", children: [_jsxs(Grid, { container: true, direction: "row", justifyContent: "space-between", children: [_jsx(Grid, { size: 10, children: _jsx(ChannelSelectionDropdown, { handleChange: v => handlePropertyChange('selection', createSelection(v)), selectionIndex: selectionIndex, channelOptions: channelOptions, disabled: isLoading }) }), _jsx(Grid, { size: 1, sx: { marginTop: '4px' }, children: _jsx(ChannelOptions, { handlePropertyChange: handlePropertyChange, handleChannelRemove: handleChannelRemove, handleIQRUpdate: handleIQRUpdate, disabled: isLoading }) })] }), _jsxs(Grid, { container: true, direction: "row", justifyContent: "space-between", children: [_jsx(Grid, { size: 2, children: _jsx(ChannelVisibilityCheckbox, { color: rgbColor, checked: visibility, toggle: () => handlePropertyChange('visible', !visibility), disabled: isLoading }) }), _jsx(Grid, { size: 9, children: _jsx(ChannelSlider, { color: rgbColor, slider: slider, domain: domain || DOMAINS[dtype], dtype: dtype, handleChange: v => handlePropertyChange('slider', v), disabled: isLoading }) })] })] }));
|
|
130
130
|
}
|
|
131
131
|
export default RasterChannelController;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { Grid, Checkbox, Paper, Typography, Slider } from '@
|
|
3
|
+
import { Grid, Checkbox, Paper, Typography, Slider } from '@vitessce/styles';
|
|
4
4
|
import { useControllerSectionStyles } from './styles.js';
|
|
5
5
|
export default function VectorLayerController(props) {
|
|
6
6
|
const { label, layer, layerType, handleLayerChange, } = props;
|
|
@@ -18,11 +18,11 @@ export default function VectorLayerController(props) {
|
|
|
18
18
|
function handleCheckBoxChange(v) {
|
|
19
19
|
handleLayerChange({ ...layer, visible: v });
|
|
20
20
|
}
|
|
21
|
-
const classes = useControllerSectionStyles();
|
|
22
|
-
return (_jsx(Grid, {
|
|
21
|
+
const { classes } = useControllerSectionStyles();
|
|
22
|
+
return (_jsx(Grid, { sx: { marginTop: '10px' }, children: _jsxs(Paper, { elevation: 4, className: classes.layerControllerRoot, children: [_jsx(Typography, { style: {
|
|
23
23
|
padding: '15px 8px 0px 8px',
|
|
24
24
|
marginBottom: '-5px',
|
|
25
|
-
}, children: label }), _jsxs(Grid, { container: true, direction: "row", justifyContent: "space-between", children: [_jsx(Grid, {
|
|
25
|
+
}, children: label }), _jsxs(Grid, { container: true, direction: "row", justifyContent: "space-between", children: [_jsx(Grid, { size: 2, children: _jsx(Checkbox, { color: "primary", checked: isOn, onChange: (e, v) => handleCheckBoxChange(v), slotProps: { input: { 'aria-label': 'Show or hide vector layer' } } }) }), _jsx(Grid, { size: 9, sx: { paddingRight: '16px' }, children: _jsx(Slider, { value: slider, min: 0, max: 1, step: 0.001, onChange: (e, v) => handleSliderChange(v), style: { marginTop: '7px' }, orientation: "horizontal", getAriaLabel: (index) => {
|
|
26
26
|
const labelPrefix = index === 0 ? 'Low value slider' : 'High value slider';
|
|
27
27
|
return `${labelPrefix} for ${label} layer controller`;
|
|
28
28
|
} }) })] })] }) }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VolumeOptions.d.ts","sourceRoot":"","sources":["../src/VolumeOptions.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"VolumeOptions.d.ts","sourceRoot":"","sources":["../src/VolumeOptions.js"],"names":[],"mappings":";AAqLA;;;;;;;;;;;;;gBAqCC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Matrix4 } from 'math.gl';
|
|
4
|
-
import { Grid, Typography, Button, makeStyles,
|
|
4
|
+
import { Grid, Typography, Button, makeStyles, FormControl, NativeSelect, InputLabel, Slider, } from '@vitessce/styles';
|
|
5
5
|
import { viv } from '@vitessce/gl';
|
|
6
6
|
import { abbreviateNumber, getBoundingCube } from '@vitessce/spatial-utils';
|
|
7
7
|
import { useSelectStyles } from './styles.js';
|
|
8
|
-
const useSlicerStyles = makeStyles(theme =>
|
|
8
|
+
const useSlicerStyles = makeStyles()(theme => ({
|
|
9
9
|
enabled: {},
|
|
10
10
|
disabled: {
|
|
11
11
|
color: theme.palette.text.disabled,
|
|
@@ -42,22 +42,22 @@ const Slicer = ({ xSlice, ySlice, zSlice, handleSlicerSetting, loader, use3d, })
|
|
|
42
42
|
zSliceInit,
|
|
43
43
|
],
|
|
44
44
|
];
|
|
45
|
-
const classes = useSlicerStyles();
|
|
46
|
-
const Slicers = sliceValuesAndSetSliceFunctions.map(([val, setVal, label, [min, max]]) => (_jsxs(Grid, { container: true, direction: "row", justifyContent: "flex-start", alignItems: "center", children: [_jsx(Grid, {
|
|
45
|
+
const { classes } = useSlicerStyles();
|
|
46
|
+
const Slicers = sliceValuesAndSetSliceFunctions.map(([val, setVal, label, [min, max]]) => (_jsxs(Grid, { container: true, direction: "row", justifyContent: "flex-start", alignItems: "center", children: [_jsx(Grid, { size: 1, children: _jsxs(Typography, { className: !use3d ? classes.disabled : classes.enabled, style: { marginBottom: 0 }, children: [label, ":"] }) }), _jsx(Grid, { size: 11, children: _jsx(Slider, { disabled: !use3d, className: !use3d ? classes.disabled : classes.enabled, value: val, onChange: (e, v) => setVal(v), valueLabelDisplay: "auto", valueLabelFormat: v => abbreviateNumber(v), getAriaLabel: index => `Clipping plane ${label} slider ${index === 0 ? 'min' : 'max'}`, min: min, max: max, step: 0.005, orientation: "horizontal" }) })] }, label)));
|
|
47
47
|
return (_jsxs(_Fragment, { children: [_jsxs(Typography, { className: !use3d ? classes.disabled : classes.enabled, style: { marginTop: 16, marginBottom: 0 }, children: ["Clipping Planes:", ' '] }), ' ', Slicers] }));
|
|
48
48
|
};
|
|
49
49
|
const renderingOptions = Object.values(viv.RENDERING_MODES);
|
|
50
50
|
function RenderingModeSelect({ handleRenderingModeChange, renderingMode, use3d, }) {
|
|
51
|
-
const classes = useSelectStyles();
|
|
51
|
+
const { classes } = useSelectStyles();
|
|
52
52
|
// Empty option allows for displaying the title of the dropdown fully in the UI.
|
|
53
53
|
const options = !use3d ? [...renderingOptions, ''] : renderingOptions;
|
|
54
|
-
return (_jsxs(FormControl, { fullWidth: true, children: [_jsx(InputLabel, { htmlFor: "rendering-mode-select", children: "Rendering Mode" }), _jsx(
|
|
54
|
+
return (_jsxs(FormControl, { fullWidth: true, children: [_jsx(InputLabel, { htmlFor: "rendering-mode-select", variant: "standard", children: "Rendering Mode" }), _jsx(NativeSelect, { onChange: e => handleRenderingModeChange(e.target.value), value: use3d ? renderingMode : '', inputProps: {
|
|
55
55
|
name: 'rendering-mode',
|
|
56
56
|
id: 'rendering-mode-select',
|
|
57
57
|
'aria-label': 'Select rendering mode option',
|
|
58
58
|
}, disabled: !use3d, classes: { root: classes.selectRoot }, children: options.map(name => (_jsx("option", { value: name, children: name }, name))) })] }));
|
|
59
59
|
}
|
|
60
|
-
const ReCenterButton = ({ setViewState, use3d, spatialHeight, spatialWidth, loader, modelMatrix, }) => (_jsx(Grid, {
|
|
60
|
+
const ReCenterButton = ({ setViewState, use3d, spatialHeight, spatialWidth, loader, modelMatrix, }) => (_jsx(Grid, { size: "auto", children: _jsx(Button, { onClick: () => {
|
|
61
61
|
const defaultViewState = viv.getDefaultInitialViewState(loader.data, { height: spatialHeight, width: spatialWidth }, 1.5, use3d, new Matrix4(modelMatrix));
|
|
62
62
|
setViewState({
|
|
63
63
|
...defaultViewState,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-channel-controls.d.ts","sourceRoot":"","sources":["../src/shared-channel-controls.js"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH;;;;;
|
|
1
|
+
{"version":3,"file":"shared-channel-controls.d.ts","sourceRoot":"","sources":["../src/shared-channel-controls.js"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH;;;;;gBAqBC;AAED;;;;;;GAMG;AACH;;;;;gBAeC"}
|