@pie-lib/tools 0.25.1-next.0 → 0.26.2
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/esm/index.js +1158 -0
- package/esm/index.js.map +1 -0
- package/package.json +10 -3
- package/LICENSE.md +0 -5
package/esm/index.js
ADDED
|
@@ -0,0 +1,1158 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { withStyles } from '@material-ui/core/styles';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import range from 'lodash/range';
|
|
5
|
+
import { noSelect } from '@pie-lib/style-utils';
|
|
6
|
+
import classNames from 'classnames';
|
|
7
|
+
import { trigCalculator } from 'trigonometry-calculator';
|
|
8
|
+
import Point from '@mapbox/point-geometry';
|
|
9
|
+
import debug from 'debug';
|
|
10
|
+
import { Portal } from 'react-portal';
|
|
11
|
+
|
|
12
|
+
function _extends() {
|
|
13
|
+
_extends = Object.assign || function (target) {
|
|
14
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
15
|
+
var source = arguments[i];
|
|
16
|
+
|
|
17
|
+
for (var key in source) {
|
|
18
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
19
|
+
target[key] = source[key];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return target;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return _extends.apply(this, arguments);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const strokeColor = theme => `var(--ruler-stroke, ${theme.palette.primary.main})`;
|
|
31
|
+
const fillColor = theme => `var(--ruler-bg, ${theme.palette.primary.contrastText})`;
|
|
32
|
+
|
|
33
|
+
const Line = withStyles(theme => ({
|
|
34
|
+
line: {
|
|
35
|
+
strokeWidth: '0.2',
|
|
36
|
+
stroke: strokeColor(theme)
|
|
37
|
+
}
|
|
38
|
+
}))(({
|
|
39
|
+
angle,
|
|
40
|
+
classes,
|
|
41
|
+
major,
|
|
42
|
+
minor
|
|
43
|
+
}) => /*#__PURE__*/React.createElement("line", {
|
|
44
|
+
transform: `rotate(${angle}, 50.5,50)`,
|
|
45
|
+
className: classes.line,
|
|
46
|
+
style: {},
|
|
47
|
+
x1: "1",
|
|
48
|
+
x2: major ? 10 : minor ? 6 : 3,
|
|
49
|
+
y1: "50",
|
|
50
|
+
y2: "50"
|
|
51
|
+
}));
|
|
52
|
+
const Spike = withStyles(theme => ({
|
|
53
|
+
line: {
|
|
54
|
+
strokeWidth: '0.2',
|
|
55
|
+
stroke: strokeColor(theme)
|
|
56
|
+
}
|
|
57
|
+
}))(({
|
|
58
|
+
angle,
|
|
59
|
+
classes
|
|
60
|
+
}) => /*#__PURE__*/React.createElement("line", {
|
|
61
|
+
transform: `rotate(${angle}, 50.5,50)`,
|
|
62
|
+
className: classes.line,
|
|
63
|
+
style: {},
|
|
64
|
+
x1: "15",
|
|
65
|
+
x2: '46',
|
|
66
|
+
y1: "50",
|
|
67
|
+
y2: "50"
|
|
68
|
+
}));
|
|
69
|
+
const Text = withStyles(theme => ({
|
|
70
|
+
text: _extends({
|
|
71
|
+
fontSize: '2.5px',
|
|
72
|
+
textAnchor: 'middle',
|
|
73
|
+
fill: strokeColor(theme)
|
|
74
|
+
}, noSelect())
|
|
75
|
+
}))(({
|
|
76
|
+
angle,
|
|
77
|
+
classes
|
|
78
|
+
}) => /*#__PURE__*/React.createElement("text", {
|
|
79
|
+
transform: `rotate(${angle - 90}, 50.5, 50)`,
|
|
80
|
+
className: classes.text,
|
|
81
|
+
x: "50",
|
|
82
|
+
y: "12.5"
|
|
83
|
+
}, angle));
|
|
84
|
+
let Graphic$1 = class Graphic extends React.PureComponent {
|
|
85
|
+
render() {
|
|
86
|
+
const {
|
|
87
|
+
classes
|
|
88
|
+
} = this.props;
|
|
89
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
90
|
+
viewBox: "0 0 102 61"
|
|
91
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
92
|
+
className: classes.path,
|
|
93
|
+
d: "M 1,50 A 1,1 0 0 1 100,50 L 100,60 L 1,60 Z",
|
|
94
|
+
fill: "none"
|
|
95
|
+
}), range(0, 181).map(r => /*#__PURE__*/React.createElement(Line, {
|
|
96
|
+
minor: r % 5 === 0,
|
|
97
|
+
major: r % 10 === 0,
|
|
98
|
+
angle: r,
|
|
99
|
+
key: r
|
|
100
|
+
})), range(0, 181, 10).map(r => /*#__PURE__*/React.createElement(React.Fragment, {
|
|
101
|
+
key: r
|
|
102
|
+
}, /*#__PURE__*/React.createElement(Spike, {
|
|
103
|
+
angle: r
|
|
104
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
105
|
+
angle: r
|
|
106
|
+
}))), /*#__PURE__*/React.createElement("circle", {
|
|
107
|
+
r: "4",
|
|
108
|
+
cx: "50.5",
|
|
109
|
+
cy: "50",
|
|
110
|
+
className: classes.circle
|
|
111
|
+
}), /*#__PURE__*/React.createElement("line", {
|
|
112
|
+
className: classes.line,
|
|
113
|
+
x1: "48.5",
|
|
114
|
+
x2: "52.5",
|
|
115
|
+
y1: "50",
|
|
116
|
+
y2: "50"
|
|
117
|
+
}), /*#__PURE__*/React.createElement("line", {
|
|
118
|
+
className: classes.line,
|
|
119
|
+
transform: 'rotate(90 50.5 50)',
|
|
120
|
+
x1: "48.5",
|
|
121
|
+
x2: "52.5",
|
|
122
|
+
y1: "50",
|
|
123
|
+
y2: "50"
|
|
124
|
+
}));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
};
|
|
128
|
+
Graphic$1.propTypes = {
|
|
129
|
+
classes: PropTypes.object.isRequired
|
|
130
|
+
};
|
|
131
|
+
var Graphic$2 = withStyles(theme => ({
|
|
132
|
+
path: {
|
|
133
|
+
strokeWidth: '0.2',
|
|
134
|
+
stroke: strokeColor(theme)
|
|
135
|
+
},
|
|
136
|
+
line: {
|
|
137
|
+
strokeWidth: '0.2',
|
|
138
|
+
stroke: strokeColor(theme)
|
|
139
|
+
},
|
|
140
|
+
circle: {
|
|
141
|
+
strokeWidth: '0.2',
|
|
142
|
+
stroke: strokeColor(theme),
|
|
143
|
+
fill: 'none'
|
|
144
|
+
}
|
|
145
|
+
}))(Graphic$1);
|
|
146
|
+
|
|
147
|
+
const Anchor$1 = withStyles(theme => ({
|
|
148
|
+
anchor: {
|
|
149
|
+
cursor: 'pointer',
|
|
150
|
+
width: '20px',
|
|
151
|
+
height: '20px',
|
|
152
|
+
position: 'absolute',
|
|
153
|
+
borderRadius: '10px',
|
|
154
|
+
backgroundColor: `var(--ruler-bg, ${theme.palette.primary.contrastText})`,
|
|
155
|
+
transition: 'background-color 200ms ease-in',
|
|
156
|
+
border: `solid 1px var(--ruler-stroke, ${theme.palette.primary.dark})`,
|
|
157
|
+
'&:hover': {
|
|
158
|
+
backgroundColor: `var(--ruler-bg-hover, ${theme.palette.primary.light})`
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}))(({
|
|
162
|
+
classes,
|
|
163
|
+
className
|
|
164
|
+
}) => /*#__PURE__*/React.createElement("div", {
|
|
165
|
+
className: classNames(classes.anchor, className)
|
|
166
|
+
}));
|
|
167
|
+
|
|
168
|
+
const keyWordToPercent = v => {
|
|
169
|
+
if (v === 'left' || v === 'top') {
|
|
170
|
+
return 0;
|
|
171
|
+
} else if (v === 'right' || v === 'bottom') {
|
|
172
|
+
return 100;
|
|
173
|
+
} else if (v === 'center') {
|
|
174
|
+
return 50;
|
|
175
|
+
} else if (v.endsWith('%')) {
|
|
176
|
+
return parseFloat(v);
|
|
177
|
+
} else {
|
|
178
|
+
return v;
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
const getValue = (s, length) => {
|
|
183
|
+
if (s.endsWith('px')) {
|
|
184
|
+
return parseFloat(s);
|
|
185
|
+
} else {
|
|
186
|
+
s = keyWordToPercent(s);
|
|
187
|
+
const v = length * (s / 100);
|
|
188
|
+
return v;
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
const normalize = a => {
|
|
193
|
+
if (a[0] === 'bottom' || a[0] === 'top' || a[1] === 'left' || a[1] === 'right') {
|
|
194
|
+
return [a[1], a[0]];
|
|
195
|
+
} else {
|
|
196
|
+
return a;
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
/**
|
|
200
|
+
* Parse a transform origin string to x/y values.
|
|
201
|
+
* @param {{width: number, height: number}} rect
|
|
202
|
+
* @param {string} value
|
|
203
|
+
* @returns {x:number, y:number}
|
|
204
|
+
*/
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
const parse = (rect, value) => {
|
|
208
|
+
if (!value) {
|
|
209
|
+
return {
|
|
210
|
+
x: rect.width / 2,
|
|
211
|
+
y: rect.height / 2
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const arr = value.split(' ');
|
|
216
|
+
|
|
217
|
+
if (arr.length === 1) {
|
|
218
|
+
//1 val
|
|
219
|
+
const x = getValue(arr[0], rect.width);
|
|
220
|
+
const y = getValue('50%', rect.height);
|
|
221
|
+
return {
|
|
222
|
+
x,
|
|
223
|
+
y
|
|
224
|
+
};
|
|
225
|
+
} else if (arr.length === 2) {
|
|
226
|
+
const sorted = normalize(arr);
|
|
227
|
+
const x = getValue(sorted[0], rect.width);
|
|
228
|
+
const y = getValue(sorted[1], rect.height);
|
|
229
|
+
return {
|
|
230
|
+
x,
|
|
231
|
+
y
|
|
232
|
+
};
|
|
233
|
+
} else if (arr.length === 3) {
|
|
234
|
+
throw new Error('transform-origin values with 3 fields not supported.');
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
const log = debug('@pie-lib:tools:anchor-utils');
|
|
239
|
+
const toDegrees = radians => radians * (180 / Math.PI);
|
|
240
|
+
const toRadians = degrees => degrees * (Math.PI / 180);
|
|
241
|
+
const normalizeAngle = a => {
|
|
242
|
+
if (a > 360) {
|
|
243
|
+
return a % 360;
|
|
244
|
+
} else if (a < 0) {
|
|
245
|
+
return 360 + a % 360;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return a;
|
|
249
|
+
};
|
|
250
|
+
const toPoint = (rect, edge) => {
|
|
251
|
+
const out = parse(rect, edge);
|
|
252
|
+
return new Point(out.x, out.y);
|
|
253
|
+
};
|
|
254
|
+
/**
|
|
255
|
+
* Get the distance between to anchor points in a rect.
|
|
256
|
+
* @param {{width: number, height: number}} rect - the rect
|
|
257
|
+
* @param {number} degrees - the degrees
|
|
258
|
+
* @param {string} from - from anchor
|
|
259
|
+
* @param {string} to - to anchor
|
|
260
|
+
* @returns {Point} point - the distance as a Point
|
|
261
|
+
*/
|
|
262
|
+
|
|
263
|
+
const distanceBetween = (rect, degrees, from, to) => {
|
|
264
|
+
const center = new Point(rect.width / 2, rect.height / 2);
|
|
265
|
+
const radians = toRadians(degrees);
|
|
266
|
+
const fromCenter = center.rotateAround(radians, toPoint(rect, from));
|
|
267
|
+
const toCenter = center.rotateAround(radians, toPoint(rect, to));
|
|
268
|
+
const diff = fromCenter.sub(toCenter);
|
|
269
|
+
return diff;
|
|
270
|
+
};
|
|
271
|
+
/**
|
|
272
|
+
* For a corner string, a point and a rect, return a relative x,y from that point to a corner.
|
|
273
|
+
* Note that the y value descends as it goes down (unlike for a screen's y value), so this is only really useful for math functions.
|
|
274
|
+
* @example
|
|
275
|
+
* ```
|
|
276
|
+
* getXAndY('top-left', {width: 100, height: 100}, 10, 10) //=> {x:10, y: -90}
|
|
277
|
+
* ```
|
|
278
|
+
* @param {*} corner
|
|
279
|
+
* @param {*} rect
|
|
280
|
+
* @param {*} point
|
|
281
|
+
*/
|
|
282
|
+
|
|
283
|
+
const getXAndY = (corner, rect, point) => {
|
|
284
|
+
if (corner === 'top-left') {
|
|
285
|
+
const x = point.x * -1;
|
|
286
|
+
const y = point.y;
|
|
287
|
+
return {
|
|
288
|
+
x,
|
|
289
|
+
y
|
|
290
|
+
};
|
|
291
|
+
} else if (corner === 'bottom-left') {
|
|
292
|
+
const x = point.x * -1;
|
|
293
|
+
const y = point.y - rect.height;
|
|
294
|
+
return {
|
|
295
|
+
x,
|
|
296
|
+
y
|
|
297
|
+
};
|
|
298
|
+
} else if (corner === 'top-right') {
|
|
299
|
+
const x = rect.width - point.x;
|
|
300
|
+
const y = point.y;
|
|
301
|
+
return {
|
|
302
|
+
x,
|
|
303
|
+
y
|
|
304
|
+
};
|
|
305
|
+
} else if (corner === 'bottom-right') {
|
|
306
|
+
const x = rect.width - point.x;
|
|
307
|
+
const y = point.y - rect.height;
|
|
308
|
+
return {
|
|
309
|
+
x,
|
|
310
|
+
y
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
const arctangent = (x, y) => toDegrees(Math.atan2(x, y));
|
|
315
|
+
const getAngleAndHypotenuse = (corner, rect, point) => {
|
|
316
|
+
const {
|
|
317
|
+
x,
|
|
318
|
+
y
|
|
319
|
+
} = getXAndY(corner, rect, point);
|
|
320
|
+
const degrees = arctangent(x, y);
|
|
321
|
+
const hypotenuse = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
|
|
322
|
+
return {
|
|
323
|
+
x,
|
|
324
|
+
y,
|
|
325
|
+
degrees,
|
|
326
|
+
hypotenuse
|
|
327
|
+
};
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
const getPosition = (side, rect, point, angle, calcAngle) => {
|
|
331
|
+
if (angle === 0) {
|
|
332
|
+
return side === 'left' ? point.x : point.y;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
const points = anglePoints(angle);
|
|
336
|
+
const key = points[side];
|
|
337
|
+
const {
|
|
338
|
+
degrees,
|
|
339
|
+
hypotenuse
|
|
340
|
+
} = getAngleAndHypotenuse(key, rect, point);
|
|
341
|
+
const ra = calcAngle(degrees);
|
|
342
|
+
|
|
343
|
+
if (ra === 0) {
|
|
344
|
+
return hypotenuse;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
const t = {
|
|
348
|
+
angles: {
|
|
349
|
+
0: ra,
|
|
350
|
+
1: 90
|
|
351
|
+
},
|
|
352
|
+
sides: {
|
|
353
|
+
1: hypotenuse
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
const out = trigCalculator(t);
|
|
357
|
+
return out.sides[2];
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
const getTop = (rect, point, angle) => {
|
|
361
|
+
return getPosition('top', rect, point, angle, degrees => {
|
|
362
|
+
return Math.abs(angle + degrees);
|
|
363
|
+
});
|
|
364
|
+
};
|
|
365
|
+
const getLeft = (rect, point, angle) => {
|
|
366
|
+
return getPosition('left', rect, point, angle, degrees => {
|
|
367
|
+
return Math.abs(angle + degrees + 90);
|
|
368
|
+
});
|
|
369
|
+
};
|
|
370
|
+
/**
|
|
371
|
+
* Calculate the position of an anchor within a bounding rect, if the source rect has been rotated by an angle.
|
|
372
|
+
* It does this by finding the appropriate corner of the src rect, that touches the bounding rect, calculates
|
|
373
|
+
* the hypotenuse (h) of that anchor to that point. Then using that plus the rotation it calculates
|
|
374
|
+
* the sides of the triangle and returns the length of the side that touches the bounding rect.
|
|
375
|
+
* @param {{width: number, height: number}} rect - the rect which contains the point
|
|
376
|
+
* @param {{x:number, y: number}} point - the point within the rect
|
|
377
|
+
* @param {number} angle - the angle in degrees that the rect has rotated.
|
|
378
|
+
* @returns {{left: number, top: number}} position
|
|
379
|
+
*/
|
|
380
|
+
|
|
381
|
+
const getAnchor = (rect, point, angle) => {
|
|
382
|
+
log('[getAnchor] rect: ', rect, 'point:', point, 'angle: ', angle);
|
|
383
|
+
|
|
384
|
+
if (point.x > rect.width) {
|
|
385
|
+
throw new Error(`x: ${point.x} cannot be greater than width: ${rect.width}`);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
if (point.y > rect.height) {
|
|
389
|
+
throw new Error(`y: ${point.y} cannot be greater than height: ${rect.height}`);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
const a = normalizeAngle(angle);
|
|
393
|
+
const top = getTop(rect, point, a);
|
|
394
|
+
const left = getLeft(rect, point, a);
|
|
395
|
+
log('[getAnchor] top: ', top, 'left: ', left);
|
|
396
|
+
return {
|
|
397
|
+
top,
|
|
398
|
+
left
|
|
399
|
+
};
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
const anglePoints = angle => {
|
|
403
|
+
if (angle <= 90) {
|
|
404
|
+
return {
|
|
405
|
+
top: 'top-left',
|
|
406
|
+
left: 'bottom-left'
|
|
407
|
+
};
|
|
408
|
+
} else if (angle > 90 && angle <= 180) {
|
|
409
|
+
return {
|
|
410
|
+
top: 'bottom-left',
|
|
411
|
+
left: 'bottom-right'
|
|
412
|
+
};
|
|
413
|
+
} else if (angle > 180 && angle <= 270) {
|
|
414
|
+
return {
|
|
415
|
+
top: 'bottom-right',
|
|
416
|
+
left: 'top-right'
|
|
417
|
+
};
|
|
418
|
+
} else if (angle > 270 && angle < 360) {
|
|
419
|
+
return {
|
|
420
|
+
top: 'top-right',
|
|
421
|
+
left: 'top-left'
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
var anchorUtils = /*#__PURE__*/Object.freeze({
|
|
427
|
+
__proto__: null,
|
|
428
|
+
arctangent: arctangent,
|
|
429
|
+
distanceBetween: distanceBetween,
|
|
430
|
+
getAnchor: getAnchor,
|
|
431
|
+
getAngleAndHypotenuse: getAngleAndHypotenuse,
|
|
432
|
+
getLeft: getLeft,
|
|
433
|
+
getTop: getTop,
|
|
434
|
+
getXAndY: getXAndY,
|
|
435
|
+
normalizeAngle: normalizeAngle,
|
|
436
|
+
toDegrees: toDegrees,
|
|
437
|
+
toPoint: toPoint,
|
|
438
|
+
toRadians: toRadians
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
const Anchor = withStyles({
|
|
442
|
+
anchor: {
|
|
443
|
+
position: 'absolute',
|
|
444
|
+
zIndex: 100,
|
|
445
|
+
width: '200px',
|
|
446
|
+
height: '80px'
|
|
447
|
+
}
|
|
448
|
+
})(({
|
|
449
|
+
classes,
|
|
450
|
+
left,
|
|
451
|
+
top,
|
|
452
|
+
color,
|
|
453
|
+
fill
|
|
454
|
+
}) => {
|
|
455
|
+
color = color || 'green';
|
|
456
|
+
fill = fill || 'white';
|
|
457
|
+
return /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement("svg", {
|
|
458
|
+
className: classes.anchor,
|
|
459
|
+
style: {
|
|
460
|
+
left: left - 10,
|
|
461
|
+
top: top - 10
|
|
462
|
+
}
|
|
463
|
+
}, /*#__PURE__*/React.createElement("circle", {
|
|
464
|
+
cx: 10,
|
|
465
|
+
cy: 10,
|
|
466
|
+
r: 8,
|
|
467
|
+
strokeWidth: 1,
|
|
468
|
+
stroke: color,
|
|
469
|
+
fill: fill
|
|
470
|
+
})));
|
|
471
|
+
});
|
|
472
|
+
/**
|
|
473
|
+
* Tip o' the hat to:
|
|
474
|
+
* https://bl.ocks.org/joyrexus/7207044
|
|
475
|
+
*/
|
|
476
|
+
|
|
477
|
+
class Rotatable extends React.Component {
|
|
478
|
+
constructor(props) {
|
|
479
|
+
super(props);
|
|
480
|
+
|
|
481
|
+
this.initHandles = () => {
|
|
482
|
+
const {
|
|
483
|
+
handle
|
|
484
|
+
} = this.props;
|
|
485
|
+
|
|
486
|
+
if (Array.isArray(handle)) {
|
|
487
|
+
this.handles = [];
|
|
488
|
+
handle.forEach(h => {
|
|
489
|
+
const el = this.rotatable.querySelector(`.${h.class}`);
|
|
490
|
+
|
|
491
|
+
if (el) {
|
|
492
|
+
const mousedownHandler = this.rotateStart(h.origin);
|
|
493
|
+
el.addEventListener('mousedown', mousedownHandler);
|
|
494
|
+
el.addEventListener('mouseup', this.rotateStop);
|
|
495
|
+
this.handles.push({
|
|
496
|
+
el,
|
|
497
|
+
mousedownHandler
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
};
|
|
503
|
+
|
|
504
|
+
this.addMouseUpHandler = () => {
|
|
505
|
+
document.addEventListener('mouseup', this.rotateStop);
|
|
506
|
+
};
|
|
507
|
+
|
|
508
|
+
this.originToXY = origin => {
|
|
509
|
+
const {
|
|
510
|
+
clientWidth: width,
|
|
511
|
+
clientHeight: height
|
|
512
|
+
} = this.rotatable;
|
|
513
|
+
return parse({
|
|
514
|
+
width,
|
|
515
|
+
height
|
|
516
|
+
}, origin);
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
this.getAnchor = origin => {
|
|
520
|
+
const {
|
|
521
|
+
rotation
|
|
522
|
+
} = this.state;
|
|
523
|
+
const {
|
|
524
|
+
clientWidth,
|
|
525
|
+
clientHeight
|
|
526
|
+
} = this.rotatable;
|
|
527
|
+
const {
|
|
528
|
+
top,
|
|
529
|
+
left
|
|
530
|
+
} = this.rotatable.getBoundingClientRect();
|
|
531
|
+
const xy = this.originToXY(origin);
|
|
532
|
+
const {
|
|
533
|
+
top: anchorTop,
|
|
534
|
+
left: anchorLeft
|
|
535
|
+
} = getAnchor({
|
|
536
|
+
width: clientWidth,
|
|
537
|
+
height: clientHeight
|
|
538
|
+
}, xy, rotation);
|
|
539
|
+
return {
|
|
540
|
+
top: top + anchorTop,
|
|
541
|
+
left: left + anchorLeft
|
|
542
|
+
};
|
|
543
|
+
};
|
|
544
|
+
|
|
545
|
+
this.rotateStart = origin => e => {
|
|
546
|
+
const {
|
|
547
|
+
isRotating
|
|
548
|
+
} = this.state;
|
|
549
|
+
|
|
550
|
+
if (isRotating) {
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
e.preventDefault();
|
|
555
|
+
const anchor = this.getAnchor(origin);
|
|
556
|
+
const {
|
|
557
|
+
rotation
|
|
558
|
+
} = this.state;
|
|
559
|
+
const {
|
|
560
|
+
angle: startAngle
|
|
561
|
+
} = this.getAngle(anchor, e);
|
|
562
|
+
let diff = {
|
|
563
|
+
x: 0,
|
|
564
|
+
y: 0
|
|
565
|
+
};
|
|
566
|
+
|
|
567
|
+
if (origin !== this.state.origin) {
|
|
568
|
+
const {
|
|
569
|
+
clientWidth: width,
|
|
570
|
+
clientHeight: height
|
|
571
|
+
} = this.rotatable;
|
|
572
|
+
diff = distanceBetween({
|
|
573
|
+
width,
|
|
574
|
+
height
|
|
575
|
+
}, rotation, this.state.origin, origin);
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
this.setState({
|
|
579
|
+
origin,
|
|
580
|
+
isRotating: true,
|
|
581
|
+
startAngle,
|
|
582
|
+
anchor,
|
|
583
|
+
position: {
|
|
584
|
+
left: this.state.position.left + diff.x,
|
|
585
|
+
top: this.state.position.top + diff.y
|
|
586
|
+
}
|
|
587
|
+
}, () => {
|
|
588
|
+
document.addEventListener('mousemove', this.rotate);
|
|
589
|
+
});
|
|
590
|
+
};
|
|
591
|
+
|
|
592
|
+
this.rotateStop = e => {
|
|
593
|
+
const {
|
|
594
|
+
isRotating
|
|
595
|
+
} = this.state;
|
|
596
|
+
|
|
597
|
+
if (!isRotating) {
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
e.preventDefault();
|
|
602
|
+
this.setState({
|
|
603
|
+
isRotating: false,
|
|
604
|
+
angle: this.state.rotation,
|
|
605
|
+
anchor: null,
|
|
606
|
+
current: null
|
|
607
|
+
}, () => {
|
|
608
|
+
document.removeEventListener('mousemove', this.rotate);
|
|
609
|
+
document.removeEventListener('mousemove', this.drag);
|
|
610
|
+
});
|
|
611
|
+
};
|
|
612
|
+
|
|
613
|
+
this.rotate = e => {
|
|
614
|
+
const {
|
|
615
|
+
isRotating
|
|
616
|
+
} = this.state;
|
|
617
|
+
|
|
618
|
+
if (!isRotating) {
|
|
619
|
+
return;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
e.preventDefault();
|
|
623
|
+
const {
|
|
624
|
+
startAngle,
|
|
625
|
+
angle,
|
|
626
|
+
anchor
|
|
627
|
+
} = this.state;
|
|
628
|
+
const {
|
|
629
|
+
angle: current,
|
|
630
|
+
x,
|
|
631
|
+
y
|
|
632
|
+
} = this.getAngle(anchor, e);
|
|
633
|
+
const computedAnchor = {
|
|
634
|
+
x,
|
|
635
|
+
y
|
|
636
|
+
};
|
|
637
|
+
const diff = current - startAngle;
|
|
638
|
+
const rotation = angle + diff;
|
|
639
|
+
this.setState({
|
|
640
|
+
rotation,
|
|
641
|
+
diff,
|
|
642
|
+
current,
|
|
643
|
+
computedAnchor
|
|
644
|
+
});
|
|
645
|
+
};
|
|
646
|
+
|
|
647
|
+
this.mouseDown = e => {
|
|
648
|
+
const handle = this.handles.find(h => h.el === e.target);
|
|
649
|
+
|
|
650
|
+
if (!handle) {
|
|
651
|
+
this.dragStart(e);
|
|
652
|
+
}
|
|
653
|
+
};
|
|
654
|
+
|
|
655
|
+
this.dragStart = e => {
|
|
656
|
+
const dragPoint = new Point(e.pageX, e.pageY);
|
|
657
|
+
this.setState({
|
|
658
|
+
dragPoint
|
|
659
|
+
}, () => {
|
|
660
|
+
document.addEventListener('mousemove', this.drag);
|
|
661
|
+
});
|
|
662
|
+
};
|
|
663
|
+
|
|
664
|
+
this.drag = e => {
|
|
665
|
+
e.preventDefault();
|
|
666
|
+
const current = new Point(e.pageX, e.pageY);
|
|
667
|
+
const translate = current.sub(this.state.dragPoint);
|
|
668
|
+
this.setState({
|
|
669
|
+
translate
|
|
670
|
+
});
|
|
671
|
+
};
|
|
672
|
+
|
|
673
|
+
this.mouseUp = () => {
|
|
674
|
+
if (!this.state.translate) {
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
const {
|
|
679
|
+
position: lastPosition,
|
|
680
|
+
translate
|
|
681
|
+
} = this.state;
|
|
682
|
+
const position = {
|
|
683
|
+
left: lastPosition.left + translate.x,
|
|
684
|
+
top: lastPosition.top + translate.y
|
|
685
|
+
};
|
|
686
|
+
document.removeEventListener('mousemove', this.drag);
|
|
687
|
+
this.setState({
|
|
688
|
+
position,
|
|
689
|
+
dragPoint: null,
|
|
690
|
+
translate: null
|
|
691
|
+
});
|
|
692
|
+
};
|
|
693
|
+
|
|
694
|
+
this.state = {
|
|
695
|
+
isRotating: false,
|
|
696
|
+
rotation: 0,
|
|
697
|
+
startAngle: 0,
|
|
698
|
+
angle: 0,
|
|
699
|
+
position: {
|
|
700
|
+
left: props.startPosition.left,
|
|
701
|
+
top: props.startPosition.top
|
|
702
|
+
}
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
componentWillUnmount() {
|
|
707
|
+
document.removeEventListener('mouseup', this.rotateStop);
|
|
708
|
+
document.removeEventListener('mousemove', this.drag);
|
|
709
|
+
document.removeEventListener('mousemove', this.rotate);
|
|
710
|
+
this.handles.forEach(h => {
|
|
711
|
+
h.el.removeEventListener('mousedown', h.mousedownHandler);
|
|
712
|
+
h.el.removeEventListener('mouseup', this.rotateStop);
|
|
713
|
+
});
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
componentDidMount() {
|
|
717
|
+
this.addMouseUpHandler();
|
|
718
|
+
this.initHandles();
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
getAngle(anchor, e) {
|
|
722
|
+
const x = e.clientX - anchor.left;
|
|
723
|
+
const y = (e.clientY - anchor.top) * -1;
|
|
724
|
+
return {
|
|
725
|
+
angle: arctangent(x, y),
|
|
726
|
+
x,
|
|
727
|
+
y
|
|
728
|
+
};
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
render() {
|
|
732
|
+
const {
|
|
733
|
+
children,
|
|
734
|
+
classes,
|
|
735
|
+
showAnchor,
|
|
736
|
+
className
|
|
737
|
+
} = this.props;
|
|
738
|
+
const {
|
|
739
|
+
rotation,
|
|
740
|
+
anchor,
|
|
741
|
+
origin,
|
|
742
|
+
translate,
|
|
743
|
+
position
|
|
744
|
+
} = this.state;
|
|
745
|
+
const t = translate ? `translate(${translate.x}px, ${translate.y}px)` : '';
|
|
746
|
+
const style = {
|
|
747
|
+
left: position.left,
|
|
748
|
+
top: position.top,
|
|
749
|
+
transformOrigin: origin,
|
|
750
|
+
transform: `${t} rotate(${rotation}deg)`
|
|
751
|
+
};
|
|
752
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
753
|
+
className: classNames(classes.rotatable, className),
|
|
754
|
+
style: style,
|
|
755
|
+
ref: r => this.rotatable = r,
|
|
756
|
+
onMouseDown: this.mouseDown,
|
|
757
|
+
onMouseUp: this.mouseUp
|
|
758
|
+
}, anchor && showAnchor && /*#__PURE__*/React.createElement(Anchor, anchor), children);
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
}
|
|
762
|
+
Rotatable.propTypes = {
|
|
763
|
+
classes: PropTypes.object.isRequired,
|
|
764
|
+
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
|
|
765
|
+
showAnchor: PropTypes.bool,
|
|
766
|
+
handle: PropTypes.arrayOf(PropTypes.shape({
|
|
767
|
+
class: PropTypes.string.isRequired,
|
|
768
|
+
origin: PropTypes.string
|
|
769
|
+
})),
|
|
770
|
+
className: PropTypes.string,
|
|
771
|
+
startPosition: PropTypes.shape({
|
|
772
|
+
left: PropTypes.number,
|
|
773
|
+
top: PropTypes.number
|
|
774
|
+
})
|
|
775
|
+
};
|
|
776
|
+
Rotatable.defaultProps = {
|
|
777
|
+
showAnchor: false,
|
|
778
|
+
startPosition: {
|
|
779
|
+
left: 0,
|
|
780
|
+
top: 0
|
|
781
|
+
}
|
|
782
|
+
};
|
|
783
|
+
var Rotatable$1 = withStyles({
|
|
784
|
+
rotatable: {
|
|
785
|
+
position: 'relative',
|
|
786
|
+
display: 'inline-block',
|
|
787
|
+
cursor: 'move'
|
|
788
|
+
}
|
|
789
|
+
})(Rotatable);
|
|
790
|
+
|
|
791
|
+
class Protractor extends React.Component {
|
|
792
|
+
render() {
|
|
793
|
+
const {
|
|
794
|
+
classes,
|
|
795
|
+
width,
|
|
796
|
+
className,
|
|
797
|
+
startPosition
|
|
798
|
+
} = this.props;
|
|
799
|
+
return /*#__PURE__*/React.createElement(Rotatable$1, {
|
|
800
|
+
className: className,
|
|
801
|
+
startPosition: startPosition,
|
|
802
|
+
handle: [{
|
|
803
|
+
class: 'leftAnchor',
|
|
804
|
+
origin: `${width * 0.495}px ${width * 0.49}px`
|
|
805
|
+
}, {
|
|
806
|
+
class: 'rightAnchor',
|
|
807
|
+
origin: `${width * 0.495}px ${width * 0.49}px`
|
|
808
|
+
}]
|
|
809
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
810
|
+
className: classes.protractor,
|
|
811
|
+
style: {
|
|
812
|
+
width: `${width}px`
|
|
813
|
+
}
|
|
814
|
+
}, /*#__PURE__*/React.createElement(Graphic$2, null), /*#__PURE__*/React.createElement(Anchor$1, {
|
|
815
|
+
className: classNames('leftAnchor', classes.leftAnchor)
|
|
816
|
+
}), /*#__PURE__*/React.createElement(Anchor$1, {
|
|
817
|
+
className: classNames('rightAnchor', classes.rightAnchor)
|
|
818
|
+
})));
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
}
|
|
822
|
+
Protractor.propTypes = {
|
|
823
|
+
classes: PropTypes.object.isRequired,
|
|
824
|
+
width: PropTypes.number.isRequired,
|
|
825
|
+
className: PropTypes.string,
|
|
826
|
+
startPosition: PropTypes.shape({
|
|
827
|
+
left: PropTypes.number,
|
|
828
|
+
top: PropTypes.number
|
|
829
|
+
})
|
|
830
|
+
};
|
|
831
|
+
Protractor.defaultProps = {
|
|
832
|
+
width: 450,
|
|
833
|
+
startPosition: {
|
|
834
|
+
left: 0,
|
|
835
|
+
top: 0
|
|
836
|
+
}
|
|
837
|
+
};
|
|
838
|
+
var index$1 = withStyles(() => ({
|
|
839
|
+
protractor: {
|
|
840
|
+
position: 'relative'
|
|
841
|
+
},
|
|
842
|
+
leftAnchor: {
|
|
843
|
+
position: 'absolute',
|
|
844
|
+
left: 0,
|
|
845
|
+
bottom: 0
|
|
846
|
+
},
|
|
847
|
+
rightAnchor: {
|
|
848
|
+
position: 'absolute',
|
|
849
|
+
right: 0,
|
|
850
|
+
bottom: 0
|
|
851
|
+
}
|
|
852
|
+
}))(Protractor);
|
|
853
|
+
|
|
854
|
+
const UnitType = props => {
|
|
855
|
+
const {
|
|
856
|
+
classes,
|
|
857
|
+
label,
|
|
858
|
+
x,
|
|
859
|
+
y,
|
|
860
|
+
textAlign,
|
|
861
|
+
fill,
|
|
862
|
+
fontSize,
|
|
863
|
+
stroke
|
|
864
|
+
} = props;
|
|
865
|
+
return /*#__PURE__*/React.createElement("text", {
|
|
866
|
+
className: classes.unitType,
|
|
867
|
+
x: x,
|
|
868
|
+
y: y,
|
|
869
|
+
textAnchor: textAlign,
|
|
870
|
+
stroke: stroke,
|
|
871
|
+
fill: fill,
|
|
872
|
+
fontSize: fontSize
|
|
873
|
+
}, label);
|
|
874
|
+
};
|
|
875
|
+
UnitType.propTypes = {
|
|
876
|
+
classes: PropTypes.object.isRequired,
|
|
877
|
+
label: PropTypes.string.isRequired,
|
|
878
|
+
x: PropTypes.number,
|
|
879
|
+
y: PropTypes.number,
|
|
880
|
+
textAlign: PropTypes.string,
|
|
881
|
+
fill: PropTypes.string,
|
|
882
|
+
fontSize: PropTypes.number,
|
|
883
|
+
stroke: PropTypes.string
|
|
884
|
+
};
|
|
885
|
+
UnitType.defaultProps = {
|
|
886
|
+
textAnchor: 'start',
|
|
887
|
+
fontSize: 11,
|
|
888
|
+
stroke: 'none',
|
|
889
|
+
x: 8,
|
|
890
|
+
y: 14
|
|
891
|
+
};
|
|
892
|
+
var UnitType$1 = withStyles(theme => ({
|
|
893
|
+
unitType: _extends({}, noSelect(), {
|
|
894
|
+
fill: strokeColor(theme)
|
|
895
|
+
})
|
|
896
|
+
}))(UnitType);
|
|
897
|
+
|
|
898
|
+
const Tick = withStyles(theme => ({
|
|
899
|
+
tick: {
|
|
900
|
+
stroke: strokeColor(theme)
|
|
901
|
+
}
|
|
902
|
+
}))(({
|
|
903
|
+
x,
|
|
904
|
+
height,
|
|
905
|
+
bottom,
|
|
906
|
+
classes,
|
|
907
|
+
major,
|
|
908
|
+
minor
|
|
909
|
+
}) => {
|
|
910
|
+
const y1 = major ? bottom - height * 2 : minor ? bottom - height * 1.5 : bottom - height;
|
|
911
|
+
return /*#__PURE__*/React.createElement("line", {
|
|
912
|
+
y1: y1,
|
|
913
|
+
y2: bottom,
|
|
914
|
+
x1: x,
|
|
915
|
+
x2: x,
|
|
916
|
+
className: classes.tick
|
|
917
|
+
});
|
|
918
|
+
});
|
|
919
|
+
|
|
920
|
+
const Ticks = ({
|
|
921
|
+
count,
|
|
922
|
+
width,
|
|
923
|
+
height
|
|
924
|
+
}) => {
|
|
925
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, range(1, count).map(r => {
|
|
926
|
+
return /*#__PURE__*/React.createElement(Tick, {
|
|
927
|
+
key: r,
|
|
928
|
+
value: r,
|
|
929
|
+
x: r * (width / count),
|
|
930
|
+
major: r % (count / 2) === 0,
|
|
931
|
+
minor: r % (count / 4) === 0,
|
|
932
|
+
bottom: height,
|
|
933
|
+
height: 10
|
|
934
|
+
});
|
|
935
|
+
}));
|
|
936
|
+
};
|
|
937
|
+
|
|
938
|
+
Ticks.propTypes = {
|
|
939
|
+
count: PropTypes.number.isRequired,
|
|
940
|
+
width: PropTypes.number.isRequired,
|
|
941
|
+
height: PropTypes.number.isRequired
|
|
942
|
+
};
|
|
943
|
+
class Unit extends React.Component {
|
|
944
|
+
render() {
|
|
945
|
+
const {
|
|
946
|
+
index,
|
|
947
|
+
width,
|
|
948
|
+
height,
|
|
949
|
+
classes,
|
|
950
|
+
last,
|
|
951
|
+
config
|
|
952
|
+
} = this.props;
|
|
953
|
+
const style = {
|
|
954
|
+
transform: `translate(${width * (index - 1)}px, 0px)`
|
|
955
|
+
};
|
|
956
|
+
return /*#__PURE__*/React.createElement("g", {
|
|
957
|
+
style: style
|
|
958
|
+
}, !last && /*#__PURE__*/React.createElement("line", {
|
|
959
|
+
x1: width,
|
|
960
|
+
y1: 0,
|
|
961
|
+
x2: width,
|
|
962
|
+
y2: height,
|
|
963
|
+
className: classes.endTick
|
|
964
|
+
}), /*#__PURE__*/React.createElement(Ticks, {
|
|
965
|
+
count: config.ticks,
|
|
966
|
+
width: width,
|
|
967
|
+
height: height
|
|
968
|
+
}), /*#__PURE__*/React.createElement("text", {
|
|
969
|
+
width: width,
|
|
970
|
+
className: classes.label,
|
|
971
|
+
x: width - 5,
|
|
972
|
+
y: 15
|
|
973
|
+
}, index));
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
}
|
|
977
|
+
Unit.propTypes = {
|
|
978
|
+
index: PropTypes.number.isRequired,
|
|
979
|
+
width: PropTypes.number.isRequired,
|
|
980
|
+
height: PropTypes.number.isRequired,
|
|
981
|
+
classes: PropTypes.object.isRequired,
|
|
982
|
+
last: PropTypes.bool.isRequired,
|
|
983
|
+
config: PropTypes.object.isRequired
|
|
984
|
+
};
|
|
985
|
+
var Unit$1 = withStyles(theme => ({
|
|
986
|
+
endTick: {
|
|
987
|
+
stroke: strokeColor(theme),
|
|
988
|
+
strokeWidth: 1
|
|
989
|
+
},
|
|
990
|
+
label: _extends({
|
|
991
|
+
textAnchor: 'end',
|
|
992
|
+
fontSize: '12px',
|
|
993
|
+
fill: strokeColor(theme)
|
|
994
|
+
}, noSelect()),
|
|
995
|
+
base: {
|
|
996
|
+
fill: 'none',
|
|
997
|
+
stroke: 'red'
|
|
998
|
+
}
|
|
999
|
+
}))(Unit);
|
|
1000
|
+
|
|
1001
|
+
const Bg = ({
|
|
1002
|
+
width,
|
|
1003
|
+
height,
|
|
1004
|
+
className
|
|
1005
|
+
}) => /*#__PURE__*/React.createElement("rect", {
|
|
1006
|
+
width: width,
|
|
1007
|
+
height: height,
|
|
1008
|
+
cx: 0,
|
|
1009
|
+
cy: 0,
|
|
1010
|
+
className: className
|
|
1011
|
+
});
|
|
1012
|
+
|
|
1013
|
+
Bg.propTypes = {
|
|
1014
|
+
width: PropTypes.number.isRequired,
|
|
1015
|
+
height: PropTypes.number.isRequired,
|
|
1016
|
+
className: PropTypes.string.isRequired
|
|
1017
|
+
};
|
|
1018
|
+
class Graphic extends React.PureComponent {
|
|
1019
|
+
render() {
|
|
1020
|
+
const {
|
|
1021
|
+
width,
|
|
1022
|
+
height,
|
|
1023
|
+
classes,
|
|
1024
|
+
units,
|
|
1025
|
+
unit
|
|
1026
|
+
} = this.props;
|
|
1027
|
+
const viewBox = `0 0 ${width} ${height}`;
|
|
1028
|
+
const unitWidth = width / units;
|
|
1029
|
+
const unitHeight = height;
|
|
1030
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
1031
|
+
viewBox: viewBox
|
|
1032
|
+
}, /*#__PURE__*/React.createElement(Bg, {
|
|
1033
|
+
width: width,
|
|
1034
|
+
height: height,
|
|
1035
|
+
className: classes.bg
|
|
1036
|
+
}), /*#__PURE__*/React.createElement(UnitType$1, {
|
|
1037
|
+
label: unit.type
|
|
1038
|
+
}), range(1, units + 1).map(r => /*#__PURE__*/React.createElement(Unit$1, {
|
|
1039
|
+
width: unitWidth,
|
|
1040
|
+
height: unitHeight,
|
|
1041
|
+
key: r,
|
|
1042
|
+
index: r,
|
|
1043
|
+
config: unit,
|
|
1044
|
+
last: r === units
|
|
1045
|
+
})));
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
}
|
|
1049
|
+
Graphic.propTypes = {
|
|
1050
|
+
width: PropTypes.number.isRequired,
|
|
1051
|
+
height: PropTypes.number.isRequired,
|
|
1052
|
+
units: PropTypes.number.isRequired,
|
|
1053
|
+
unit: PropTypes.object.isRequired,
|
|
1054
|
+
classes: PropTypes.object.isRequired
|
|
1055
|
+
};
|
|
1056
|
+
|
|
1057
|
+
const styles$1 = theme => ({
|
|
1058
|
+
bg: {
|
|
1059
|
+
stroke: strokeColor(theme),
|
|
1060
|
+
strokeWidth: '2px',
|
|
1061
|
+
fill: fillColor(theme)
|
|
1062
|
+
}
|
|
1063
|
+
});
|
|
1064
|
+
|
|
1065
|
+
var RulerGraphic = withStyles(styles$1)(Graphic);
|
|
1066
|
+
|
|
1067
|
+
class Ruler extends React.Component {
|
|
1068
|
+
render() {
|
|
1069
|
+
const {
|
|
1070
|
+
classes,
|
|
1071
|
+
width,
|
|
1072
|
+
height,
|
|
1073
|
+
units,
|
|
1074
|
+
measure,
|
|
1075
|
+
className,
|
|
1076
|
+
startPosition,
|
|
1077
|
+
label,
|
|
1078
|
+
tickCount
|
|
1079
|
+
} = this.props;
|
|
1080
|
+
const unit = measure === 'imperial' ? {
|
|
1081
|
+
type: label,
|
|
1082
|
+
ticks: tickCount && tickCount % 4 === 0 ? tickCount : 16
|
|
1083
|
+
} : {
|
|
1084
|
+
type: label,
|
|
1085
|
+
ticks: 10
|
|
1086
|
+
};
|
|
1087
|
+
return /*#__PURE__*/React.createElement(Rotatable$1, {
|
|
1088
|
+
className: className,
|
|
1089
|
+
startPosition: startPosition,
|
|
1090
|
+
handle: [{
|
|
1091
|
+
class: 'leftAnchor',
|
|
1092
|
+
origin: 'bottom right'
|
|
1093
|
+
}, {
|
|
1094
|
+
class: 'rightAnchor',
|
|
1095
|
+
origin: 'bottom left'
|
|
1096
|
+
}]
|
|
1097
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1098
|
+
className: classes.ruler,
|
|
1099
|
+
style: {
|
|
1100
|
+
width: `${width}px`,
|
|
1101
|
+
height: `${height}px`
|
|
1102
|
+
}
|
|
1103
|
+
}, /*#__PURE__*/React.createElement(RulerGraphic, {
|
|
1104
|
+
width: width,
|
|
1105
|
+
height: height,
|
|
1106
|
+
units: units,
|
|
1107
|
+
unit: unit
|
|
1108
|
+
}), /*#__PURE__*/React.createElement(Anchor$1, {
|
|
1109
|
+
className: classNames('leftAnchor', classes.leftAnchor)
|
|
1110
|
+
}), /*#__PURE__*/React.createElement(Anchor$1, {
|
|
1111
|
+
className: classNames('rightAnchor', classes.rightAnchor)
|
|
1112
|
+
})));
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
}
|
|
1116
|
+
Ruler.propTypes = {
|
|
1117
|
+
width: PropTypes.number,
|
|
1118
|
+
height: PropTypes.number,
|
|
1119
|
+
units: PropTypes.number.isRequired,
|
|
1120
|
+
measure: PropTypes.oneOf(['imperial', 'metric']).isRequired,
|
|
1121
|
+
classes: PropTypes.object.isRequired,
|
|
1122
|
+
className: PropTypes.string,
|
|
1123
|
+
startPosition: PropTypes.shape({
|
|
1124
|
+
left: PropTypes.number.isRequired,
|
|
1125
|
+
top: PropTypes.number.isRequired
|
|
1126
|
+
}),
|
|
1127
|
+
label: PropTypes.string,
|
|
1128
|
+
tickCount: PropTypes.number
|
|
1129
|
+
};
|
|
1130
|
+
Ruler.defaultProps = {
|
|
1131
|
+
width: 480,
|
|
1132
|
+
height: 60,
|
|
1133
|
+
measure: 'imperial',
|
|
1134
|
+
units: 12
|
|
1135
|
+
};
|
|
1136
|
+
|
|
1137
|
+
const styles = theme => ({
|
|
1138
|
+
ruler: {
|
|
1139
|
+
cursor: 'move',
|
|
1140
|
+
position: 'relative',
|
|
1141
|
+
backgroundColor: theme.palette.secondary.light,
|
|
1142
|
+
opacity: 1.0,
|
|
1143
|
+
border: `solid 0px ${theme.palette.primary.main}`
|
|
1144
|
+
},
|
|
1145
|
+
leftAnchor: {
|
|
1146
|
+
left: '-10px',
|
|
1147
|
+
top: '40%'
|
|
1148
|
+
},
|
|
1149
|
+
rightAnchor: {
|
|
1150
|
+
right: '-10px',
|
|
1151
|
+
top: '40%'
|
|
1152
|
+
}
|
|
1153
|
+
});
|
|
1154
|
+
|
|
1155
|
+
var index = withStyles(styles)(Ruler);
|
|
1156
|
+
|
|
1157
|
+
export { index$1 as Protractor, Rotatable$1 as Rotatable, index as Ruler, anchorUtils as utils };
|
|
1158
|
+
//# sourceMappingURL=index.js.map
|
package/esm/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/style-utils.js","../src/protractor/graphic.jsx","../src/anchor.jsx","../src/transform-origin.jsx","../src/anchor-utils.js","../src/rotatable.jsx","../src/protractor/index.jsx","../src/ruler/unit-type.jsx","../src/ruler/unit.jsx","../src/ruler/graphic.jsx","../src/ruler/index.jsx"],"sourcesContent":["import { noSelect } from '@pie-lib/style-utils';\n\nexport { noSelect };\n\nexport const strokeColor = (theme) => `var(--ruler-stroke, ${theme.palette.primary.main})`;\n\nexport const fillColor = (theme) => `var(--ruler-bg, ${theme.palette.primary.contrastText})`;\n","import React from 'react';\nimport { withStyles } from '@material-ui/core/styles';\nimport range from 'lodash/range';\nimport PropTypes from 'prop-types';\nimport { strokeColor, noSelect } from '../style-utils';\n\nconst Line = withStyles((theme) => ({\n line: {\n strokeWidth: '0.2',\n stroke: strokeColor(theme),\n },\n}))(({ angle, classes, major, minor }) => (\n <line\n transform={`rotate(${angle}, 50.5,50)`}\n className={classes.line}\n style={{}}\n x1=\"1\"\n x2={major ? 10 : minor ? 6 : 3}\n y1=\"50\"\n y2=\"50\"\n />\n));\n\nconst Spike = withStyles((theme) => ({\n line: {\n strokeWidth: '0.2',\n stroke: strokeColor(theme),\n },\n}))(({ angle, classes }) => (\n <line transform={`rotate(${angle}, 50.5,50)`} className={classes.line} style={{}} x1=\"15\" x2={'46'} y1=\"50\" y2=\"50\" />\n));\n\nconst Text = withStyles((theme) => ({\n text: {\n fontSize: '2.5px',\n textAnchor: 'middle',\n fill: strokeColor(theme),\n ...noSelect(),\n },\n}))(({ angle, classes }) => (\n <text transform={`rotate(${angle - 90}, 50.5, 50)`} className={classes.text} x=\"50\" y=\"12.5\">\n {angle}\n </text>\n));\n\nexport class Graphic extends React.PureComponent {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n };\n\n render() {\n const { classes } = this.props;\n return (\n <svg viewBox=\"0 0 102 61\">\n <path className={classes.path} d=\"M 1,50 A 1,1 0 0 1 100,50 L 100,60 L 1,60 Z\" fill=\"none\" />\n {range(0, 181).map((r) => (\n <Line minor={r % 5 === 0} major={r % 10 === 0} angle={r} key={r} />\n ))}\n {range(0, 181, 10).map((r) => (\n <React.Fragment key={r}>\n <Spike angle={r} />\n <Text angle={r} />\n </React.Fragment>\n ))}\n <circle r=\"4\" cx=\"50.5\" cy=\"50\" className={classes.circle} />\n <line className={classes.line} x1=\"48.5\" x2=\"52.5\" y1=\"50\" y2=\"50\" />\n <line className={classes.line} transform={'rotate(90 50.5 50)'} x1=\"48.5\" x2=\"52.5\" y1=\"50\" y2=\"50\" />\n </svg>\n );\n }\n}\n\nexport default withStyles((theme) => ({\n path: {\n strokeWidth: '0.2',\n stroke: strokeColor(theme),\n },\n line: {\n strokeWidth: '0.2',\n stroke: strokeColor(theme),\n },\n circle: {\n strokeWidth: '0.2',\n stroke: strokeColor(theme),\n fill: 'none',\n },\n}))(Graphic);\n","import React from 'react';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\n\nconst Anchor = withStyles((theme) => ({\n anchor: {\n cursor: 'pointer',\n width: '20px',\n height: '20px',\n position: 'absolute',\n borderRadius: '10px',\n backgroundColor: `var(--ruler-bg, ${theme.palette.primary.contrastText})`,\n transition: 'background-color 200ms ease-in',\n border: `solid 1px var(--ruler-stroke, ${theme.palette.primary.dark})`,\n '&:hover': {\n backgroundColor: `var(--ruler-bg-hover, ${theme.palette.primary.light})`,\n },\n },\n}))(({ classes, className }) => <div className={classNames(classes.anchor, className)} />);\n\nexport default Anchor;\n","const keyWordToPercent = (v) => {\n if (v === 'left' || v === 'top') {\n return 0;\n } else if (v === 'right' || v === 'bottom') {\n return 100;\n } else if (v === 'center') {\n return 50;\n } else if (v.endsWith('%')) {\n return parseFloat(v);\n } else {\n return v;\n }\n};\n\nconst getValue = (s, length) => {\n if (s.endsWith('px')) {\n return parseFloat(s);\n } else {\n s = keyWordToPercent(s);\n const v = length * (s / 100);\n return v;\n }\n};\n\nconst normalize = (a) => {\n if (a[0] === 'bottom' || a[0] === 'top' || a[1] === 'left' || a[1] === 'right') {\n return [a[1], a[0]];\n } else {\n return a;\n }\n};\n\n/**\n * Parse a transform origin string to x/y values.\n * @param {{width: number, height: number}} rect\n * @param {string} value\n * @returns {x:number, y:number}\n */\nexport const parse = (rect, value) => {\n if (!value) {\n return {\n x: rect.width / 2,\n y: rect.height / 2,\n };\n }\n const arr = value.split(' ');\n if (arr.length === 1) {\n //1 val\n const x = getValue(arr[0], rect.width);\n const y = getValue('50%', rect.height);\n return { x, y };\n } else if (arr.length === 2) {\n const sorted = normalize(arr);\n const x = getValue(sorted[0], rect.width);\n const y = getValue(sorted[1], rect.height);\n return { x, y };\n } else if (arr.length === 3) {\n throw new Error('transform-origin values with 3 fields not supported.');\n }\n};\n","import { trigCalculator } from 'trigonometry-calculator';\nimport Point from '@mapbox/point-geometry';\nimport debug from 'debug';\nimport { parse as parseOrigin } from './transform-origin';\nconst log = debug('@pie-lib:tools:anchor-utils');\n\nexport const toDegrees = (radians) => radians * (180 / Math.PI);\nexport const toRadians = (degrees) => degrees * (Math.PI / 180);\n\nexport const normalizeAngle = (a) => {\n if (a > 360) {\n return a % 360;\n } else if (a < 0) {\n return 360 + (a % 360);\n }\n return a;\n};\n\nexport const toPoint = (rect, edge) => {\n const out = parseOrigin(rect, edge);\n return new Point(out.x, out.y);\n};\n\n/**\n * Get the distance between to anchor points in a rect.\n * @param {{width: number, height: number}} rect - the rect\n * @param {number} degrees - the degrees\n * @param {string} from - from anchor\n * @param {string} to - to anchor\n * @returns {Point} point - the distance as a Point\n */\nexport const distanceBetween = (rect, degrees, from, to) => {\n const center = new Point(rect.width / 2, rect.height / 2);\n const radians = toRadians(degrees);\n const fromCenter = center.rotateAround(radians, toPoint(rect, from));\n const toCenter = center.rotateAround(radians, toPoint(rect, to));\n const diff = fromCenter.sub(toCenter);\n return diff;\n};\n\n/**\n * For a corner string, a point and a rect, return a relative x,y from that point to a corner.\n * Note that the y value descends as it goes down (unlike for a screen's y value), so this is only really useful for math functions.\n * @example\n * ```\n * getXAndY('top-left', {width: 100, height: 100}, 10, 10) //=> {x:10, y: -90}\n * ```\n * @param {*} corner\n * @param {*} rect\n * @param {*} point\n */\nexport const getXAndY = (corner, rect, point) => {\n if (corner === 'top-left') {\n const x = point.x * -1;\n const y = point.y;\n return { x, y };\n } else if (corner === 'bottom-left') {\n const x = point.x * -1;\n const y = point.y - rect.height;\n return { x, y };\n } else if (corner === 'top-right') {\n const x = rect.width - point.x;\n const y = point.y;\n return { x, y };\n } else if (corner === 'bottom-right') {\n const x = rect.width - point.x;\n const y = point.y - rect.height;\n return { x, y };\n }\n};\n\nexport const arctangent = (x, y) => toDegrees(Math.atan2(x, y));\n\nexport const getAngleAndHypotenuse = (corner, rect, point) => {\n const { x, y } = getXAndY(corner, rect, point);\n const degrees = arctangent(x, y);\n const hypotenuse = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));\n return { x, y, degrees, hypotenuse };\n};\n\nconst getPosition = (side, rect, point, angle, calcAngle) => {\n if (angle === 0) {\n return side === 'left' ? point.x : point.y;\n }\n const points = anglePoints(angle);\n const key = points[side];\n\n const { degrees, hypotenuse } = getAngleAndHypotenuse(key, rect, point);\n\n const ra = calcAngle(degrees);\n\n if (ra === 0) {\n return hypotenuse;\n }\n\n const t = {\n angles: { 0: ra, 1: 90 },\n sides: { 1: hypotenuse },\n };\n const out = trigCalculator(t);\n return out.sides[2];\n};\n\nexport const getTop = (rect, point, angle) => {\n return getPosition('top', rect, point, angle, (degrees) => {\n return Math.abs(angle + degrees);\n });\n};\n\nexport const getLeft = (rect, point, angle) => {\n return getPosition('left', rect, point, angle, (degrees) => {\n return Math.abs(angle + degrees + 90);\n });\n};\n\n/**\n * Calculate the position of an anchor within a bounding rect, if the source rect has been rotated by an angle.\n * It does this by finding the appropriate corner of the src rect, that touches the bounding rect, calculates\n * the hypotenuse (h) of that anchor to that point. Then using that plus the rotation it calculates\n * the sides of the triangle and returns the length of the side that touches the bounding rect.\n * @param {{width: number, height: number}} rect - the rect which contains the point\n * @param {{x:number, y: number}} point - the point within the rect\n * @param {number} angle - the angle in degrees that the rect has rotated.\n * @returns {{left: number, top: number}} position\n */\nexport const getAnchor = (rect, point, angle) => {\n log('[getAnchor] rect: ', rect, 'point:', point, 'angle: ', angle);\n if (point.x > rect.width) {\n throw new Error(`x: ${point.x} cannot be greater than width: ${rect.width}`);\n }\n if (point.y > rect.height) {\n throw new Error(`y: ${point.y} cannot be greater than height: ${rect.height}`);\n }\n const a = normalizeAngle(angle);\n const top = getTop(rect, point, a);\n const left = getLeft(rect, point, a);\n\n log('[getAnchor] top: ', top, 'left: ', left);\n return { top, left };\n};\n\nconst anglePoints = (angle) => {\n if (angle <= 90) {\n return { top: 'top-left', left: 'bottom-left' };\n } else if (angle > 90 && angle <= 180) {\n return { top: 'bottom-left', left: 'bottom-right' };\n } else if (angle > 180 && angle <= 270) {\n return { top: 'bottom-right', left: 'top-right' };\n } else if (angle > 270 && angle < 360) {\n return { top: 'top-right', left: 'top-left' };\n }\n};\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { getAnchor as calcAnchor, distanceBetween, arctangent } from './anchor-utils';\nimport { Portal } from 'react-portal';\nimport Point from '@mapbox/point-geometry';\nimport { parse as parseOrigin } from './transform-origin';\nimport classNames from 'classnames';\n\nconst Anchor = withStyles({\n anchor: {\n position: 'absolute',\n zIndex: 100,\n width: '200px',\n height: '80px',\n },\n})(({ classes, left, top, color, fill }) => {\n color = color || 'green';\n fill = fill || 'white';\n return (\n <Portal>\n <svg\n className={classes.anchor}\n style={{\n left: left - 10,\n top: top - 10,\n }}\n >\n <circle cx={10} cy={10} r={8} strokeWidth={1} stroke={color} fill={fill} />\n </svg>\n </Portal>\n );\n});\n\n/**\n * Tip o' the hat to:\n * https://bl.ocks.org/joyrexus/7207044\n */\nexport class Rotatable extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,\n showAnchor: PropTypes.bool,\n handle: PropTypes.arrayOf(\n PropTypes.shape({\n class: PropTypes.string.isRequired,\n origin: PropTypes.string,\n }),\n ),\n className: PropTypes.string,\n startPosition: PropTypes.shape({\n left: PropTypes.number,\n top: PropTypes.number,\n }),\n };\n\n static defaultProps = {\n showAnchor: false,\n startPosition: { left: 0, top: 0 },\n };\n\n constructor(props) {\n super(props);\n this.state = {\n isRotating: false,\n rotation: 0,\n startAngle: 0,\n angle: 0,\n position: {\n left: props.startPosition.left,\n top: props.startPosition.top,\n },\n };\n }\n\n componentWillUnmount() {\n document.removeEventListener('mouseup', this.rotateStop);\n document.removeEventListener('mousemove', this.drag);\n document.removeEventListener('mousemove', this.rotate);\n\n this.handles.forEach((h) => {\n h.el.removeEventListener('mousedown', h.mousedownHandler);\n h.el.removeEventListener('mouseup', this.rotateStop);\n });\n }\n\n componentDidMount() {\n this.addMouseUpHandler();\n this.initHandles();\n }\n\n initHandles = () => {\n const { handle } = this.props;\n\n if (Array.isArray(handle)) {\n this.handles = [];\n handle.forEach((h) => {\n const el = this.rotatable.querySelector(`.${h.class}`);\n\n if (el) {\n const mousedownHandler = this.rotateStart(h.origin);\n el.addEventListener('mousedown', mousedownHandler);\n el.addEventListener('mouseup', this.rotateStop);\n this.handles.push({ el, mousedownHandler });\n }\n });\n }\n };\n\n addMouseUpHandler = () => {\n document.addEventListener('mouseup', this.rotateStop);\n };\n\n originToXY = (origin) => {\n const { clientWidth: width, clientHeight: height } = this.rotatable;\n return parseOrigin({ width, height }, origin);\n };\n\n /**\n * Get the anchor point for the given element, origin and rotation.\n * @returns {{left:number, top: number}} - the co-ordinates of the anchor point relative to the whole page.\n */\n getAnchor = (origin) => {\n const { rotation } = this.state;\n const { clientWidth, clientHeight } = this.rotatable;\n const { top, left } = this.rotatable.getBoundingClientRect();\n const xy = this.originToXY(origin);\n const { top: anchorTop, left: anchorLeft } = calcAnchor(\n {\n width: clientWidth,\n height: clientHeight,\n },\n xy,\n rotation,\n );\n\n return {\n top: top + anchorTop,\n left: left + anchorLeft,\n };\n };\n\n rotateStart = (origin) => (e) => {\n const { isRotating } = this.state;\n if (isRotating) {\n return;\n }\n\n e.preventDefault();\n\n const anchor = this.getAnchor(origin);\n const { rotation } = this.state;\n const { angle: startAngle } = this.getAngle(anchor, e);\n\n let diff = { x: 0, y: 0 };\n if (origin !== this.state.origin) {\n const { clientWidth: width, clientHeight: height } = this.rotatable;\n diff = distanceBetween({ width, height }, rotation, this.state.origin, origin);\n }\n\n this.setState(\n {\n origin,\n isRotating: true,\n startAngle,\n anchor,\n position: {\n left: this.state.position.left + diff.x,\n top: this.state.position.top + diff.y,\n },\n },\n () => {\n document.addEventListener('mousemove', this.rotate);\n },\n );\n };\n\n rotateStop = (e) => {\n const { isRotating } = this.state;\n\n if (!isRotating) {\n return;\n }\n\n e.preventDefault();\n\n this.setState(\n {\n isRotating: false,\n angle: this.state.rotation,\n anchor: null,\n current: null,\n },\n () => {\n document.removeEventListener('mousemove', this.rotate);\n document.removeEventListener('mousemove', this.drag);\n },\n );\n };\n\n getAngle(anchor, e) {\n const x = e.clientX - anchor.left;\n const y = (e.clientY - anchor.top) * -1;\n return { angle: arctangent(x, y), x, y };\n }\n\n rotate = (e) => {\n const { isRotating } = this.state;\n if (!isRotating) {\n return;\n }\n\n e.preventDefault();\n\n const { startAngle, angle, anchor } = this.state;\n const { angle: current, x, y } = this.getAngle(anchor, e);\n const computedAnchor = { x, y };\n const diff = current - startAngle;\n const rotation = angle + diff;\n this.setState({ rotation, diff, current, computedAnchor });\n };\n\n mouseDown = (e) => {\n const handle = this.handles.find((h) => h.el === e.target);\n\n if (!handle) {\n this.dragStart(e);\n }\n };\n\n dragStart = (e) => {\n const dragPoint = new Point(e.pageX, e.pageY);\n this.setState({ dragPoint }, () => {\n document.addEventListener('mousemove', this.drag);\n });\n };\n\n drag = (e) => {\n e.preventDefault();\n const current = new Point(e.pageX, e.pageY);\n const translate = current.sub(this.state.dragPoint);\n this.setState({ translate });\n };\n\n mouseUp = () => {\n if (!this.state.translate) {\n return;\n }\n\n const { position: lastPosition, translate } = this.state;\n\n const position = {\n left: lastPosition.left + translate.x,\n top: lastPosition.top + translate.y,\n };\n\n document.removeEventListener('mousemove', this.drag);\n this.setState({ position, dragPoint: null, translate: null });\n };\n\n render() {\n const { children, classes, showAnchor, className } = this.props;\n const { rotation, anchor, origin, translate, position } = this.state;\n\n const t = translate ? `translate(${translate.x}px, ${translate.y}px)` : '';\n\n const style = {\n left: position.left,\n top: position.top,\n transformOrigin: origin,\n transform: `${t} rotate(${rotation}deg)`,\n };\n\n return (\n <div\n className={classNames(classes.rotatable, className)}\n style={style}\n ref={(r) => (this.rotatable = r)}\n onMouseDown={this.mouseDown}\n onMouseUp={this.mouseUp}\n >\n {anchor && showAnchor && <Anchor {...anchor} />}\n {children}\n </div>\n );\n }\n}\n\nexport default withStyles({\n rotatable: {\n position: 'relative',\n display: 'inline-block',\n cursor: 'move',\n },\n})(Rotatable);\n","import React from 'react';\nimport { withStyles } from '@material-ui/core/styles';\nimport PropTypes from 'prop-types';\nimport Graphic from './graphic';\nimport Anchor from '../anchor';\nimport Rotatable from '../rotatable';\nimport classNames from 'classnames';\n\nexport class Protractor extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n width: PropTypes.number.isRequired,\n className: PropTypes.string,\n startPosition: PropTypes.shape({\n left: PropTypes.number,\n top: PropTypes.number,\n }),\n };\n\n static defaultProps = {\n width: 450,\n startPosition: { left: 0, top: 0 },\n };\n\n render() {\n const { classes, width, className, startPosition } = this.props;\n return (\n <Rotatable\n className={className}\n startPosition={startPosition}\n handle={[\n {\n class: 'leftAnchor',\n origin: `${width * 0.495}px ${width * 0.49}px`,\n },\n {\n class: 'rightAnchor',\n origin: `${width * 0.495}px ${width * 0.49}px`,\n },\n ]}\n >\n <div className={classes.protractor} style={{ width: `${width}px` }}>\n <Graphic />\n\n <Anchor className={classNames('leftAnchor', classes.leftAnchor)} />\n <Anchor className={classNames('rightAnchor', classes.rightAnchor)} />\n </div>\n </Rotatable>\n );\n }\n}\n\nexport default withStyles(() => ({\n protractor: { position: 'relative' },\n leftAnchor: {\n position: 'absolute',\n left: 0,\n bottom: 0,\n },\n rightAnchor: {\n position: 'absolute',\n right: 0,\n bottom: 0,\n },\n}))(Protractor);\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport { noSelect, strokeColor } from '../style-utils';\nimport { withStyles } from '@material-ui/core/styles';\n\nexport const UnitType = (props) => {\n const { classes, label, x, y, textAlign, fill, fontSize, stroke } = props;\n\n return (\n <text\n className={classes.unitType}\n x={x}\n y={y}\n textAnchor={textAlign}\n stroke={stroke}\n fill={fill}\n fontSize={fontSize}\n >\n {label}\n </text>\n );\n};\n\nUnitType.propTypes = {\n classes: PropTypes.object.isRequired,\n label: PropTypes.string.isRequired,\n x: PropTypes.number,\n y: PropTypes.number,\n textAlign: PropTypes.string,\n fill: PropTypes.string,\n fontSize: PropTypes.number,\n stroke: PropTypes.string,\n};\n\nUnitType.defaultProps = {\n textAnchor: 'start',\n fontSize: 11,\n stroke: 'none',\n x: 8,\n y: 14,\n};\n\nexport default withStyles((theme) => ({\n unitType: { ...noSelect(), fill: strokeColor(theme) },\n}))(UnitType);\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { noSelect, strokeColor } from '../style-utils';\nimport range from 'lodash/range';\n\nconst Tick = withStyles((theme) => ({\n tick: {\n stroke: strokeColor(theme),\n },\n}))(({ x, height, bottom, classes, major, minor }) => {\n const y1 = major ? bottom - height * 2 : minor ? bottom - height * 1.5 : bottom - height;\n\n return <line y1={y1} y2={bottom} x1={x} x2={x} className={classes.tick} />;\n});\n\nconst Ticks = ({ count, width, height }) => {\n return (\n <React.Fragment>\n {range(1, count).map((r) => {\n return (\n <Tick\n key={r}\n value={r}\n x={r * (width / count)}\n major={r % (count / 2) === 0}\n minor={r % (count / 4) === 0}\n bottom={height}\n height={10}\n />\n );\n })}\n </React.Fragment>\n );\n};\n\nTicks.propTypes = {\n count: PropTypes.number.isRequired,\n width: PropTypes.number.isRequired,\n height: PropTypes.number.isRequired,\n};\n\nexport class Unit extends React.Component {\n static propTypes = {\n index: PropTypes.number.isRequired,\n width: PropTypes.number.isRequired,\n height: PropTypes.number.isRequired,\n classes: PropTypes.object.isRequired,\n last: PropTypes.bool.isRequired,\n config: PropTypes.object.isRequired,\n };\n\n render() {\n const { index, width, height, classes, last, config } = this.props;\n\n const style = {\n transform: `translate(${width * (index - 1)}px, 0px)`,\n };\n return (\n <g style={style}>\n {!last && <line x1={width} y1={0} x2={width} y2={height} className={classes.endTick} />}\n\n <Ticks count={config.ticks} width={width} height={height} />\n <text width={width} className={classes.label} x={width - 5} y={15}>\n {index}\n </text>\n </g>\n );\n }\n}\n\nexport default withStyles((theme) => ({\n endTick: {\n stroke: strokeColor(theme),\n strokeWidth: 1,\n },\n label: {\n textAnchor: 'end',\n fontSize: '12px',\n fill: strokeColor(theme),\n ...noSelect(),\n },\n base: {\n fill: 'none',\n stroke: 'red',\n },\n}))(Unit);\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport UnitType from './unit-type';\nimport range from 'lodash/range';\nimport Unit from './unit';\nimport { strokeColor, fillColor } from '../style-utils';\n\nconst Bg = ({ width, height, className }) => <rect width={width} height={height} cx={0} cy={0} className={className} />;\n\nBg.propTypes = {\n width: PropTypes.number.isRequired,\n height: PropTypes.number.isRequired,\n className: PropTypes.string.isRequired,\n};\n\nexport class Graphic extends React.PureComponent {\n static propTypes = {\n width: PropTypes.number.isRequired,\n height: PropTypes.number.isRequired,\n units: PropTypes.number.isRequired,\n unit: PropTypes.object.isRequired,\n classes: PropTypes.object.isRequired,\n };\n\n render() {\n const { width, height, classes, units, unit } = this.props;\n const viewBox = `0 0 ${width} ${height}`;\n const unitWidth = width / units;\n const unitHeight = height;\n\n return (\n <svg viewBox={viewBox}>\n <Bg width={width} height={height} className={classes.bg} />\n <UnitType label={unit.type} />\n {range(1, units + 1).map((r) => (\n <Unit width={unitWidth} height={unitHeight} key={r} index={r} config={unit} last={r === units} />\n ))}\n </svg>\n );\n }\n}\nconst styles = (theme) => ({\n bg: {\n stroke: strokeColor(theme),\n strokeWidth: '2px',\n fill: fillColor(theme),\n },\n});\n\nexport default withStyles(styles)(Graphic);\n","import React from 'react';\nimport { withStyles } from '@material-ui/core/styles';\nimport Rotatable from '../rotatable';\nimport classNames from 'classnames';\nimport RulerGraphic from './graphic';\nimport PropTypes from 'prop-types';\nimport Anchor from '../anchor';\n\nexport class Ruler extends React.Component {\n static propTypes = {\n width: PropTypes.number,\n height: PropTypes.number,\n units: PropTypes.number.isRequired,\n measure: PropTypes.oneOf(['imperial', 'metric']).isRequired,\n classes: PropTypes.object.isRequired,\n className: PropTypes.string,\n startPosition: PropTypes.shape({\n left: PropTypes.number.isRequired,\n top: PropTypes.number.isRequired,\n }),\n label: PropTypes.string,\n tickCount: PropTypes.number,\n };\n\n static defaultProps = {\n width: 480,\n height: 60,\n measure: 'imperial',\n units: 12,\n };\n\n render() {\n const { classes, width, height, units, measure, className, startPosition, label, tickCount } = this.props;\n\n const unit =\n measure === 'imperial'\n ? {\n type: label,\n ticks: tickCount && tickCount % 4 === 0 ? tickCount : 16,\n }\n : {\n type: label,\n ticks: 10,\n };\n return (\n <Rotatable\n className={className}\n startPosition={startPosition}\n handle={[\n { class: 'leftAnchor', origin: 'bottom right' },\n { class: 'rightAnchor', origin: 'bottom left' },\n ]}\n >\n <div className={classes.ruler} style={{ width: `${width}px`, height: `${height}px` }}>\n <RulerGraphic width={width} height={height} units={units} unit={unit} />\n <Anchor className={classNames('leftAnchor', classes.leftAnchor)} />\n <Anchor className={classNames('rightAnchor', classes.rightAnchor)} />\n </div>\n </Rotatable>\n );\n }\n}\nconst styles = (theme) => ({\n ruler: {\n cursor: 'move',\n position: 'relative',\n backgroundColor: theme.palette.secondary.light,\n opacity: 1.0,\n border: `solid 0px ${theme.palette.primary.main}`,\n },\n leftAnchor: {\n left: '-10px',\n top: '40%',\n },\n rightAnchor: {\n right: '-10px',\n top: '40%',\n },\n});\n\nexport default withStyles(styles)(Ruler);\n"],"names":["strokeColor","theme","palette","primary","main","fillColor","contrastText","Line","withStyles","line","strokeWidth","stroke","angle","classes","major","minor","Spike","Text","text","fontSize","textAnchor","fill","noSelect","Graphic","React","PureComponent","render","props","path","range","map","r","circle","propTypes","PropTypes","object","isRequired","Anchor","anchor","cursor","width","height","position","borderRadius","backgroundColor","transition","border","dark","light","className","classNames","keyWordToPercent","v","endsWith","parseFloat","getValue","s","length","normalize","a","parse","rect","value","x","y","arr","split","sorted","Error","log","debug","toDegrees","radians","Math","PI","toRadians","degrees","normalizeAngle","toPoint","edge","out","parseOrigin","Point","distanceBetween","from","to","center","fromCenter","rotateAround","toCenter","diff","sub","getXAndY","corner","point","arctangent","atan2","getAngleAndHypotenuse","hypotenuse","sqrt","pow","getPosition","side","calcAngle","points","anglePoints","key","ra","t","angles","sides","trigCalculator","getTop","abs","getLeft","getAnchor","top","left","zIndex","color","Rotatable","Component","constructor","initHandles","handle","Array","isArray","handles","forEach","h","el","rotatable","querySelector","class","mousedownHandler","rotateStart","origin","addEventListener","rotateStop","push","addMouseUpHandler","document","originToXY","clientWidth","clientHeight","rotation","state","getBoundingClientRect","xy","anchorTop","anchorLeft","calcAnchor","e","isRotating","preventDefault","startAngle","getAngle","setState","rotate","current","removeEventListener","drag","computedAnchor","mouseDown","find","target","dragStart","dragPoint","pageX","pageY","translate","mouseUp","lastPosition","startPosition","componentWillUnmount","componentDidMount","clientX","clientY","children","showAnchor","style","transformOrigin","transform","oneOfType","arrayOf","node","bool","shape","string","number","defaultProps","display","Protractor","protractor","leftAnchor","rightAnchor","bottom","right","UnitType","label","textAlign","unitType","Tick","tick","y1","Ticks","count","Unit","index","last","config","endTick","ticks","base","Bg","units","unit","viewBox","unitWidth","unitHeight","bg","type","styles","Ruler","measure","tickCount","ruler","oneOf","secondary","opacity"],"mappings":";;;;;;;;;;;;;;;;;;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;AAZJ;AADRkC,MAgBJjC,eAAe;AACpBtJ,EAAAA,KAAK,EAAE,GADa;AAEpBC,EAAAA,MAAM,EAAE,EAFY;AAGpBuL,EAAAA,OAAO,EAAE,UAHW;AAIpBT,EAAAA,KAAK,EAAE;AAJa;;AAsCxB,MAAMO,MAAM,GAAI7N,KAAD,KAAY;AACzBiO,EAAAA,KAAK,EAAE;AACL3L,IAAAA,MAAM,EAAE,MADH;AAELG,IAAAA,QAAQ,EAAE,UAFL;AAGLE,IAAAA,eAAe,EAAE3C,KAAK,CAACC,OAAN,CAAckO,SAAd,CAAwBpL,KAHpC;AAILqL,IAAAA,OAAO,EAAE,GAJJ;AAKLvL,IAAAA,MAAM,EAAG,CAAA,UAAA,EAAY7C,KAAK,CAACC,OAAN,CAAcC,OAAd,CAAsBC,IAAK,CAAA;AAL3C,GADkB;AAQzB8L,EAAAA,UAAU,EAAE;AACV7E,IAAAA,IAAI,EAAE,OADI;AAEVD,IAAAA,GAAG,EAAE;AAFK,GARa;AAYzB+E,EAAAA,WAAW,EAAE;AACXE,IAAAA,KAAK,EAAE,OADI;AAEXjF,IAAAA,GAAG,EAAE;AAFM;AAZY,CAAZ,CAAf;;AAkBA,YAAe5G,UAAU,CAACsN,MAAD,CAAV,CAAmBC,KAAnB,CAAf;;;;"}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.26.2",
|
|
7
7
|
"description": "Some interactive tools",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"react",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"license": "ISC",
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@mapbox/point-geometry": "^0.1.0",
|
|
21
|
-
"@pie-lib/style-utils": "^0.
|
|
21
|
+
"@pie-lib/style-utils": "^0.18.2",
|
|
22
22
|
"assert": "^1.4.1",
|
|
23
23
|
"classnames": "^2.2.6",
|
|
24
24
|
"debug": "^4.1.1",
|
|
@@ -37,5 +37,12 @@
|
|
|
37
37
|
"@material-ui/core": "^3.8.3",
|
|
38
38
|
"react": "^16.8.1"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "8a327571bd64249e4c88c0c8e750d16d6213f535",
|
|
41
|
+
"exports": {
|
|
42
|
+
".": {
|
|
43
|
+
"import": "./esm/index.js",
|
|
44
|
+
"require": "./lib/index.js",
|
|
45
|
+
"default": "./esm/index.js"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
41
48
|
}
|
package/LICENSE.md
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
Copyright 2019 CoreSpring Inc
|
|
2
|
-
|
|
3
|
-
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
|
4
|
-
|
|
5
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|