@pie-lib/tools 0.12.0 → 0.14.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 +24 -52
- package/package.json +3 -3
- package/lib/anchor-utils.js +0 -249
- package/lib/anchor-utils.js.map +0 -1
- package/lib/anchor.js +0 -41
- package/lib/anchor.js.map +0 -1
- package/lib/index.js +0 -43
- package/lib/index.js.map +0 -1
- package/lib/protractor/graphic.js +0 -184
- package/lib/protractor/graphic.js.map +0 -1
- package/lib/protractor/index.js +0 -120
- package/lib/protractor/index.js.map +0 -1
- package/lib/rotatable.js +0 -403
- package/lib/rotatable.js.map +0 -1
- package/lib/ruler/graphic.js +0 -126
- package/lib/ruler/graphic.js.map +0 -1
- package/lib/ruler/index.js +0 -146
- package/lib/ruler/index.js.map +0 -1
- package/lib/ruler/unit-type.js +0 -72
- package/lib/ruler/unit-type.js.map +0 -1
- package/lib/ruler/unit.js +0 -161
- package/lib/ruler/unit.js.map +0 -1
- package/lib/style-utils.js +0 -28
- package/lib/style-utils.js.map +0 -1
- package/lib/transform-origin.js +0 -82
- package/lib/transform-origin.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
# [0.
|
|
6
|
+
# [0.14.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/tools@0.9.36...@pie-lib/tools@0.14.0) (2025-07-31)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @pie-lib/tools
|
|
9
9
|
|
|
@@ -11,7 +11,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
# [0.
|
|
14
|
+
# [0.13.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/tools@0.9.36...@pie-lib/tools@0.13.0) (2025-07-31)
|
|
15
15
|
|
|
16
16
|
**Note:** Version bump only for package @pie-lib/tools
|
|
17
17
|
|
|
@@ -19,7 +19,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
# [0.
|
|
22
|
+
# [0.12.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/tools@0.9.36...@pie-lib/tools@0.12.0) (2025-07-31)
|
|
23
23
|
|
|
24
24
|
**Note:** Version bump only for package @pie-lib/tools
|
|
25
25
|
|
|
@@ -27,7 +27,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
# [0.
|
|
30
|
+
# [0.13.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/tools@0.9.36...@pie-lib/tools@0.13.0) (2025-07-31)
|
|
31
31
|
|
|
32
32
|
**Note:** Version bump only for package @pie-lib/tools
|
|
33
33
|
|
|
@@ -35,7 +35,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
# [0.
|
|
38
|
+
# [0.12.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/tools@0.9.36...@pie-lib/tools@0.12.0) (2025-07-31)
|
|
39
39
|
|
|
40
40
|
**Note:** Version bump only for package @pie-lib/tools
|
|
41
41
|
|
|
@@ -43,7 +43,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
# [0.
|
|
46
|
+
# [0.11.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/tools@0.9.36...@pie-lib/tools@0.11.0) (2025-07-31)
|
|
47
47
|
|
|
48
48
|
**Note:** Version bump only for package @pie-lib/tools
|
|
49
49
|
|
|
@@ -51,118 +51,90 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
|
|
54
|
-
# [0.
|
|
54
|
+
# [0.11.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/tools@0.9.36...@pie-lib/tools@0.11.0) (2025-07-31)
|
|
55
55
|
|
|
56
56
|
**Note:** Version bump only for package @pie-lib/tools
|
|
57
57
|
|
|
58
|
+
# [0.12.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/tools@0.9.36...@pie-lib/tools@0.12.0) (2025-07-31)
|
|
58
59
|
|
|
60
|
+
**Note:** Version bump only for package @pie-lib/tools
|
|
59
61
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
# [0.10.0-beta.5](https://github.com/pie-framework/pie-lib/compare/@pie-lib/tools@0.9.36...@pie-lib/tools@0.10.0-beta.5) (2025-07-25)
|
|
62
|
+
# [0.11.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/tools@0.9.36...@pie-lib/tools@0.11.0) (2025-07-31)
|
|
63
63
|
|
|
64
64
|
**Note:** Version bump only for package @pie-lib/tools
|
|
65
65
|
|
|
66
|
+
# [0.10.0-beta.8](https://github.com/pie-framework/pie-lib/compare/@pie-lib/tools@0.9.36...@pie-lib/tools@0.10.0-beta.8) (2025-07-25)
|
|
66
67
|
|
|
68
|
+
**Note:** Version bump only for package @pie-lib/tools
|
|
67
69
|
|
|
70
|
+
# [0.10.0-beta.7](https://github.com/pie-framework/pie-lib/compare/@pie-lib/tools@0.9.36...@pie-lib/tools@0.10.0-beta.7) (2025-07-25)
|
|
68
71
|
|
|
72
|
+
**Note:** Version bump only for package @pie-lib/tools
|
|
69
73
|
|
|
70
|
-
# [0.10.0-beta.
|
|
74
|
+
# [0.10.0-beta.7](https://github.com/pie-framework/pie-lib/compare/@pie-lib/tools@0.9.36...@pie-lib/tools@0.10.0-beta.7) (2025-07-25)
|
|
71
75
|
|
|
72
76
|
**Note:** Version bump only for package @pie-lib/tools
|
|
73
77
|
|
|
78
|
+
# [0.10.0-beta.6](https://github.com/pie-framework/pie-lib/compare/@pie-lib/tools@0.9.36...@pie-lib/tools@0.10.0-beta.6) (2025-07-25)
|
|
74
79
|
|
|
80
|
+
**Note:** Version bump only for package @pie-lib/tools
|
|
75
81
|
|
|
82
|
+
# [0.10.0-beta.6](https://github.com/pie-framework/pie-lib/compare/@pie-lib/tools@0.9.36...@pie-lib/tools@0.10.0-beta.6) (2025-07-25)
|
|
76
83
|
|
|
84
|
+
**Note:** Version bump only for package @pie-lib/tools
|
|
77
85
|
|
|
78
|
-
# [0.10.0-beta.
|
|
86
|
+
# [0.10.0-beta.5](https://github.com/pie-framework/pie-lib/compare/@pie-lib/tools@0.9.36...@pie-lib/tools@0.10.0-beta.5) (2025-07-25)
|
|
79
87
|
|
|
80
88
|
**Note:** Version bump only for package @pie-lib/tools
|
|
81
89
|
|
|
90
|
+
# [0.10.0-beta.5](https://github.com/pie-framework/pie-lib/compare/@pie-lib/tools@0.9.36...@pie-lib/tools@0.10.0-beta.5) (2025-07-25)
|
|
82
91
|
|
|
92
|
+
**Note:** Version bump only for package @pie-lib/tools
|
|
83
93
|
|
|
94
|
+
# [0.10.0-beta.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/tools@0.9.36...@pie-lib/tools@0.10.0-beta.4) (2025-07-25)
|
|
84
95
|
|
|
96
|
+
**Note:** Version bump only for package @pie-lib/tools
|
|
85
97
|
|
|
86
98
|
# [0.10.0-beta.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/tools@0.9.36...@pie-lib/tools@0.10.0-beta.3) (2025-07-25)
|
|
87
99
|
|
|
88
100
|
**Note:** Version bump only for package @pie-lib/tools
|
|
89
101
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
102
|
# [0.10.0-beta.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/tools@0.9.36...@pie-lib/tools@0.10.0-beta.4) (2025-07-23)
|
|
95
103
|
|
|
96
104
|
**Note:** Version bump only for package @pie-lib/tools
|
|
97
105
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
106
|
# [0.10.0-beta.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/tools@0.9.36...@pie-lib/tools@0.10.0-beta.3) (2025-07-23)
|
|
103
107
|
|
|
104
108
|
**Note:** Version bump only for package @pie-lib/tools
|
|
105
109
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
110
|
# [0.10.0-beta.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/tools@0.9.36...@pie-lib/tools@0.10.0-beta.3) (2025-07-20)
|
|
111
111
|
|
|
112
112
|
**Note:** Version bump only for package @pie-lib/tools
|
|
113
113
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
114
|
# [0.10.0-beta.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/tools@0.9.36...@pie-lib/tools@0.10.0-beta.2) (2025-07-20)
|
|
119
115
|
|
|
120
116
|
**Note:** Version bump only for package @pie-lib/tools
|
|
121
117
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
118
|
# [0.10.0-beta.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/tools@0.9.36...@pie-lib/tools@0.10.0-beta.1) (2025-07-20)
|
|
127
119
|
|
|
128
120
|
**Note:** Version bump only for package @pie-lib/tools
|
|
129
121
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
122
|
# [0.10.0-beta.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/tools@0.9.36...@pie-lib/tools@0.10.0-beta.2) (2025-07-20)
|
|
135
123
|
|
|
136
124
|
**Note:** Version bump only for package @pie-lib/tools
|
|
137
125
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
126
|
# [0.10.0-beta.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/tools@0.9.36...@pie-lib/tools@0.10.0-beta.1) (2025-07-20)
|
|
143
127
|
|
|
144
128
|
**Note:** Version bump only for package @pie-lib/tools
|
|
145
129
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
130
|
# [0.10.0-beta.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/tools@0.9.36...@pie-lib/tools@0.10.0-beta.1) (2025-07-20)
|
|
151
131
|
|
|
152
132
|
**Note:** Version bump only for package @pie-lib/tools
|
|
153
133
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
134
|
# [0.10.0-beta.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/tools@0.9.36...@pie-lib/tools@0.10.0-beta.0) (2025-07-20)
|
|
159
135
|
|
|
160
136
|
**Note:** Version bump only for package @pie-lib/tools
|
|
161
137
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
138
|
# [0.11.0-beta.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/tools@0.9.36...@pie-lib/tools@0.11.0-beta.0) (2025-07-15)
|
|
167
139
|
|
|
168
140
|
**Note:** Version bump only for package @pie-lib/tools
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.14.0",
|
|
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": "
|
|
21
|
+
"@pie-lib/style-utils": "^0.6.0",
|
|
22
22
|
"assert": "^1.4.1",
|
|
23
23
|
"classnames": "^2.2.6",
|
|
24
24
|
"debug": "^4.1.1",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"@material-ui/core": "^3.8.3",
|
|
38
38
|
"react": "^16.8.1"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "889a13bfea2c768b8a3a6eabfc6fe7b7725aa832"
|
|
41
41
|
}
|
package/lib/anchor-utils.js
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.toRadians = exports.toPoint = exports.toDegrees = exports.normalizeAngle = exports.getXAndY = exports.getTop = exports.getLeft = exports.getAngleAndHypotenuse = exports.getAnchor = exports.distanceBetween = exports.arctangent = void 0;
|
|
9
|
-
|
|
10
|
-
var _trigonometryCalculator = require("trigonometry-calculator");
|
|
11
|
-
|
|
12
|
-
var _pointGeometry = _interopRequireDefault(require("@mapbox/point-geometry"));
|
|
13
|
-
|
|
14
|
-
var _debug = _interopRequireDefault(require("debug"));
|
|
15
|
-
|
|
16
|
-
var _transformOrigin = require("./transform-origin");
|
|
17
|
-
|
|
18
|
-
var log = (0, _debug["default"])('@pie-lib:tools:anchor-utils');
|
|
19
|
-
|
|
20
|
-
var toDegrees = function toDegrees(radians) {
|
|
21
|
-
return radians * (180 / Math.PI);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
exports.toDegrees = toDegrees;
|
|
25
|
-
|
|
26
|
-
var toRadians = function toRadians(degrees) {
|
|
27
|
-
return degrees * (Math.PI / 180);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
exports.toRadians = toRadians;
|
|
31
|
-
|
|
32
|
-
var normalizeAngle = function normalizeAngle(a) {
|
|
33
|
-
if (a > 360) {
|
|
34
|
-
return a % 360;
|
|
35
|
-
} else if (a < 0) {
|
|
36
|
-
return 360 + a % 360;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return a;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
exports.normalizeAngle = normalizeAngle;
|
|
43
|
-
|
|
44
|
-
var toPoint = function toPoint(rect, edge) {
|
|
45
|
-
var out = (0, _transformOrigin.parse)(rect, edge);
|
|
46
|
-
return new _pointGeometry["default"](out.x, out.y);
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Get the distance between to anchor points in a rect.
|
|
50
|
-
* @param {{width: number, height: number}} rect - the rect
|
|
51
|
-
* @param {number} degrees - the degrees
|
|
52
|
-
* @param {string} from - from anchor
|
|
53
|
-
* @param {string} to - to anchor
|
|
54
|
-
* @returns {Point} point - the distance as a Point
|
|
55
|
-
*/
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
exports.toPoint = toPoint;
|
|
59
|
-
|
|
60
|
-
var distanceBetween = function distanceBetween(rect, degrees, from, to) {
|
|
61
|
-
var center = new _pointGeometry["default"](rect.width / 2, rect.height / 2);
|
|
62
|
-
var radians = toRadians(degrees);
|
|
63
|
-
var fromCenter = center.rotateAround(radians, toPoint(rect, from));
|
|
64
|
-
var toCenter = center.rotateAround(radians, toPoint(rect, to));
|
|
65
|
-
var diff = fromCenter.sub(toCenter);
|
|
66
|
-
return diff;
|
|
67
|
-
};
|
|
68
|
-
/**
|
|
69
|
-
* For a corner string, a point and a rect, return a relative x,y from that point to a corner.
|
|
70
|
-
* 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.
|
|
71
|
-
* @example
|
|
72
|
-
* ```
|
|
73
|
-
* getXAndY('top-left', {width: 100, height: 100}, 10, 10) //=> {x:10, y: -90}
|
|
74
|
-
* ```
|
|
75
|
-
* @param {*} corner
|
|
76
|
-
* @param {*} rect
|
|
77
|
-
* @param {*} point
|
|
78
|
-
*/
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
exports.distanceBetween = distanceBetween;
|
|
82
|
-
|
|
83
|
-
var getXAndY = function getXAndY(corner, rect, point) {
|
|
84
|
-
if (corner === 'top-left') {
|
|
85
|
-
var x = point.x * -1;
|
|
86
|
-
var y = point.y;
|
|
87
|
-
return {
|
|
88
|
-
x: x,
|
|
89
|
-
y: y
|
|
90
|
-
};
|
|
91
|
-
} else if (corner === 'bottom-left') {
|
|
92
|
-
var _x = point.x * -1;
|
|
93
|
-
|
|
94
|
-
var _y = point.y - rect.height;
|
|
95
|
-
|
|
96
|
-
return {
|
|
97
|
-
x: _x,
|
|
98
|
-
y: _y
|
|
99
|
-
};
|
|
100
|
-
} else if (corner === 'top-right') {
|
|
101
|
-
var _x2 = rect.width - point.x;
|
|
102
|
-
|
|
103
|
-
var _y2 = point.y;
|
|
104
|
-
return {
|
|
105
|
-
x: _x2,
|
|
106
|
-
y: _y2
|
|
107
|
-
};
|
|
108
|
-
} else if (corner === 'bottom-right') {
|
|
109
|
-
var _x3 = rect.width - point.x;
|
|
110
|
-
|
|
111
|
-
var _y3 = point.y - rect.height;
|
|
112
|
-
|
|
113
|
-
return {
|
|
114
|
-
x: _x3,
|
|
115
|
-
y: _y3
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
exports.getXAndY = getXAndY;
|
|
121
|
-
|
|
122
|
-
var arctangent = function arctangent(x, y) {
|
|
123
|
-
return toDegrees(Math.atan2(x, y));
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
exports.arctangent = arctangent;
|
|
127
|
-
|
|
128
|
-
var getAngleAndHypotenuse = function getAngleAndHypotenuse(corner, rect, point) {
|
|
129
|
-
var _getXAndY = getXAndY(corner, rect, point),
|
|
130
|
-
x = _getXAndY.x,
|
|
131
|
-
y = _getXAndY.y;
|
|
132
|
-
|
|
133
|
-
var degrees = arctangent(x, y);
|
|
134
|
-
var hypotenuse = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
|
|
135
|
-
return {
|
|
136
|
-
x: x,
|
|
137
|
-
y: y,
|
|
138
|
-
degrees: degrees,
|
|
139
|
-
hypotenuse: hypotenuse
|
|
140
|
-
};
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
exports.getAngleAndHypotenuse = getAngleAndHypotenuse;
|
|
144
|
-
|
|
145
|
-
var getPosition = function getPosition(side, rect, point, angle, calcAngle) {
|
|
146
|
-
if (angle === 0) {
|
|
147
|
-
return side === 'left' ? point.x : point.y;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
var points = anglePoints(angle);
|
|
151
|
-
var key = points[side];
|
|
152
|
-
|
|
153
|
-
var _getAngleAndHypotenus = getAngleAndHypotenuse(key, rect, point),
|
|
154
|
-
degrees = _getAngleAndHypotenus.degrees,
|
|
155
|
-
hypotenuse = _getAngleAndHypotenus.hypotenuse;
|
|
156
|
-
|
|
157
|
-
var ra = calcAngle(degrees);
|
|
158
|
-
|
|
159
|
-
if (ra === 0) {
|
|
160
|
-
return hypotenuse;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
var t = {
|
|
164
|
-
angles: {
|
|
165
|
-
0: ra,
|
|
166
|
-
1: 90
|
|
167
|
-
},
|
|
168
|
-
sides: {
|
|
169
|
-
1: hypotenuse
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
var out = (0, _trigonometryCalculator.trigCalculator)(t);
|
|
173
|
-
return out.sides[2];
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
var getTop = function getTop(rect, point, angle) {
|
|
177
|
-
return getPosition('top', rect, point, angle, function (degrees) {
|
|
178
|
-
return Math.abs(angle + degrees);
|
|
179
|
-
});
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
exports.getTop = getTop;
|
|
183
|
-
|
|
184
|
-
var getLeft = function getLeft(rect, point, angle) {
|
|
185
|
-
return getPosition('left', rect, point, angle, function (degrees) {
|
|
186
|
-
return Math.abs(angle + degrees + 90);
|
|
187
|
-
});
|
|
188
|
-
};
|
|
189
|
-
/**
|
|
190
|
-
* Calculate the position of an anchor within a bounding rect, if the source rect has been rotated by an angle.
|
|
191
|
-
* It does this by finding the appropriate corner of the src rect, that touches the bounding rect, calculates
|
|
192
|
-
* the hypotenuse (h) of that anchor to that point. Then using that plus the rotation it calculates
|
|
193
|
-
* the sides of the triangle and returns the length of the side that touches the bounding rect.
|
|
194
|
-
* @param {{width: number, height: number}} rect - the rect which contains the point
|
|
195
|
-
* @param {{x:number, y: number}} point - the point within the rect
|
|
196
|
-
* @param {number} angle - the angle in degrees that the rect has rotated.
|
|
197
|
-
* @returns {{left: number, top: number}} position
|
|
198
|
-
*/
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
exports.getLeft = getLeft;
|
|
202
|
-
|
|
203
|
-
var getAnchor = function getAnchor(rect, point, angle) {
|
|
204
|
-
log('[getAnchor] rect: ', rect, 'point:', point, 'angle: ', angle);
|
|
205
|
-
|
|
206
|
-
if (point.x > rect.width) {
|
|
207
|
-
throw new Error("x: ".concat(point.x, " cannot be greater than width: ").concat(rect.width));
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
if (point.y > rect.height) {
|
|
211
|
-
throw new Error("y: ".concat(point.y, " cannot be greater than height: ").concat(rect.height));
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
var a = normalizeAngle(angle);
|
|
215
|
-
var top = getTop(rect, point, a);
|
|
216
|
-
var left = getLeft(rect, point, a);
|
|
217
|
-
log('[getAnchor] top: ', top, 'left: ', left);
|
|
218
|
-
return {
|
|
219
|
-
top: top,
|
|
220
|
-
left: left
|
|
221
|
-
};
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
exports.getAnchor = getAnchor;
|
|
225
|
-
|
|
226
|
-
var anglePoints = function anglePoints(angle) {
|
|
227
|
-
if (angle <= 90) {
|
|
228
|
-
return {
|
|
229
|
-
top: 'top-left',
|
|
230
|
-
left: 'bottom-left'
|
|
231
|
-
};
|
|
232
|
-
} else if (angle > 90 && angle <= 180) {
|
|
233
|
-
return {
|
|
234
|
-
top: 'bottom-left',
|
|
235
|
-
left: 'bottom-right'
|
|
236
|
-
};
|
|
237
|
-
} else if (angle > 180 && angle <= 270) {
|
|
238
|
-
return {
|
|
239
|
-
top: 'bottom-right',
|
|
240
|
-
left: 'top-right'
|
|
241
|
-
};
|
|
242
|
-
} else if (angle > 270 && angle < 360) {
|
|
243
|
-
return {
|
|
244
|
-
top: 'top-right',
|
|
245
|
-
left: 'top-left'
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
};
|
|
249
|
-
//# sourceMappingURL=anchor-utils.js.map
|
package/lib/anchor-utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/anchor-utils.js"],"names":["log","toDegrees","radians","Math","PI","toRadians","degrees","normalizeAngle","a","toPoint","rect","edge","out","Point","x","y","distanceBetween","from","to","center","width","height","fromCenter","rotateAround","toCenter","diff","sub","getXAndY","corner","point","arctangent","atan2","getAngleAndHypotenuse","hypotenuse","sqrt","pow","getPosition","side","angle","calcAngle","points","anglePoints","key","ra","t","angles","sides","getTop","abs","getLeft","getAnchor","Error","top","left"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA,IAAMA,GAAG,GAAG,uBAAM,6BAAN,CAAZ;;AAEO,IAAMC,SAAS,GAAG,SAAZA,SAAY,CAACC,OAAD;AAAA,SAAaA,OAAO,IAAI,MAAMC,IAAI,CAACC,EAAf,CAApB;AAAA,CAAlB;;;;AACA,IAAMC,SAAS,GAAG,SAAZA,SAAY,CAACC,OAAD;AAAA,SAAaA,OAAO,IAAIH,IAAI,CAACC,EAAL,GAAU,GAAd,CAApB;AAAA,CAAlB;;;;AAEA,IAAMG,cAAc,GAAG,SAAjBA,cAAiB,CAACC,CAAD,EAAO;AACnC,MAAIA,CAAC,GAAG,GAAR,EAAa;AACX,WAAOA,CAAC,GAAG,GAAX;AACD,GAFD,MAEO,IAAIA,CAAC,GAAG,CAAR,EAAW;AAChB,WAAO,MAAOA,CAAC,GAAG,GAAlB;AACD;;A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D,EAAN;AACD;;AACD,MAAMb,CAAC,GAAGD,cAAc,CAAC+B,KAAD,CAAxB;AACA,MAAMc,GAAG,GAAGL,MAAM,CAACrC,IAAD,EAAOmB,KAAP,EAAcrB,CAAd,CAAlB;AACA,MAAM6C,IAAI,GAAGJ,OAAO,CAACvC,IAAD,EAAOmB,KAAP,EAAcrB,CAAd,CAApB;AAEAR,EAAAA,GAAG,CAAC,mBAAD,EAAsBoD,GAAtB,EAA2B,QAA3B,EAAqCC,IAArC,CAAH;AACA,SAAO;AAAED,IAAAA,GAAG,EAAHA,GAAF;AAAOC,IAAAA,IAAI,EAAJA;AAAP,GAAP;AACD,CAdM;;;;AAgBP,IAAMZ,WAAW,GAAG,SAAdA,WAAc,CAACH,KAAD,EAAW;AAC7B,MAAIA,KAAK,IAAI,EAAb,EAAiB;AACf,WAAO;AAAEc,MAAAA,GAAG,EAAE,UAAP;AAAmBC,MAAAA,IAAI,EAAE;AAAzB,KAAP;AACD,GAFD,MAEO,IAAIf,KAAK,GAAG,EAAR,IAAcA,KAAK,IAAI,GAA3B,EAAgC;AACrC,WAAO;AAAEc,MAAAA,GAAG,EAAE,aAAP;AAAsBC,MAAAA,IAAI,EAAE;AAA5B,KAAP;AACD,GAFM,MAEA,IAAIf,KAAK,GAAG,GAAR,IAAeA,KAAK,IAAI,GAA5B,EAAiC;AACtC,WAAO;AAAEc,MAAAA,GAAG,EAAE,cAAP;AAAuBC,MAAAA,IAAI,EAAE;AAA7B,KAAP;AACD,GAFM,MAEA,IAAIf,KAAK,GAAG,GAAR,IAAeA,KAAK,GAAG,GAA3B,EAAgC;AACrC,WAAO;AAAEc,MAAAA,GAAG,EAAE,WAAP;AAAoBC,MAAAA,IAAI,EAAE;AAA1B,KAAP;AACD;AACF,CAVD","sourcesContent":["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"],"file":"anchor-utils.js"}
|
package/lib/anchor.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
|
-
var _styles = require("@material-ui/core/styles");
|
|
13
|
-
|
|
14
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
-
|
|
16
|
-
var Anchor = (0, _styles.withStyles)(function (theme) {
|
|
17
|
-
return {
|
|
18
|
-
anchor: {
|
|
19
|
-
cursor: 'pointer',
|
|
20
|
-
width: '20px',
|
|
21
|
-
height: '20px',
|
|
22
|
-
position: 'absolute',
|
|
23
|
-
borderRadius: '10px',
|
|
24
|
-
backgroundColor: "var(--ruler-bg, ".concat(theme.palette.primary.contrastText, ")"),
|
|
25
|
-
transition: 'background-color 200ms ease-in',
|
|
26
|
-
border: "solid 1px var(--ruler-stroke, ".concat(theme.palette.primary.dark, ")"),
|
|
27
|
-
'&:hover': {
|
|
28
|
-
backgroundColor: "var(--ruler-bg-hover, ".concat(theme.palette.primary.light, ")")
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
})(function (_ref) {
|
|
33
|
-
var classes = _ref.classes,
|
|
34
|
-
className = _ref.className;
|
|
35
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
36
|
-
className: (0, _classnames["default"])(classes.anchor, className)
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
var _default = Anchor;
|
|
40
|
-
exports["default"] = _default;
|
|
41
|
-
//# sourceMappingURL=anchor.js.map
|
package/lib/anchor.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/anchor.jsx"],"names":["Anchor","theme","anchor","cursor","width","height","position","borderRadius","backgroundColor","palette","primary","contrastText","transition","border","dark","light","classes","className"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AAEA,IAAMA,MAAM,GAAG,wBAAW,UAACC,KAAD;AAAA,SAAY;AACpCC,IAAAA,MAAM,EAAE;AACNC,MAAAA,MAAM,EAAE,SADF;AAENC,MAAAA,KAAK,EAAE,MAFD;AAGNC,MAAAA,MAAM,EAAE,MAHF;AAINC,MAAAA,QAAQ,EAAE,UAJJ;AAKNC,MAAAA,YAAY,EAAE,MALR;AAMNC,MAAAA,eAAe,4BAAqBP,KAAK,CAACQ,OAAN,CAAcC,OAAd,CAAsBC,YAA3C,MANT;AAONC,MAAAA,UAAU,EAAE,gCAPN;AAQNC,MAAAA,MAAM,0CAAmCZ,KAAK,CAACQ,OAAN,CAAcC,OAAd,CAAsBI,IAAzD,MARA;AASN,iBAAW;AACTN,QAAAA,eAAe,kCAA2BP,KAAK,CAACQ,OAAN,CAAcC,OAAd,CAAsBK,KAAjD;AADN;AATL;AAD4B,GAAZ;AAAA,CAAX,EAcX;AAAA,MAAGC,OAAH,QAAGA,OAAH;AAAA,MAAYC,SAAZ,QAAYA,SAAZ;AAAA,sBAA4B;AAAK,IAAA,SAAS,EAAE,4BAAWD,OAAO,CAACd,MAAnB,EAA2Be,SAA3B;AAAhB,IAA5B;AAAA,CAdW,CAAf;eAgBejB,M","sourcesContent":["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"],"file":"anchor.js"}
|
package/lib/index.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
Object.defineProperty(exports, "Protractor", {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function get() {
|
|
13
|
-
return _protractor["default"];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
Object.defineProperty(exports, "Rotatable", {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: function get() {
|
|
19
|
-
return _rotatable["default"];
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
Object.defineProperty(exports, "Ruler", {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
get: function get() {
|
|
25
|
-
return _ruler["default"];
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
exports.utils = void 0;
|
|
29
|
-
|
|
30
|
-
var _protractor = _interopRequireDefault(require("./protractor"));
|
|
31
|
-
|
|
32
|
-
var _ruler = _interopRequireDefault(require("./ruler"));
|
|
33
|
-
|
|
34
|
-
var _rotatable = _interopRequireDefault(require("./rotatable"));
|
|
35
|
-
|
|
36
|
-
var utils = _interopRequireWildcard(require("./anchor-utils"));
|
|
37
|
-
|
|
38
|
-
exports.utils = utils;
|
|
39
|
-
|
|
40
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
41
|
-
|
|
42
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
43
|
-
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA","sourcesContent":["import Protractor from './protractor';\nimport Ruler from './ruler';\nimport Rotatable from './rotatable';\nimport * as utils from './anchor-utils';\n\nexport { Protractor, Ruler, Rotatable, utils };\n"],"file":"index.js"}
|