-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathDefaultResizeHandleComponent.js
43 lines (39 loc) · 1.18 KB
/
DefaultResizeHandleComponent.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* eslint-disable react/no-unused-prop-types */
import React from 'react';
import PropTypes from 'prop-types';
const DefaultResizeHandleComponent = ({
active,
cursor,
isInSelectionGroup,
onMouseDown,
recommendedSize,
scale,
x,
y,
}) => (
<rect
fill={active ? 'rgba(229,240,244,1)' : 'rgba(229,240,244,0.3)'}
height={recommendedSize}
stroke={active ? 'rgba(53,33,140,1)' : 'rgba(53,33,140,0.3)'}
strokeWidth={1 / scale}
style={{ cursor, opacity: isInSelectionGroup ? 0 : 1 }}
width={recommendedSize}
x={x - recommendedSize / 2}
y={y - recommendedSize / 2}
// The onMouseDown prop must be passed on or resize will not work
onMouseDown={onMouseDown}
/>
);
DefaultResizeHandleComponent.propTypes = {
active: PropTypes.bool.isRequired,
nativeActive: PropTypes.bool.isRequired,
cursor: PropTypes.string.isRequired,
isInSelectionGroup: PropTypes.bool.isRequired,
name: PropTypes.string.isRequired,
onMouseDown: PropTypes.func.isRequired,
recommendedSize: PropTypes.number.isRequired,
scale: PropTypes.number.isRequired,
x: PropTypes.number.isRequired,
y: PropTypes.number.isRequired,
};
export default DefaultResizeHandleComponent;