@nyris/nyris-webapp 0.3.3 → 0.3.4
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/build/asset-manifest.json +8 -8
- package/build/index.html +1 -1
- package/build/{precache-manifest.01ce682577e62add75aa397b2a944b75.js → precache-manifest.9800bdc87f5a2c5d6d8a5d1a5287598f.js} +9 -9
- package/build/service-worker.js +1 -1
- package/build/static/js/2.29ddd567.chunk.js +3 -0
- package/build/static/js/{2.d1562c08.chunk.js.LICENSE.txt → 2.29ddd567.chunk.js.LICENSE.txt} +0 -9
- package/build/static/js/2.29ddd567.chunk.js.map +1 -0
- package/build/static/js/main.c35ded37.chunk.js +2 -0
- package/build/static/js/main.c35ded37.chunk.js.map +1 -0
- package/package.json +3 -3
- package/src/App.tsx +3 -6
- package/src/Store/Nyris.ts +7 -7
- package/src/Store/Search.ts +11 -10
- package/src/Store/Store.ts +12 -5
- package/src/components/DragDropFile.tsx +9 -9
- package/src/components/Feedback.tsx +2 -2
- package/src/components/Footer.tsx +1 -1
- package/src/components/HeaderMd.tsx +4 -5
- package/src/index.tsx +2 -1
- package/src/modules/LandingPage/{indexApp.tsx → App.tsx} +53 -227
- package/src/modules/LandingPage/{indexAppMD.tsx → AppMD.tsx} +49 -151
- package/src/modules/LandingPage/index.tsx +193 -0
- package/src/modules/LandingPage/indexNewVersion.tsx +7 -14
- package/src/modules/LandingPage/propsType.ts +43 -0
- package/src/page/result/index.tsx +11 -16
- package/src/services/findRegionsCustom.ts +0 -197
- package/src/services/image.ts +11 -14
- package/src/services/session.ts +6 -6
- package/src/services/types.ts +1 -15
- package/src/types.ts +0 -1
- package/build/static/js/2.d1562c08.chunk.js +0 -3
- package/build/static/js/2.d1562c08.chunk.js.map +0 -1
- package/build/static/js/main.5c08aba4.chunk.js +0 -2
- package/build/static/js/main.5c08aba4.chunk.js.map +0 -1
- package/src/App.test.tsx +0 -49
- package/src/Store/epics/feedback.ts +0 -59
- package/src/Store/epics/types.ts +0 -12
- package/src/components/preview/preview.tsx +0 -433
package/src/App.test.tsx
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import ReactDOM from 'react-dom';
|
|
3
|
-
import App, { AppProps } from './App';
|
|
4
|
-
import AppMD from './AppMD';
|
|
5
|
-
import {defaultMdSettings, defaultSettings} from "./defaults";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const appProps: AppProps = {
|
|
9
|
-
search: {
|
|
10
|
-
results: [],
|
|
11
|
-
categoryPredictions: [],
|
|
12
|
-
filterOptions: [],
|
|
13
|
-
regions: [],
|
|
14
|
-
codes: [],
|
|
15
|
-
previewSelection: { x1: 0, x2: 1, y1: 0, y2: 1}
|
|
16
|
-
},
|
|
17
|
-
loading: false,
|
|
18
|
-
feedbackState: 'question',
|
|
19
|
-
handlers: {
|
|
20
|
-
onCameraClick: () => {},
|
|
21
|
-
onCaptureCanceled: () => {},
|
|
22
|
-
onCaptureComplete: () => {},
|
|
23
|
-
onCloseFeedback: () => {},
|
|
24
|
-
onExampleImageClick: () => {},
|
|
25
|
-
onFileDropped: () => {},
|
|
26
|
-
onImageClick: () => {},
|
|
27
|
-
onLinkClick: () => {},
|
|
28
|
-
onSelectFile: () => {},
|
|
29
|
-
onShowStart: () => {},
|
|
30
|
-
onSelectionChange: () => {},
|
|
31
|
-
onPositiveFeedback: () => {},
|
|
32
|
-
onNegativeFeedback: () => {},
|
|
33
|
-
},
|
|
34
|
-
showPart: 'start',
|
|
35
|
-
settings: { ...defaultSettings },
|
|
36
|
-
mdSettings: defaultMdSettings,
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
it('renders without crashing', () => {
|
|
40
|
-
const div = document.createElement('div');
|
|
41
|
-
ReactDOM.render(<App { ...appProps} />, div);
|
|
42
|
-
ReactDOM.unmountComponentAtNode(div);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('renders material design version without crashing', () => {
|
|
46
|
-
const div = document.createElement('div');
|
|
47
|
-
ReactDOM.render(<AppMD { ...appProps} />, div);
|
|
48
|
-
ReactDOM.unmountComponentAtNode(div);
|
|
49
|
-
});
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import {combineEpics, ofType} from "redux-observable";
|
|
2
|
-
import {debounceTime, ignoreElements, tap, withLatestFrom} from "rxjs/operators";
|
|
3
|
-
import {EpicConf} from "./types";
|
|
4
|
-
|
|
5
|
-
const feedbackSuccessEpic: EpicConf = (action$, state$, {api}) => action$.pipe(
|
|
6
|
-
ofType('FEEDBACK_SUBMIT_POSITIVE', "FEEDBACK_SUBMIT_NEGATIVE"),
|
|
7
|
-
withLatestFrom(state$),
|
|
8
|
-
tap(async ([{type}, state]) => {
|
|
9
|
-
const success = type === 'FEEDBACK_SUBMIT_POSITIVE';
|
|
10
|
-
const sessionId = state.search.sessionId || state.search.requestId;
|
|
11
|
-
if (sessionId && state.search.requestId) {
|
|
12
|
-
await api.sendFeedback(sessionId, state.search.requestId, {
|
|
13
|
-
event: 'feedback', data: {success}
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}),
|
|
17
|
-
ignoreElements()
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
const feedbackRegionEpic: EpicConf = (action$, state$, {api}) => action$.pipe(
|
|
21
|
-
ofType('REGION_CHANGED'),
|
|
22
|
-
debounceTime(1200),
|
|
23
|
-
withLatestFrom(state$),
|
|
24
|
-
tap(async ([action, state]) => {
|
|
25
|
-
if (action.type === 'REGION_CHANGED') {
|
|
26
|
-
let {normalizedRect: {x1, x2, y1, y2}} = action;
|
|
27
|
-
const sessionId = state.search.sessionId || state.search.requestId;
|
|
28
|
-
if (sessionId && state.search.requestId) {
|
|
29
|
-
await api.sendFeedback(sessionId, state.search.requestId, {
|
|
30
|
-
event: 'region', data: {rect: {x: x1, y: y1, w: x2 - x1, h: y2 - y1}}
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}),
|
|
35
|
-
ignoreElements()
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
const feedbackClickEpic: EpicConf = (action$, state$, {api}) => action$.pipe(
|
|
39
|
-
ofType('RESULT_LINK_CLICKED', 'RESULT_IMAGE_CLICKED'),
|
|
40
|
-
withLatestFrom(state$),
|
|
41
|
-
tap(async ([action, state]) => {
|
|
42
|
-
if (action.type === 'RESULT_LINK_CLICKED' || action.type === 'RESULT_IMAGE_CLICKED') {
|
|
43
|
-
let {position} = action;
|
|
44
|
-
const sessionId = state.search.sessionId || state.search.requestId;
|
|
45
|
-
if (sessionId && state.search.requestId) {
|
|
46
|
-
await api.sendFeedback(sessionId, state.search.requestId, {
|
|
47
|
-
event: 'click', data: {positions: [position]}
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}),
|
|
52
|
-
ignoreElements()
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
export default combineEpics(
|
|
56
|
-
feedbackSuccessEpic,
|
|
57
|
-
feedbackRegionEpic,
|
|
58
|
-
feedbackClickEpic
|
|
59
|
-
);
|
package/src/Store/epics/types.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import NyrisAPI from "@nyris/nyris-api";
|
|
2
|
-
import {Epic} from "redux-observable";
|
|
3
|
-
import {AppAction, AppState} from "../../types";
|
|
4
|
-
import {History} from "history";
|
|
5
|
-
|
|
6
|
-
export interface EpicsDependencies {
|
|
7
|
-
api: NyrisAPI,
|
|
8
|
-
history: History
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export type EpicConf = Epic<AppAction, AppAction, AppState, EpicsDependencies>;
|
|
12
|
-
|
|
@@ -1,433 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Layer, Stage, Image, Circle, Rect } from "react-konva";
|
|
3
|
-
import Konva from "konva";
|
|
4
|
-
import { NodeGroup } from "react-move";
|
|
5
|
-
|
|
6
|
-
type PreviewElem = "tl" | "tr" | "bl" | "br" | "rect";
|
|
7
|
-
|
|
8
|
-
interface RectCoords {
|
|
9
|
-
x1: number;
|
|
10
|
-
y1: number;
|
|
11
|
-
x2: number;
|
|
12
|
-
y2: number;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
interface PreviewProps {
|
|
16
|
-
image: HTMLCanvasElement;
|
|
17
|
-
initialRegion: any;
|
|
18
|
-
regions: any[];
|
|
19
|
-
onSelectionChange?: (r: any) => void;
|
|
20
|
-
maxWidth: number;
|
|
21
|
-
maxHeight: number;
|
|
22
|
-
dotColor: string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
interface PreviewState extends RectCoords {
|
|
26
|
-
tlHover: boolean;
|
|
27
|
-
trHover: boolean;
|
|
28
|
-
blHover: boolean;
|
|
29
|
-
brHover: boolean;
|
|
30
|
-
dotHover: boolean;
|
|
31
|
-
rectHover: boolean;
|
|
32
|
-
}
|
|
33
|
-
interface WH {
|
|
34
|
-
w: number;
|
|
35
|
-
h: number;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function getThumbSizeLongestEdge(
|
|
39
|
-
maxW: number,
|
|
40
|
-
maxH: number,
|
|
41
|
-
iW: number,
|
|
42
|
-
iH: number
|
|
43
|
-
): WH {
|
|
44
|
-
let iR = iW / iH;
|
|
45
|
-
let dR = maxW / maxH;
|
|
46
|
-
if (dR > iR) {
|
|
47
|
-
return {
|
|
48
|
-
w: (iW * maxH) / iH,
|
|
49
|
-
h: maxH,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
return {
|
|
53
|
-
w: maxW,
|
|
54
|
-
h: (iH * maxW) / iW,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
class Preview extends React.Component<PreviewProps, PreviewState> {
|
|
59
|
-
private readonly selectionRef: React.RefObject<any>;
|
|
60
|
-
private animation?: Konva.Animation;
|
|
61
|
-
|
|
62
|
-
private handleDragMoveRect = this.handleDragMove.bind(this, "rect");
|
|
63
|
-
private handleDragMoveTl = this.handleDragMove.bind(this, "tl");
|
|
64
|
-
private handleDragMoveTr = this.handleDragMove.bind(this, "tr");
|
|
65
|
-
private handleDragMoveBl = this.handleDragMove.bind(this, "bl");
|
|
66
|
-
private handleDragMoveBr = this.handleDragMove.bind(this, "br");
|
|
67
|
-
|
|
68
|
-
private handleDragBoundTl = ({ x, y }: { x: number; y: number }) => {
|
|
69
|
-
let [minX, minY] = [100, 100];
|
|
70
|
-
let { x2, y2 } = this.scaleToPreviewPixels(this.state);
|
|
71
|
-
return {
|
|
72
|
-
x: Math.max(Math.min(x, x2 - minX), 0),
|
|
73
|
-
y: Math.max(Math.min(y, y2 - minY), 0),
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
private handleDragBoundTr = ({ x, y }: { x: number; y: number }) => {
|
|
78
|
-
let [minX, minY] = [100, 100];
|
|
79
|
-
let { x1, y2, width } = this.scaleToPreviewPixels(this.state);
|
|
80
|
-
return {
|
|
81
|
-
x: Math.min(Math.max(x, x1 + minX), width),
|
|
82
|
-
y: Math.max(Math.min(y, y2 - minY), 0),
|
|
83
|
-
};
|
|
84
|
-
};
|
|
85
|
-
private handleDragBoundBl = ({ x, y }: { x: number; y: number }) => {
|
|
86
|
-
let [minX, minY] = [100, 100];
|
|
87
|
-
let { x2, y1, height } = this.scaleToPreviewPixels(this.state);
|
|
88
|
-
return {
|
|
89
|
-
x: Math.max(Math.min(x, x2 - minX), 0),
|
|
90
|
-
y: Math.min(Math.max(y, y1 + minY), height),
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
private handleDragBoundBr = ({ x, y }: { x: number; y: number }) => {
|
|
95
|
-
let [minX, minY] = [100, 100];
|
|
96
|
-
let { x1, y1, width, height } = this.scaleToPreviewPixels(this.state);
|
|
97
|
-
return {
|
|
98
|
-
x: Math.min(Math.max(x, x1 + minX), width),
|
|
99
|
-
y: Math.min(Math.max(y, y1 + minY), height),
|
|
100
|
-
};
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
private handleDragBoundRect = ({ x, y }: { x: number; y: number }) => {
|
|
104
|
-
let { x1, x2, y1, y2, width, height } = this.scaleToPreviewPixels(
|
|
105
|
-
this.state
|
|
106
|
-
);
|
|
107
|
-
let elemWidth = x2 - x1;
|
|
108
|
-
let elemHeight = y2 - y1;
|
|
109
|
-
return {
|
|
110
|
-
x: Math.max(Math.min(x, width - elemWidth), 0),
|
|
111
|
-
y: Math.max(Math.min(y, height - elemHeight), 0),
|
|
112
|
-
};
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
constructor(props: PreviewProps) {
|
|
116
|
-
super(props);
|
|
117
|
-
this.selectionRef = React.createRef<Konva.Shape>();
|
|
118
|
-
this.state = {
|
|
119
|
-
tlHover: false,
|
|
120
|
-
trHover: false,
|
|
121
|
-
blHover: false,
|
|
122
|
-
brHover: false,
|
|
123
|
-
dotHover: false,
|
|
124
|
-
rectHover: false,
|
|
125
|
-
...props.initialRegion,
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
private handleDragMove(
|
|
130
|
-
elem: PreviewElem,
|
|
131
|
-
evt: Konva.KonvaEventObject<DragEvent>
|
|
132
|
-
) {
|
|
133
|
-
let { x1, x2, y1, y2, width, height } = this.scaleToPreviewPixels(
|
|
134
|
-
this.state
|
|
135
|
-
);
|
|
136
|
-
if (evt.target instanceof Konva.Stage) {
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
let { x: newX, y: newY } = evt.target.getAbsolutePosition();
|
|
141
|
-
let { width: elemWidth, height: elemHeight } = evt.target.getSize();
|
|
142
|
-
switch (elem) {
|
|
143
|
-
case "rect":
|
|
144
|
-
x1 = newX;
|
|
145
|
-
y1 = newY;
|
|
146
|
-
x2 = newX + elemWidth;
|
|
147
|
-
y2 = newY + elemHeight;
|
|
148
|
-
break;
|
|
149
|
-
case "tl":
|
|
150
|
-
x1 = newX;
|
|
151
|
-
y1 = newY;
|
|
152
|
-
break;
|
|
153
|
-
case "tr":
|
|
154
|
-
x2 = newX;
|
|
155
|
-
y1 = newY;
|
|
156
|
-
break;
|
|
157
|
-
case "bl":
|
|
158
|
-
x1 = newX;
|
|
159
|
-
y2 = newY;
|
|
160
|
-
break;
|
|
161
|
-
case "br":
|
|
162
|
-
x2 = newX;
|
|
163
|
-
y2 = newY;
|
|
164
|
-
break;
|
|
165
|
-
}
|
|
166
|
-
let newState = {
|
|
167
|
-
x1: x1 / width,
|
|
168
|
-
x2: x2 / width,
|
|
169
|
-
y1: y1 / height,
|
|
170
|
-
y2: y2 / height,
|
|
171
|
-
};
|
|
172
|
-
this.setSelection(newState);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
private scaleToPreviewPixels({ x1, x2, y1, y2 }: any) {
|
|
176
|
-
let { w: width, h: height } = getThumbSizeLongestEdge(
|
|
177
|
-
this.props.maxWidth,
|
|
178
|
-
this.props.maxHeight,
|
|
179
|
-
this.props.image.width,
|
|
180
|
-
this.props.image.height
|
|
181
|
-
);
|
|
182
|
-
return {
|
|
183
|
-
x1: x1 * width,
|
|
184
|
-
x2: x2 * width,
|
|
185
|
-
y1: y1 * height,
|
|
186
|
-
y2: y2 * height,
|
|
187
|
-
width,
|
|
188
|
-
height,
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
componentDidMount(): void {
|
|
193
|
-
let speed = 40;
|
|
194
|
-
this.animation = new Konva.Animation(
|
|
195
|
-
(frame?: { timeDiff: number; time: number }) => {
|
|
196
|
-
if (!frame) {
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
let angleDiff = (frame.time * speed) / 1000;
|
|
200
|
-
this.selectionRef.current.dashOffset(-angleDiff);
|
|
201
|
-
},
|
|
202
|
-
this.selectionRef.current.getLayer()
|
|
203
|
-
);
|
|
204
|
-
this.animation.start();
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
componentWillUnmount(): void {
|
|
208
|
-
this.animation && this.animation.stop();
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
setSelection(r: RectCoords) {
|
|
212
|
-
this.setState(r);
|
|
213
|
-
if (this.props.onSelectionChange) {
|
|
214
|
-
this.props.onSelectionChange(r);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
getCursor() {
|
|
219
|
-
if (this.state.dotHover) {
|
|
220
|
-
return "pointer";
|
|
221
|
-
}
|
|
222
|
-
if (this.state.tlHover) {
|
|
223
|
-
return "nw-resize";
|
|
224
|
-
}
|
|
225
|
-
if (this.state.trHover) {
|
|
226
|
-
return "ne-resize";
|
|
227
|
-
}
|
|
228
|
-
if (this.state.blHover) {
|
|
229
|
-
return "sw-resize";
|
|
230
|
-
}
|
|
231
|
-
if (this.state.brHover) {
|
|
232
|
-
return "se-resize";
|
|
233
|
-
}
|
|
234
|
-
if (this.state.rectHover) {
|
|
235
|
-
return "move";
|
|
236
|
-
}
|
|
237
|
-
return "default";
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
render() {
|
|
241
|
-
const { image, regions } = this.props;
|
|
242
|
-
if (!image) {
|
|
243
|
-
return null;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
const { x1, x2, y1, y2, width, height }: any = this.scaleToPreviewPixels(
|
|
247
|
-
this.state
|
|
248
|
-
);
|
|
249
|
-
|
|
250
|
-
const dots = regions.map((region: any, i: any) => {
|
|
251
|
-
let { x1, x2, y1, y2 } = region;
|
|
252
|
-
return {
|
|
253
|
-
// get middle of box and map to pixels
|
|
254
|
-
region,
|
|
255
|
-
x: width * ((x2 - x1) / 2 + x1),
|
|
256
|
-
y: height * ((y2 - y1) / 2 + y1),
|
|
257
|
-
key: i,
|
|
258
|
-
};
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
let gripSize = 40;
|
|
262
|
-
let gripOpacity = 0.3;
|
|
263
|
-
let gripOpacityOver = 0.6;
|
|
264
|
-
let darkOpacity = 0.3;
|
|
265
|
-
|
|
266
|
-
return (
|
|
267
|
-
<Stage
|
|
268
|
-
width={width}
|
|
269
|
-
height={height}
|
|
270
|
-
style={{
|
|
271
|
-
cursor: this.getCursor(),
|
|
272
|
-
width: width,
|
|
273
|
-
height: height,
|
|
274
|
-
margin: "auto",
|
|
275
|
-
marginBottom: "5%",
|
|
276
|
-
}}
|
|
277
|
-
>
|
|
278
|
-
<Layer key="img">
|
|
279
|
-
<Image image={image} width={width} height={height} />
|
|
280
|
-
</Layer>
|
|
281
|
-
<Layer key="selection">
|
|
282
|
-
{/* Selection box */}
|
|
283
|
-
<Rect
|
|
284
|
-
stroke="white"
|
|
285
|
-
strokeWidth={2}
|
|
286
|
-
x={x1}
|
|
287
|
-
y={y1}
|
|
288
|
-
width={x2 - x1}
|
|
289
|
-
height={y2 - y1}
|
|
290
|
-
/>
|
|
291
|
-
<Rect
|
|
292
|
-
stroke="black"
|
|
293
|
-
draggable={true}
|
|
294
|
-
onDragMove={this.handleDragMoveRect}
|
|
295
|
-
dragBoundFunc={this.handleDragBoundRect}
|
|
296
|
-
onMouseOver={() => this.setState({ rectHover: true })}
|
|
297
|
-
onMouseOut={() => this.setState({ rectHover: false })}
|
|
298
|
-
opacity={0.8}
|
|
299
|
-
strokeWidth={2}
|
|
300
|
-
x={x1}
|
|
301
|
-
y={y1}
|
|
302
|
-
width={x2 - x1}
|
|
303
|
-
height={y2 - y1}
|
|
304
|
-
dash={[15, 15]}
|
|
305
|
-
ref={this.selectionRef}
|
|
306
|
-
/>
|
|
307
|
-
{/* grips */}
|
|
308
|
-
<Rect
|
|
309
|
-
fill="black"
|
|
310
|
-
draggable={true}
|
|
311
|
-
onDragMove={this.handleDragMoveTl}
|
|
312
|
-
dragBoundFunc={this.handleDragBoundTl}
|
|
313
|
-
onMouseOver={() => this.setState({ tlHover: true })}
|
|
314
|
-
onMouseOut={() => this.setState({ tlHover: false })}
|
|
315
|
-
opacity={this.state.tlHover ? gripOpacityOver : gripOpacity}
|
|
316
|
-
width={gripSize}
|
|
317
|
-
height={gripSize}
|
|
318
|
-
x={x1}
|
|
319
|
-
y={y1}
|
|
320
|
-
/>
|
|
321
|
-
<Rect
|
|
322
|
-
fill="black"
|
|
323
|
-
draggable={true}
|
|
324
|
-
onDragMove={this.handleDragMoveTr}
|
|
325
|
-
dragBoundFunc={this.handleDragBoundTr}
|
|
326
|
-
onMouseOver={() => this.setState({ trHover: true })}
|
|
327
|
-
onMouseOut={() => this.setState({ trHover: false })}
|
|
328
|
-
opacity={this.state.trHover ? gripOpacityOver : gripOpacity}
|
|
329
|
-
width={gripSize}
|
|
330
|
-
height={gripSize}
|
|
331
|
-
x={x2}
|
|
332
|
-
y={y1}
|
|
333
|
-
offsetX={gripSize}
|
|
334
|
-
/>
|
|
335
|
-
<Rect
|
|
336
|
-
fill="black"
|
|
337
|
-
draggable={true}
|
|
338
|
-
onDragMove={this.handleDragMoveBl}
|
|
339
|
-
dragBoundFunc={this.handleDragBoundBl}
|
|
340
|
-
onMouseOver={() => this.setState({ blHover: true })}
|
|
341
|
-
onMouseOut={() => this.setState({ blHover: false })}
|
|
342
|
-
opacity={this.state.blHover ? gripOpacityOver : gripOpacity}
|
|
343
|
-
width={gripSize}
|
|
344
|
-
height={gripSize}
|
|
345
|
-
x={x1}
|
|
346
|
-
y={y2}
|
|
347
|
-
offsetY={gripSize}
|
|
348
|
-
/>
|
|
349
|
-
<Rect
|
|
350
|
-
fill="black"
|
|
351
|
-
draggable={true}
|
|
352
|
-
onDragMove={this.handleDragMoveBr}
|
|
353
|
-
dragBoundFunc={this.handleDragBoundBr}
|
|
354
|
-
onMouseOver={() => this.setState({ brHover: true })}
|
|
355
|
-
onMouseOut={() => this.setState({ brHover: false })}
|
|
356
|
-
opacity={this.state.brHover ? gripOpacityOver : gripOpacity}
|
|
357
|
-
width={gripSize}
|
|
358
|
-
height={gripSize}
|
|
359
|
-
x={x2}
|
|
360
|
-
y={y2}
|
|
361
|
-
offsetY={gripSize}
|
|
362
|
-
offsetX={gripSize}
|
|
363
|
-
/>
|
|
364
|
-
{/* Dark areas */}
|
|
365
|
-
<Rect
|
|
366
|
-
fill="black"
|
|
367
|
-
opacity={darkOpacity}
|
|
368
|
-
x={0}
|
|
369
|
-
y={0}
|
|
370
|
-
width={width}
|
|
371
|
-
height={y1}
|
|
372
|
-
/>
|
|
373
|
-
<Rect
|
|
374
|
-
fill="black"
|
|
375
|
-
opacity={darkOpacity}
|
|
376
|
-
x={0}
|
|
377
|
-
y={y2}
|
|
378
|
-
width={width}
|
|
379
|
-
height={height - y2}
|
|
380
|
-
/>
|
|
381
|
-
<Rect
|
|
382
|
-
fill="black"
|
|
383
|
-
opacity={darkOpacity}
|
|
384
|
-
x={0}
|
|
385
|
-
y={y1}
|
|
386
|
-
width={x1}
|
|
387
|
-
height={y2 - y1}
|
|
388
|
-
/>
|
|
389
|
-
<Rect
|
|
390
|
-
fill="black"
|
|
391
|
-
opacity={darkOpacity}
|
|
392
|
-
x={x2}
|
|
393
|
-
y={y1}
|
|
394
|
-
width={width - x2}
|
|
395
|
-
height={y2 - y1}
|
|
396
|
-
/>
|
|
397
|
-
</Layer>
|
|
398
|
-
<NodeGroup
|
|
399
|
-
data={dots}
|
|
400
|
-
keyAccessor={(r) => r.key}
|
|
401
|
-
start={(d, i) => ({ opacity: 0, x: -100, y: d.y })}
|
|
402
|
-
enter={(d, i) => ({
|
|
403
|
-
opacity: [1],
|
|
404
|
-
x: [d.x],
|
|
405
|
-
y: d.y,
|
|
406
|
-
timing: { delay: i * 100, duration: 300 },
|
|
407
|
-
})}
|
|
408
|
-
>
|
|
409
|
-
{(ds) => (
|
|
410
|
-
<Layer key="dots">
|
|
411
|
-
{ds.map(({ key, data, state: position }) => (
|
|
412
|
-
<Circle
|
|
413
|
-
onClick={() => this.setSelection(data.region)}
|
|
414
|
-
onTap={() => this.setSelection(data.region)}
|
|
415
|
-
onMouseOver={() => this.setState({ dotHover: true })}
|
|
416
|
-
onMouseOut={() => this.setState({ dotHover: false })}
|
|
417
|
-
key={key}
|
|
418
|
-
radius={7}
|
|
419
|
-
{...position}
|
|
420
|
-
stroke={this.props.dotColor}
|
|
421
|
-
fill="white"
|
|
422
|
-
strokeWidth={4}
|
|
423
|
-
/>
|
|
424
|
-
))}
|
|
425
|
-
</Layer>
|
|
426
|
-
)}
|
|
427
|
-
</NodeGroup>
|
|
428
|
-
</Stage>
|
|
429
|
-
);
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
export default Preview;
|