|
1 | 1 | // @flow weak |
2 | 2 |
|
3 | | -import React, { |
4 | | - Fragment, |
5 | | - useRef, |
6 | | - useState, |
7 | | - useLayoutEffect, |
8 | | - useEffect, |
9 | | -} from "react" |
| 3 | +import React, { useRef, useState, useLayoutEffect } from "react" |
10 | 4 | import type { Node } from "react" |
11 | 5 | import { Matrix } from "transformation-matrix-js" |
12 | | -import getImageData from "get-image-data" |
13 | 6 | import Crosshairs from "../Crosshairs" |
14 | | -import type { |
15 | | - Region, |
16 | | - PixelRegion, |
17 | | - Point, |
18 | | - Polygon, |
19 | | - Box, |
20 | | -} from "./region-tools.js" |
21 | | -import { getEnclosingBox } from "./region-tools.js" |
| 7 | +import type { Region, Point, Polygon, Box } from "./region-tools.js" |
22 | 8 | import { makeStyles } from "@material-ui/core/styles" |
23 | 9 | import styles from "./styles" |
24 | | -import classnames from "classnames" |
25 | | -import RegionLabel from "../RegionLabel" |
26 | | -import LockIcon from "@material-ui/icons/Lock" |
27 | | -import Paper from "@material-ui/core/Paper" |
28 | | -import HighlightBox from "../HighlightBox" |
29 | 10 | import PreventScrollToParents from "../PreventScrollToParents" |
30 | 11 | import useWindowSize from "../hooks/use-window-size.js" |
31 | 12 | import useMouse from "./use-mouse" |
32 | 13 | import useProjectRegionBox from "./use-project-box" |
33 | | -import useLoadImage from "../hooks/use-load-image" |
34 | 14 | import useExcludePattern from "../hooks/use-exclude-pattern" |
35 | 15 | import { useRafState } from "react-use" |
36 | 16 | import PointDistances from "../PointDistances" |
37 | 17 | import RegionTags from "../RegionTags" |
| 18 | +import ImageMask from "../ImageMask" |
38 | 19 | import RegionSelectAndTransformBoxes from "../RegionSelectAndTransformBoxes" |
39 | 20 | import VideoOrImageCanvasBackground from "../VideoOrImageCanvasBackground" |
40 | 21 | import useEventCallback from "use-event-callback" |
@@ -63,6 +44,8 @@ type Props = { |
63 | 44 | allowedArea?: { x: number, y: number, w: number, h: number }, |
64 | 45 | RegionEditLabel?: Node, |
65 | 46 | videoPlaying?: boolean, |
| 47 | + mask?: ImageData, |
| 48 | + maskVersion?: any, |
66 | 49 |
|
67 | 50 | onChangeRegion: (Region) => any, |
68 | 51 | onBeginRegionEdit: (Region) => any, |
@@ -100,11 +83,13 @@ export default ({ |
100 | 83 | regionClsList, |
101 | 84 | regionTagList, |
102 | 85 | showCrosshairs, |
103 | | - showHighlightBox, |
| 86 | + showHighlightBox = true, |
104 | 87 | showPointDistances, |
105 | 88 | allowedArea, |
106 | 89 | RegionEditLabel = null, |
107 | 90 | videoPlaying = false, |
| 91 | + mask, |
| 92 | + maskVersion, |
108 | 93 |
|
109 | 94 | onImageOrVideoLoaded, |
110 | 95 | onChangeRegion, |
@@ -474,6 +459,7 @@ export default ({ |
474 | 459 | {...mouseEvents} |
475 | 460 | > |
476 | 461 | <> |
| 462 | + {mask && <ImageMask maskVersion={maskVersion} imageData={mask} />} |
477 | 463 | <canvas className={classes.canvas} ref={canvasEl} /> |
478 | 464 | <VideoOrImageCanvasBackground |
479 | 465 | videoPlaying={videoPlaying} |
|
0 commit comments