@pie-lib/tools 0.28.0 → 0.29.0-mui-update.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/CHANGELOG.md +15 -2
- package/lib/anchor-utils.js +18 -74
- package/lib/anchor-utils.js.map +1 -1
- package/lib/anchor.js +24 -28
- package/lib/anchor.js.map +1 -1
- package/lib/index.js +1 -11
- package/lib/index.js.map +1 -1
- package/lib/protractor/graphic.js +68 -105
- package/lib/protractor/graphic.js.map +1 -1
- package/lib/protractor/index.js +36 -63
- package/lib/protractor/index.js.map +1 -1
- package/lib/rotatable.js +75 -140
- package/lib/rotatable.js.map +1 -1
- package/lib/ruler/graphic.js +29 -66
- package/lib/ruler/graphic.js.map +1 -1
- package/lib/ruler/index.js +44 -72
- package/lib/ruler/index.js.map +1 -1
- package/lib/ruler/unit-type.js +19 -36
- package/lib/ruler/unit-type.js.map +1 -1
- package/lib/ruler/unit.js +51 -88
- package/lib/ruler/unit.js.map +1 -1
- package/lib/style-utils.js +2 -9
- package/lib/style-utils.js.map +1 -1
- package/lib/transform-origin.js +2 -13
- package/lib/transform-origin.js.map +1 -1
- package/package.json +12 -8
- package/src/anchor.jsx +15 -16
- package/src/protractor/graphic.jsx +49 -54
- package/src/protractor/index.jsx +23 -20
- package/src/rotatable.jsx +24 -27
- package/src/ruler/graphic.jsx +11 -14
- package/src/ruler/index.jsx +25 -25
- package/src/ruler/unit-type.jsx +10 -9
- package/src/ruler/unit.jsx +25 -29
package/src/ruler/unit.jsx
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import {
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
4
|
import { noSelect, strokeColor } from '../style-utils';
|
|
5
5
|
import range from 'lodash/range';
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
const StyledTick = styled('line')(({ theme }) => ({
|
|
8
|
+
stroke: strokeColor(theme),
|
|
9
|
+
}));
|
|
10
|
+
|
|
11
|
+
const Tick = ({ x, height, bottom, major, minor }) => {
|
|
12
12
|
const y1 = major ? bottom - height * 2 : minor ? bottom - height * 1.5 : bottom - height;
|
|
13
13
|
|
|
14
|
-
return <
|
|
15
|
-
}
|
|
14
|
+
return <StyledTick y1={y1} y2={bottom} x1={x} x2={x} />;
|
|
15
|
+
};
|
|
16
16
|
|
|
17
17
|
const Ticks = ({ count, width, height }) => {
|
|
18
18
|
return (
|
|
@@ -40,48 +40,44 @@ Ticks.propTypes = {
|
|
|
40
40
|
height: PropTypes.number.isRequired,
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
+
const StyledEndTick = styled('line')(({ theme }) => ({
|
|
44
|
+
stroke: strokeColor(theme),
|
|
45
|
+
strokeWidth: 1,
|
|
46
|
+
}));
|
|
47
|
+
|
|
48
|
+
const StyledLabel = styled('text')(({ theme }) => ({
|
|
49
|
+
textAnchor: 'end',
|
|
50
|
+
fontSize: '12px',
|
|
51
|
+
fill: strokeColor(theme),
|
|
52
|
+
...noSelect(),
|
|
53
|
+
}));
|
|
54
|
+
|
|
43
55
|
export class Unit extends React.Component {
|
|
44
56
|
static propTypes = {
|
|
45
57
|
index: PropTypes.number.isRequired,
|
|
46
58
|
width: PropTypes.number.isRequired,
|
|
47
59
|
height: PropTypes.number.isRequired,
|
|
48
|
-
classes: PropTypes.object.isRequired,
|
|
49
60
|
last: PropTypes.bool.isRequired,
|
|
50
61
|
config: PropTypes.object.isRequired,
|
|
51
62
|
};
|
|
52
63
|
|
|
53
64
|
render() {
|
|
54
|
-
const { index, width, height,
|
|
65
|
+
const { index, width, height, last, config } = this.props;
|
|
55
66
|
|
|
56
67
|
const style = {
|
|
57
68
|
transform: `translate(${width * (index - 1)}px, 0px)`,
|
|
58
69
|
};
|
|
59
70
|
return (
|
|
60
71
|
<g style={style}>
|
|
61
|
-
{!last && <
|
|
72
|
+
{!last && <StyledEndTick x1={width} y1={0} x2={width} y2={height} />}
|
|
62
73
|
|
|
63
74
|
<Ticks count={config.ticks} width={width} height={height} />
|
|
64
|
-
<
|
|
75
|
+
<StyledLabel width={width} x={width - 5} y={15}>
|
|
65
76
|
{index}
|
|
66
|
-
</
|
|
77
|
+
</StyledLabel>
|
|
67
78
|
</g>
|
|
68
79
|
);
|
|
69
80
|
}
|
|
70
81
|
}
|
|
71
82
|
|
|
72
|
-
export default
|
|
73
|
-
endTick: {
|
|
74
|
-
stroke: strokeColor(theme),
|
|
75
|
-
strokeWidth: 1,
|
|
76
|
-
},
|
|
77
|
-
label: {
|
|
78
|
-
textAnchor: 'end',
|
|
79
|
-
fontSize: '12px',
|
|
80
|
-
fill: strokeColor(theme),
|
|
81
|
-
...noSelect(),
|
|
82
|
-
},
|
|
83
|
-
base: {
|
|
84
|
-
fill: 'none',
|
|
85
|
-
stroke: 'red',
|
|
86
|
-
},
|
|
87
|
-
}))(Unit);
|
|
83
|
+
export default Unit;
|