@futdevpro/fsm-dynamo 1.9.9 → 1.9.12
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/.github/workflows/main.yml +196 -0
- package/HOWTO.md +15 -15
- package/README.md +17 -17
- package/build/_collections/constants/country-divisions.const.d.ts +1 -1
- package/build/_collections/constants/country-divisions.const.d.ts.map +1 -1
- package/build/_collections/constants/country-divisions.const.js +2 -2
- package/build/_collections/constants/country-divisions.const.js.map +1 -1
- package/build/_collections/constants/courtry-isos.const.d.ts +1 -1
- package/build/_collections/constants/courtry-isos.const.d.ts.map +1 -1
- package/build/_collections/constants/courtry-isos.const.js +2 -2
- package/build/_collections/constants/courtry-isos.const.js.map +1 -1
- package/build/_collections/constants/error-defaults.const.d.ts +1 -1
- package/build/_collections/constants/error-defaults.const.d.ts.map +1 -1
- package/build/_collections/constants/module-settings/usage-module-settings.const.js +1 -1
- package/build/_collections/constants/pipe-transforms.const.js +12 -12
- package/build/_collections/constants/pipe-transforms.const.js.map +1 -1
- package/build/_collections/utils/pipe-transforms/division-pipe.util.js +1 -1
- package/build/_collections/utils/pipe-transforms/division-pipe.util.js.map +1 -1
- package/build/_collections/utils/pipe-transforms/list-pipe.util.d.ts.map +1 -1
- package/build/_collections/utils/pipe-transforms/list-pipe.util.js.map +1 -1
- package/build/_collections/utils/pipe-transforms/range-pipe.util.d.ts +2 -2
- package/build/_collections/utils/pipe-transforms/range-pipe.util.d.ts.map +1 -1
- package/build/_collections/utils/pipe-transforms/range-pipe.util.js +11 -11
- package/build/_collections/utils/pipe-transforms/range-pipe.util.js.map +1 -1
- package/build/_collections/utils/regions.util.d.ts.map +1 -1
- package/build/_collections/utils/regions.util.js +3 -0
- package/build/_collections/utils/regions.util.js.map +1 -1
- package/build/_enums/range-pipe-setting.enum.d.ts +1 -1
- package/build/_enums/range-pipe-setting.enum.d.ts.map +1 -1
- package/build/_enums/range-pipe-setting.enum.js +12 -12
- package/build/_enums/range-pipe-setting.enum.js.map +1 -1
- package/build/_models/control-models/error.control-model.js +1 -1
- package/build/_models/control-models/error.control-model.js.map +1 -1
- package/build/_models/control-models/error.control-model.spec.js +25 -6
- package/build/_models/control-models/error.control-model.spec.js.map +1 -1
- package/build/_models/interfaces/index.d.ts +3 -0
- package/build/_models/interfaces/index.d.ts.map +1 -1
- package/build/_models/interfaces/index.js +3 -0
- package/build/_models/interfaces/index.js.map +1 -1
- package/build/_models/interfaces/pipe-transforms.interface.d.ts +2 -2
- package/build/_models/interfaces/pipe-transforms.interface.d.ts.map +1 -1
- package/futdevpro-fsm-dynamo-01.09.12.tgz +0 -0
- package/nodemon.json +11 -11
- package/package.json +151 -151
- package/src/_collections/assets/location/country-codes-ISO-3166.json +3239 -3239
- package/src/_collections/assets/location/country-divisions-ISO-3166-all-list.json +19035 -19035
- package/src/_collections/assets/location/country-divisions-ISO-3166.json +4993 -4993
- package/src/_collections/assets/location/country-phone-codes.json +1203 -1203
- package/src/_collections/constants/country-divisions.const.ts +9 -9
- package/src/_collections/constants/courtry-isos.const.ts +8 -8
- package/src/_collections/constants/error-defaults.const.ts +11 -11
- package/src/_collections/constants/index.ts +15 -15
- package/src/_collections/constants/module-settings/custom-data-module-settings.const.ts +15 -15
- package/src/_collections/constants/module-settings/index.ts +8 -8
- package/src/_collections/constants/module-settings/test-module-settings.const.ts +19 -19
- package/src/_collections/constants/module-settings/usage-module-settings.const.ts +19 -19
- package/src/_collections/constants/pipe-transforms.const.ts +35 -35
- package/src/_collections/constants/times.const.ts +8 -8
- package/src/_collections/index.ts +6 -6
- package/src/_collections/utils/array.util.spec.ts +39 -39
- package/src/_collections/utils/array.util.ts +137 -137
- package/src/_collections/utils/index.ts +18 -18
- package/src/_collections/utils/location.util.ts +55 -55
- package/src/_collections/utils/log.util.ts +239 -239
- package/src/_collections/utils/math/box-bounds.util.ts +85 -85
- package/src/_collections/utils/math/index.ts +5 -5
- package/src/_collections/utils/math/math.util.ts +53 -53
- package/src/_collections/utils/math/random.util.ts +80 -80
- package/src/_collections/utils/math/trigonometry.util.ts +73 -73
- package/src/_collections/utils/math/vector2.util.ts +197 -197
- package/src/_collections/utils/pipe-transforms/country-pipe.util.ts +18 -18
- package/src/_collections/utils/pipe-transforms/custom-pipe.util.ts +9 -9
- package/src/_collections/utils/pipe-transforms/division-pipe.util.ts +20 -20
- package/src/_collections/utils/pipe-transforms/index.ts +15 -15
- package/src/_collections/utils/pipe-transforms/list-pipe.util.ts +10 -14
- package/src/_collections/utils/pipe-transforms/multi-pipe-pipe.util.ts +160 -160
- package/src/_collections/utils/pipe-transforms/obj-key-pipe.util.ts +9 -9
- package/src/_collections/utils/pipe-transforms/range-pipe.util.ts +94 -94
- package/src/_collections/utils/pipe-transforms/region-pipe.util.ts +18 -18
- package/src/_collections/utils/pipe-transforms/replace-pipe.util.ts +11 -11
- package/src/_collections/utils/pipe-transforms/slider-pipe.util.ts +20 -20
- package/src/_collections/utils/pipe-transforms/smart-replace-pipe.util.ts +71 -71
- package/src/_collections/utils/regex/index.ts +4 -4
- package/src/_collections/utils/regex/password-regex.util.ts +52 -52
- package/src/_collections/utils/regex/regex.util.ts +6 -6
- package/src/_collections/utils/regex/username-regex.util.ts +33 -33
- package/src/_collections/utils/regions.util.ts +100 -97
- package/src/_collections/utils/round-list.util.ts +44 -44
- package/src/_collections/utils/shared.static-service.ts +177 -177
- package/src/_collections/utils/time.util.spec.ts +50 -50
- package/src/_collections/utils/time.util.ts +219 -219
- package/src/_collections/utils/type-cloning-facility.util.ts +121 -121
- package/src/_collections/utils/utilities.util.ts +130 -130
- package/src/_enums/basic-property-type.enum.ts +9 -9
- package/src/_enums/data-model-type.enum.ts +13 -13
- package/src/_enums/day-of-week.enum.ts +28 -28
- package/src/_enums/error-level.enum.ts +17 -17
- package/src/_enums/index.ts +16 -16
- package/src/_enums/location/index.ts +3 -3
- package/src/_enums/location/region.enum.ts +9 -9
- package/src/_enums/location/sub-region.enum.ts +26 -26
- package/src/_enums/location/subdivision-region-type.enum.ts +44 -44
- package/src/_enums/log-style.enum.ts +30 -30
- package/src/_enums/month.enum.ts +16 -16
- package/src/_enums/pipe.enum.ts +45 -45
- package/src/_enums/range-pipe-setting.enum.ts +11 -11
- package/src/_enums/time/day-of-week.enum.ts +28 -28
- package/src/_enums/time/index.ts +3 -3
- package/src/_enums/time/month.enum.ts +16 -16
- package/src/_enums/time/relative-date.enum.ts +13 -13
- package/src/_models/control-models/daily-usage-data.control-model.ts +21 -21
- package/src/_models/control-models/data-model-params.control-model.ts +39 -39
- package/src/_models/control-models/data-property-params.control-model.ts +106 -106
- package/src/_models/control-models/error.control-model.spec.ts +753 -716
- package/src/_models/control-models/error.control-model.ts +722 -722
- package/src/_models/control-models/index.ts +10 -10
- package/src/_models/control-models/poll.control-model.ts +113 -113
- package/src/_models/control-models/range-value.control-model.ts +142 -142
- package/src/_models/control-models/usage-action.control-model.ts +15 -15
- package/src/_models/control-models/usage-data.control-model.ts +20 -20
- package/src/_models/data-models/custom-data.data-model.ts +28 -28
- package/src/_models/data-models/index.ts +5 -5
- package/src/_models/data-models/metadata.data-model.ts +83 -83
- package/src/_models/data-models/usage-session.data-model.ts +53 -53
- package/src/_models/index.ts +12 -12
- package/src/_models/interfaces/error-defaults.interface.ts +11 -11
- package/src/_models/interfaces/index.ts +11 -8
- package/src/_models/interfaces/location/country-division.interface.ts +7 -7
- package/src/_models/interfaces/location/country-iso.interface.ts +21 -21
- package/src/_models/interfaces/location/country-phone-code.interface.ts +7 -7
- package/src/_models/interfaces/location/division-collection.interface.ts +10 -10
- package/src/_models/interfaces/location/division-region-data.interface.ts +8 -8
- package/src/_models/interfaces/location/geo-ip-location.interface.ts +26 -26
- package/src/_models/interfaces/location/index.ts +10 -10
- package/src/_models/interfaces/location/location-coordinates.interface.ts +5 -5
- package/src/_models/interfaces/multi-pipe-settings.type.ts +7 -7
- package/src/_models/interfaces/paged.interface.ts +11 -11
- package/src/_models/interfaces/pipe-transforms.interface.ts +29 -29
- package/src/_models/interfaces/random-weight.interface.ts +7 -7
- package/src/_models/interfaces/route-settings.interface.ts +11 -11
- package/src/_modules/collections.index.ts +2 -2
- package/src/_modules/constants.index.ts +2 -2
- package/src/_modules/custom-data-module.index.ts +6 -6
- package/src/_modules/data-modules.index.ts +9 -9
- package/src/_modules/enums.index.ts +2 -2
- package/src/_modules/error-module.index.ts +8 -8
- package/src/_modules/location.index.ts +15 -15
- package/src/_modules/models.index.ts +2 -2
- package/src/_modules/shared-service.index.ts +9 -9
- package/src/_modules/test-module.index.ts +5 -5
- package/src/_modules/usage-module.index.ts +10 -10
- package/tsconfig.json +29 -29
- package/tslint.json +153 -153
- package/build/_enums/region.enum.d.ts +0 -8
- package/build/_enums/region.enum.d.ts.map +0 -1
- package/build/_enums/region.enum.js +0 -12
- package/build/_enums/region.enum.js.map +0 -1
- package/build/_enums/relative-date.enum.d.ts +0 -9
- package/build/_enums/relative-date.enum.d.ts.map +0 -1
- package/build/_enums/relative-date.enum.js +0 -13
- package/build/_enums/relative-date.enum.js.map +0 -1
- package/build/_enums/sub-region.enum.d.ts +0 -20
- package/build/_enums/sub-region.enum.d.ts.map +0 -1
- package/build/_enums/sub-region.enum.js +0 -24
- package/build/_enums/sub-region.enum.js.map +0 -1
- package/build/_enums/subdivision-region-type.enum.d.ts +0 -41
- package/build/_enums/subdivision-region-type.enum.d.ts.map +0 -1
- package/build/_enums/subdivision-region-type.enum.js +0 -46
- package/build/_enums/subdivision-region-type.enum.js.map +0 -1
- package/src/_enums/region.enum.ts +0 -9
- package/src/_enums/relative-date.enum.ts +0 -13
- package/src/_enums/sub-region.enum.ts +0 -26
- package/src/_enums/subdivision-region-type.enum.ts +0 -44
|
@@ -1,198 +1,198 @@
|
|
|
1
|
-
|
|
2
|
-
import { DynamoFM_Trigonometry } from './trigonometry.util';
|
|
3
|
-
|
|
4
|
-
export type DFM_Vector2 = DynamoFM_Vector2;
|
|
5
|
-
export class DynamoFM_Vector2 {
|
|
6
|
-
readonly isVector2: boolean = true;
|
|
7
|
-
|
|
8
|
-
private _x: number = 0;
|
|
9
|
-
set x (value: number) {
|
|
10
|
-
this._x = value;
|
|
11
|
-
|
|
12
|
-
this.calcMagnitude();
|
|
13
|
-
}
|
|
14
|
-
get x (): number {
|
|
15
|
-
return this._x;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
private _y: number = 0;
|
|
19
|
-
set y (value: number) {
|
|
20
|
-
this._y = value;
|
|
21
|
-
|
|
22
|
-
this.calcMagnitude();
|
|
23
|
-
}
|
|
24
|
-
get y (): number {
|
|
25
|
-
return this._y;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
private _magintude: number = 0;
|
|
29
|
-
get magintude (): number {
|
|
30
|
-
return this._magintude;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
static readonly zero: DynamoFM_Vector2 = new DynamoFM_Vector2(0, 0);
|
|
34
|
-
static readonly up: DynamoFM_Vector2 = new DynamoFM_Vector2(0, 1);
|
|
35
|
-
static readonly down: DynamoFM_Vector2 = new DynamoFM_Vector2(0, -1);
|
|
36
|
-
static readonly right: DynamoFM_Vector2 = new DynamoFM_Vector2(1, 0);
|
|
37
|
-
static readonly left: DynamoFM_Vector2 = new DynamoFM_Vector2(-1, 0);
|
|
38
|
-
|
|
39
|
-
constructor(
|
|
40
|
-
x: number | DynamoFM_Vector2 = 0,
|
|
41
|
-
y: number = 0
|
|
42
|
-
) {
|
|
43
|
-
if ((x as DynamoFM_Vector2).isVector2) {
|
|
44
|
-
const v = x as DynamoFM_Vector2;
|
|
45
|
-
|
|
46
|
-
x = v.x;
|
|
47
|
-
y = v.y;
|
|
48
|
-
} else {
|
|
49
|
-
this._x = x as number;
|
|
50
|
-
this._y = y;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
this.calcMagnitude();
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
constructed?(): boolean {
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
static distance(a: DynamoFM_Vector2, b: DynamoFM_Vector2): number {
|
|
61
|
-
return this.minus(a, b).magintude;
|
|
62
|
-
}
|
|
63
|
-
distanceTo?(to: DynamoFM_Vector2): number {
|
|
64
|
-
return DynamoFM_Vector2.distance(this, to);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
static minus(a: DynamoFM_Vector2, b: DynamoFM_Vector2): DynamoFM_Vector2 {
|
|
68
|
-
return this.plus(a, this.negative(b));
|
|
69
|
-
}
|
|
70
|
-
minus?(vector: DynamoFM_Vector2): void {
|
|
71
|
-
this.newValues(DynamoFM_Vector2.minus(this, vector));
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
static plus(a: DynamoFM_Vector2, b: DynamoFM_Vector2): DynamoFM_Vector2 {
|
|
75
|
-
return new DynamoFM_Vector2(a.x + b.x, a.y + b.y);
|
|
76
|
-
}
|
|
77
|
-
plus?(vector: DynamoFM_Vector2): void {
|
|
78
|
-
this.newValues(DynamoFM_Vector2.plus(this, vector));
|
|
79
|
-
}
|
|
80
|
-
static add = this.plus;
|
|
81
|
-
add? = this.plus;
|
|
82
|
-
|
|
83
|
-
/** returns new multiplied Vector2 */
|
|
84
|
-
static multiply(v: DynamoFM_Vector2, n: number): DynamoFM_Vector2 {
|
|
85
|
-
return new DynamoFM_Vector2(v.x * n, v.y * n);
|
|
86
|
-
}
|
|
87
|
-
multiply?(n: number): void {
|
|
88
|
-
this.newValues(DynamoFM_Vector2.multiply(this, n));
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/** returns new divided Vector2 */
|
|
92
|
-
static divide(v: DynamoFM_Vector2, n: number): DynamoFM_Vector2 {
|
|
93
|
-
return new DynamoFM_Vector2(v.x / n, v.y / n);
|
|
94
|
-
}
|
|
95
|
-
divide?(n: number): void {
|
|
96
|
-
this.newValues(DynamoFM_Vector2.divide(this, n));
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
static negative(v: DynamoFM_Vector2): DynamoFM_Vector2 {
|
|
100
|
-
return new DynamoFM_Vector2(-v.x, -v.y);
|
|
101
|
-
}
|
|
102
|
-
getNegative?(): DynamoFM_Vector2 {
|
|
103
|
-
return DynamoFM_Vector2.negative(this);
|
|
104
|
-
}
|
|
105
|
-
negate?(): void {
|
|
106
|
-
this.newValues(DynamoFM_Vector2.negative(this));
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
static rebase(v: DynamoFM_Vector2, baseFrom: DynamoFM_Vector2, baseTo: DynamoFM_Vector2): DynamoFM_Vector2 {
|
|
110
|
-
return this.plus(v, this.minus(baseTo, baseFrom));
|
|
111
|
-
}
|
|
112
|
-
rebase?(baseFrom: DynamoFM_Vector2, baseTo: DynamoFM_Vector2): void {
|
|
113
|
-
this.newValues(DynamoFM_Vector2.rebase(this, baseFrom, baseTo));
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
static rotate(vector: DynamoFM_Vector2, angle: number): DynamoFM_Vector2 {
|
|
117
|
-
const rad = DynamoFM_Trigonometry.angleToRadians(angle);
|
|
118
|
-
|
|
119
|
-
return this.rotateRad(vector, rad);
|
|
120
|
-
}
|
|
121
|
-
static rotateRad(vector: DynamoFM_Vector2, rad: number): DynamoFM_Vector2 {
|
|
122
|
-
const cos = Math.cos(rad);
|
|
123
|
-
const sin = Math.sin(rad);
|
|
124
|
-
const newX = (vector.x * cos) - (vector.y * sin);
|
|
125
|
-
const newY = (vector.x * sin) + (vector.y * cos);
|
|
126
|
-
|
|
127
|
-
return new DynamoFM_Vector2(newX, newY);
|
|
128
|
-
}
|
|
129
|
-
rotate?(angle: number): void {
|
|
130
|
-
this.newValues(DynamoFM_Vector2.rotate(this, angle));
|
|
131
|
-
}
|
|
132
|
-
rotateRad?(rad: number): void {
|
|
133
|
-
this.newValues(DynamoFM_Vector2.rotateRad(this, rad));
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
private newValues(newV: DynamoFM_Vector2): void {
|
|
137
|
-
this.newXY(newV.x, newV.y);
|
|
138
|
-
}
|
|
139
|
-
newXY?(newX: number, newY: number): void {
|
|
140
|
-
this._x = newX;
|
|
141
|
-
this._y = newY;
|
|
142
|
-
|
|
143
|
-
this.calcMagnitude();
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
//// AI-ed
|
|
147
|
-
angle?(from: DynamoFM_Vector2, to: DynamoFM_Vector2): number {
|
|
148
|
-
return DynamoFM_Vector2.angle(from, to);
|
|
149
|
-
}
|
|
150
|
-
static angle(from: DynamoFM_Vector2, to: DynamoFM_Vector2): number {
|
|
151
|
-
return DynamoFM_Trigonometry.radiansToAngle(DynamoFM_Vector2.angleRad(from, to));
|
|
152
|
-
}
|
|
153
|
-
static angleRad(from: DynamoFM_Vector2, to: DynamoFM_Vector2): number {
|
|
154
|
-
return Math.atan2(to.y - from.y, to.x - from.x);
|
|
155
|
-
}
|
|
156
|
-
deg?(): number {
|
|
157
|
-
return DynamoFM_Vector2.deg(this);
|
|
158
|
-
}
|
|
159
|
-
static deg(vector: DynamoFM_Vector2): number {
|
|
160
|
-
return DynamoFM_Trigonometry.radiansToAngle(DynamoFM_Vector2.rad(vector));
|
|
161
|
-
}
|
|
162
|
-
static rad(vector: DynamoFM_Vector2): number {
|
|
163
|
-
return Math.atan2(vector.y, vector.x);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
floor?(): DynamoFM_Vector2 {
|
|
167
|
-
return DynamoFM_Vector2.floor(this);
|
|
168
|
-
}
|
|
169
|
-
static floor(v: DynamoFM_Vector2): DynamoFM_Vector2 {
|
|
170
|
-
return new DynamoFM_Vector2(Math.floor(v.x), Math.floor(v.y));
|
|
171
|
-
}
|
|
172
|
-
/////
|
|
173
|
-
|
|
174
|
-
direction?(to: DynamoFM_Vector2): DynamoFM_Vector2 {
|
|
175
|
-
return DynamoFM_Vector2.direction(this, to);
|
|
176
|
-
}
|
|
177
|
-
static direction(from: DynamoFM_Vector2, to: DynamoFM_Vector2): DynamoFM_Vector2 {
|
|
178
|
-
return DynamoFM_Vector2.minus(to, from);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
static normalize(v: DynamoFM_Vector2): DynamoFM_Vector2 {
|
|
182
|
-
return DynamoFM_Vector2.multiply(v, 1 / v.magintude);
|
|
183
|
-
}
|
|
184
|
-
normalize?(): void {
|
|
185
|
-
this.newValues(DynamoFM_Vector2.normalize(this));
|
|
186
|
-
}
|
|
187
|
-
normalized?(): DynamoFM_Vector2 {
|
|
188
|
-
return DynamoFM_Vector2.normalize(this);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
private calcMagnitude?(): void {
|
|
192
|
-
this._magintude = DynamoFM_Trigonometry.getHypotenuse(this._x, this._y);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
clone?(): DynamoFM_Vector2 {
|
|
196
|
-
return new DynamoFM_Vector2(this._x, this._y);
|
|
197
|
-
}
|
|
1
|
+
|
|
2
|
+
import { DynamoFM_Trigonometry } from './trigonometry.util';
|
|
3
|
+
|
|
4
|
+
export type DFM_Vector2 = DynamoFM_Vector2;
|
|
5
|
+
export class DynamoFM_Vector2 {
|
|
6
|
+
readonly isVector2: boolean = true;
|
|
7
|
+
|
|
8
|
+
private _x: number = 0;
|
|
9
|
+
set x (value: number) {
|
|
10
|
+
this._x = value;
|
|
11
|
+
|
|
12
|
+
this.calcMagnitude();
|
|
13
|
+
}
|
|
14
|
+
get x (): number {
|
|
15
|
+
return this._x;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
private _y: number = 0;
|
|
19
|
+
set y (value: number) {
|
|
20
|
+
this._y = value;
|
|
21
|
+
|
|
22
|
+
this.calcMagnitude();
|
|
23
|
+
}
|
|
24
|
+
get y (): number {
|
|
25
|
+
return this._y;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
private _magintude: number = 0;
|
|
29
|
+
get magintude (): number {
|
|
30
|
+
return this._magintude;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
static readonly zero: DynamoFM_Vector2 = new DynamoFM_Vector2(0, 0);
|
|
34
|
+
static readonly up: DynamoFM_Vector2 = new DynamoFM_Vector2(0, 1);
|
|
35
|
+
static readonly down: DynamoFM_Vector2 = new DynamoFM_Vector2(0, -1);
|
|
36
|
+
static readonly right: DynamoFM_Vector2 = new DynamoFM_Vector2(1, 0);
|
|
37
|
+
static readonly left: DynamoFM_Vector2 = new DynamoFM_Vector2(-1, 0);
|
|
38
|
+
|
|
39
|
+
constructor(
|
|
40
|
+
x: number | DynamoFM_Vector2 = 0,
|
|
41
|
+
y: number = 0
|
|
42
|
+
) {
|
|
43
|
+
if ((x as DynamoFM_Vector2).isVector2) {
|
|
44
|
+
const v = x as DynamoFM_Vector2;
|
|
45
|
+
|
|
46
|
+
x = v.x;
|
|
47
|
+
y = v.y;
|
|
48
|
+
} else {
|
|
49
|
+
this._x = x as number;
|
|
50
|
+
this._y = y;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
this.calcMagnitude();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
constructed?(): boolean {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
static distance(a: DynamoFM_Vector2, b: DynamoFM_Vector2): number {
|
|
61
|
+
return this.minus(a, b).magintude;
|
|
62
|
+
}
|
|
63
|
+
distanceTo?(to: DynamoFM_Vector2): number {
|
|
64
|
+
return DynamoFM_Vector2.distance(this, to);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
static minus(a: DynamoFM_Vector2, b: DynamoFM_Vector2): DynamoFM_Vector2 {
|
|
68
|
+
return this.plus(a, this.negative(b));
|
|
69
|
+
}
|
|
70
|
+
minus?(vector: DynamoFM_Vector2): void {
|
|
71
|
+
this.newValues(DynamoFM_Vector2.minus(this, vector));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
static plus(a: DynamoFM_Vector2, b: DynamoFM_Vector2): DynamoFM_Vector2 {
|
|
75
|
+
return new DynamoFM_Vector2(a.x + b.x, a.y + b.y);
|
|
76
|
+
}
|
|
77
|
+
plus?(vector: DynamoFM_Vector2): void {
|
|
78
|
+
this.newValues(DynamoFM_Vector2.plus(this, vector));
|
|
79
|
+
}
|
|
80
|
+
static add = this.plus;
|
|
81
|
+
add? = this.plus;
|
|
82
|
+
|
|
83
|
+
/** returns new multiplied Vector2 */
|
|
84
|
+
static multiply(v: DynamoFM_Vector2, n: number): DynamoFM_Vector2 {
|
|
85
|
+
return new DynamoFM_Vector2(v.x * n, v.y * n);
|
|
86
|
+
}
|
|
87
|
+
multiply?(n: number): void {
|
|
88
|
+
this.newValues(DynamoFM_Vector2.multiply(this, n));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** returns new divided Vector2 */
|
|
92
|
+
static divide(v: DynamoFM_Vector2, n: number): DynamoFM_Vector2 {
|
|
93
|
+
return new DynamoFM_Vector2(v.x / n, v.y / n);
|
|
94
|
+
}
|
|
95
|
+
divide?(n: number): void {
|
|
96
|
+
this.newValues(DynamoFM_Vector2.divide(this, n));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
static negative(v: DynamoFM_Vector2): DynamoFM_Vector2 {
|
|
100
|
+
return new DynamoFM_Vector2(-v.x, -v.y);
|
|
101
|
+
}
|
|
102
|
+
getNegative?(): DynamoFM_Vector2 {
|
|
103
|
+
return DynamoFM_Vector2.negative(this);
|
|
104
|
+
}
|
|
105
|
+
negate?(): void {
|
|
106
|
+
this.newValues(DynamoFM_Vector2.negative(this));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
static rebase(v: DynamoFM_Vector2, baseFrom: DynamoFM_Vector2, baseTo: DynamoFM_Vector2): DynamoFM_Vector2 {
|
|
110
|
+
return this.plus(v, this.minus(baseTo, baseFrom));
|
|
111
|
+
}
|
|
112
|
+
rebase?(baseFrom: DynamoFM_Vector2, baseTo: DynamoFM_Vector2): void {
|
|
113
|
+
this.newValues(DynamoFM_Vector2.rebase(this, baseFrom, baseTo));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
static rotate(vector: DynamoFM_Vector2, angle: number): DynamoFM_Vector2 {
|
|
117
|
+
const rad = DynamoFM_Trigonometry.angleToRadians(angle);
|
|
118
|
+
|
|
119
|
+
return this.rotateRad(vector, rad);
|
|
120
|
+
}
|
|
121
|
+
static rotateRad(vector: DynamoFM_Vector2, rad: number): DynamoFM_Vector2 {
|
|
122
|
+
const cos = Math.cos(rad);
|
|
123
|
+
const sin = Math.sin(rad);
|
|
124
|
+
const newX = (vector.x * cos) - (vector.y * sin);
|
|
125
|
+
const newY = (vector.x * sin) + (vector.y * cos);
|
|
126
|
+
|
|
127
|
+
return new DynamoFM_Vector2(newX, newY);
|
|
128
|
+
}
|
|
129
|
+
rotate?(angle: number): void {
|
|
130
|
+
this.newValues(DynamoFM_Vector2.rotate(this, angle));
|
|
131
|
+
}
|
|
132
|
+
rotateRad?(rad: number): void {
|
|
133
|
+
this.newValues(DynamoFM_Vector2.rotateRad(this, rad));
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
private newValues(newV: DynamoFM_Vector2): void {
|
|
137
|
+
this.newXY(newV.x, newV.y);
|
|
138
|
+
}
|
|
139
|
+
newXY?(newX: number, newY: number): void {
|
|
140
|
+
this._x = newX;
|
|
141
|
+
this._y = newY;
|
|
142
|
+
|
|
143
|
+
this.calcMagnitude();
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
//// AI-ed
|
|
147
|
+
angle?(from: DynamoFM_Vector2, to: DynamoFM_Vector2): number {
|
|
148
|
+
return DynamoFM_Vector2.angle(from, to);
|
|
149
|
+
}
|
|
150
|
+
static angle(from: DynamoFM_Vector2, to: DynamoFM_Vector2): number {
|
|
151
|
+
return DynamoFM_Trigonometry.radiansToAngle(DynamoFM_Vector2.angleRad(from, to));
|
|
152
|
+
}
|
|
153
|
+
static angleRad(from: DynamoFM_Vector2, to: DynamoFM_Vector2): number {
|
|
154
|
+
return Math.atan2(to.y - from.y, to.x - from.x);
|
|
155
|
+
}
|
|
156
|
+
deg?(): number {
|
|
157
|
+
return DynamoFM_Vector2.deg(this);
|
|
158
|
+
}
|
|
159
|
+
static deg(vector: DynamoFM_Vector2): number {
|
|
160
|
+
return DynamoFM_Trigonometry.radiansToAngle(DynamoFM_Vector2.rad(vector));
|
|
161
|
+
}
|
|
162
|
+
static rad(vector: DynamoFM_Vector2): number {
|
|
163
|
+
return Math.atan2(vector.y, vector.x);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
floor?(): DynamoFM_Vector2 {
|
|
167
|
+
return DynamoFM_Vector2.floor(this);
|
|
168
|
+
}
|
|
169
|
+
static floor(v: DynamoFM_Vector2): DynamoFM_Vector2 {
|
|
170
|
+
return new DynamoFM_Vector2(Math.floor(v.x), Math.floor(v.y));
|
|
171
|
+
}
|
|
172
|
+
/////
|
|
173
|
+
|
|
174
|
+
direction?(to: DynamoFM_Vector2): DynamoFM_Vector2 {
|
|
175
|
+
return DynamoFM_Vector2.direction(this, to);
|
|
176
|
+
}
|
|
177
|
+
static direction(from: DynamoFM_Vector2, to: DynamoFM_Vector2): DynamoFM_Vector2 {
|
|
178
|
+
return DynamoFM_Vector2.minus(to, from);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
static normalize(v: DynamoFM_Vector2): DynamoFM_Vector2 {
|
|
182
|
+
return DynamoFM_Vector2.multiply(v, 1 / v.magintude);
|
|
183
|
+
}
|
|
184
|
+
normalize?(): void {
|
|
185
|
+
this.newValues(DynamoFM_Vector2.normalize(this));
|
|
186
|
+
}
|
|
187
|
+
normalized?(): DynamoFM_Vector2 {
|
|
188
|
+
return DynamoFM_Vector2.normalize(this);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
private calcMagnitude?(): void {
|
|
192
|
+
this._magintude = DynamoFM_Trigonometry.getHypotenuse(this._x, this._y);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
clone?(): DynamoFM_Vector2 {
|
|
196
|
+
return new DynamoFM_Vector2(this._x, this._y);
|
|
197
|
+
}
|
|
198
198
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { DynamoFM_CountryISO } from '../../../_models';
|
|
9
|
-
import { DynamoFM_countryISOs } from '../../constants/courtry-isos.const';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export function DynamoFM_country_pipeTransform(countryISO: string): string {
|
|
13
|
-
const result = DynamoFM_countryISOs.find(
|
|
14
|
-
(iso: DynamoFM_CountryISO): boolean => iso.iso2 === countryISO
|
|
15
|
-
)?.name;
|
|
16
|
-
|
|
17
|
-
return result ?? countryISO;
|
|
18
|
-
}
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
import { DynamoFM_CountryISO } from '../../../_models';
|
|
9
|
+
import { DynamoFM_countryISOs } from '../../constants/courtry-isos.const';
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
export function DynamoFM_country_pipeTransform(countryISO: string): string {
|
|
13
|
+
const result = DynamoFM_countryISOs.find(
|
|
14
|
+
(iso: DynamoFM_CountryISO): boolean => iso.iso2 === countryISO
|
|
15
|
+
)?.name;
|
|
16
|
+
|
|
17
|
+
return result ?? countryISO;
|
|
18
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export function DynamoFM_custom_pipeTransform<T, K>(value: T, customTransform: (input: T) => K): K {
|
|
8
|
-
return customTransform(value);
|
|
9
|
-
}
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export function DynamoFM_custom_pipeTransform<T, K>(value: T, customTransform: (input: T) => K): K {
|
|
8
|
+
return customTransform(value);
|
|
9
|
+
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import { DynamoFM_CountryDivision } from '../../../_models';
|
|
12
|
-
import { DynamoFM_countryDivisions } from '../../constants/country-divisions.const';
|
|
13
|
-
|
|
14
|
-
export function DynamoFM_division_pipeTransform(divisionCode: string, countryISO: string): string {
|
|
15
|
-
const result: string = DynamoFM_countryDivisions?.find(
|
|
16
|
-
(d: DynamoFM_CountryDivision): boolean => d
|
|
17
|
-
)?.name;
|
|
18
|
-
|
|
19
|
-
return result ?? divisionCode;
|
|
20
|
-
}
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
import { DynamoFM_CountryDivision } from '../../../_models';
|
|
12
|
+
import { DynamoFM_countryDivisions } from '../../constants/country-divisions.const';
|
|
13
|
+
|
|
14
|
+
export function DynamoFM_division_pipeTransform(divisionCode: string, countryISO: string): string {
|
|
15
|
+
const result: string = DynamoFM_countryDivisions?.find(
|
|
16
|
+
(d: DynamoFM_CountryDivision): boolean => d?.code === divisionCode && d?.iso === countryISO
|
|
17
|
+
)?.name;
|
|
18
|
+
|
|
19
|
+
return result ?? divisionCode;
|
|
20
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export * from './country-pipe.util';
|
|
6
|
-
export * from './custom-pipe.util';
|
|
7
|
-
export * from './division-pipe.util';
|
|
8
|
-
export * from './list-pipe.util';
|
|
9
|
-
export * from './multi-pipe-pipe.util';
|
|
10
|
-
export * from './obj-key-pipe.util';
|
|
11
|
-
export * from './obj-key-pipe.util';
|
|
12
|
-
export * from './range-pipe.util';
|
|
13
|
-
export * from './region-pipe.util';
|
|
14
|
-
export * from './replace-pipe.util';
|
|
15
|
-
export * from './slider-pipe.util';
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export * from './country-pipe.util';
|
|
6
|
+
export * from './custom-pipe.util';
|
|
7
|
+
export * from './division-pipe.util';
|
|
8
|
+
export * from './list-pipe.util';
|
|
9
|
+
export * from './multi-pipe-pipe.util';
|
|
10
|
+
export * from './obj-key-pipe.util';
|
|
11
|
+
export * from './obj-key-pipe.util';
|
|
12
|
+
export * from './range-pipe.util';
|
|
13
|
+
export * from './region-pipe.util';
|
|
14
|
+
export * from './replace-pipe.util';
|
|
15
|
+
export * from './slider-pipe.util';
|
|
16
16
|
export * from './smart-replace-pipe.util';
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export function DynamoFM_list_pipeTransform(value: any[]): string {
|
|
13
|
-
return value.toString().replace(/,/g, ', ');
|
|
14
|
-
}
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export function DynamoFM_list_pipeTransform(value: any[]): string {
|
|
9
|
+
return value.toString().replace(/,/g, ', ');
|
|
10
|
+
}
|