• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

vanvalenlab / deepcell-label / 4570310249

pending completion
4570310249

Pull #440

github

GitHub
Merge 706fc4ccc into d83615b3c
Pull Request #440: Instructions

457 of 927 branches covered (49.3%)

Branch coverage included in aggregate %.

39 of 45 new or added lines in 7 files covered. (86.67%)

51 existing lines in 2 files now uncovered.

3223 of 4920 relevant lines covered (65.51%)

599.37 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/frontend/src/Project/EditControls/CellTypeControls/CellTypeUI/CellTypeHovering.js
1
import { Box, Typography, Paper } from '@mui/material';
2
import equal from 'fast-deep-equal';
3
import CircleIcon from '@mui/icons-material/Circle';
4
import { useSelector } from '@xstate/react';
5
import { useCanvas, useCellTypes, useHovering } from '../../../ProjectContext';
6

UNCOV
7
const getCellTypeList = (cell, cellTypes) => {
×
UNCOV
8
  const numCellTypes = cellTypes.length;
×
UNCOV
9
  let types = [];
×
UNCOV
10
  for (let i = 0; i < numCellTypes; i++) {
×
UNCOV
11
    if (cellTypes[i].cells.includes(cell)) {
×
UNCOV
12
      types.push(cellTypes[i]);
×
13
    }
14
  }
UNCOV
15
  return types;
×
16
};
17

18
function CellTypeHovering() {
UNCOV
19
  const cells = useHovering();
×
UNCOV
20
  const cellTypesRef = useCellTypes();
×
UNCOV
21
  const canvas = useCanvas();
×
UNCOV
22
  const cellTypes = useSelector(cellTypesRef, (state) => state.context.cellTypes);
×
UNCOV
23
  const feature = useSelector(cellTypesRef, (state) => state.context.feature);
×
UNCOV
24
  const currentCellTypes = cellTypes.filter((cellType) => cellType.feature === feature);
×
25

UNCOV
26
  const { sx, sy, x, y, width, height, zoom, scale } = useSelector(
×
27
    canvas,
28
    (state) => {
UNCOV
29
      const { sx, sy, x, y, width, height, zoom, scale } = state.context;
×
UNCOV
30
      return { sx, sy, x, y, width, height, zoom, scale };
×
31
    },
32
    equal
33
  );
34

UNCOV
35
  const noCells = !cells || cells.length === 0;
×
36

UNCOV
37
  return (
×
38
    <div
39
      style={{
40
        width: 130,
41
        position: 'relative',
42
        top: (y - sy) * zoom * scale,
43
        left: (x - sx) * zoom * scale,
44
        pointerEvents: 'none',
45
        zIndex: 1500,
46
      }}
47
    >
48
      {noCells || x === 0 || x === width - 1 || y === 0 || y === height - 1 ? null : (
×
49
        <Paper sx={{ wordWrap: 'break-word' }}>
50
          {cells.map((cell) =>
UNCOV
51
            getCellTypeList(cell, currentCellTypes).map((type) => (
×
UNCOV
52
              <Box key={type.id}>
×
53
                <CircleIcon
54
                  sx={{
55
                    fontSize: 10,
56
                    color: type.color,
57
                    display: 'inline-block',
58
                    marginBottom: 0.11,
59
                    marginLeft: 0.5,
60
                    marginRight: 0.75,
61
                  }}
62
                />
63
                <Typography sx={{ fontSize: 11, display: 'inline', position: 'relative', top: -2 }}>
64
                  {type.name} ({cell})
65
                </Typography>
66
                <br />
67
              </Box>
68
            ))
69
          )}
70
        </Paper>
71
      )}
72
    </div>
73
  );
74
}
75

76
export default CellTypeHovering;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc