@stemy/ngx-utils 19.7.1 → 19.7.4
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/fesm2022/stemy-ngx-utils.mjs +472 -262
- package/fesm2022/stemy-ngx-utils.mjs.map +1 -1
- package/ngx-utils/common-types.d.ts +41 -4
- package/ngx-utils/components/interactive-canvas/interactive-canvas.component.d.ts +27 -14
- package/ngx-utils/components/interactive-canvas/interactive-item.component.d.ts +4 -0
- package/ngx-utils/ngx-utils.imports.d.ts +2 -2
- package/ngx-utils/utils/canvas.d.ts +1 -0
- package/ngx-utils/utils/geometry/functions.d.ts +12 -5
- package/ngx-utils/utils/geometry/gjk.d.ts +3 -0
- package/ngx-utils/utils/geometry/index.d.ts +2 -1
- package/ngx-utils/utils/geometry/shapes.d.ts +15 -8
- package/ngx-utils/utils/math.utils.d.ts +34 -0
- package/package.json +1 -1
- package/public_api.d.ts +3 -3
- package/ngx-utils/utils/geometry/distance.d.ts +0 -25
|
@@ -301,14 +301,45 @@ export interface IPoint {
|
|
|
301
301
|
readonly x: number;
|
|
302
302
|
readonly y: number;
|
|
303
303
|
}
|
|
304
|
+
export interface ShapeIntersection {
|
|
305
|
+
hit: boolean;
|
|
306
|
+
pa?: IPoint;
|
|
307
|
+
pb?: IPoint;
|
|
308
|
+
point?: IPoint;
|
|
309
|
+
}
|
|
310
|
+
export interface ShapeDistance {
|
|
311
|
+
distance: number;
|
|
312
|
+
pa?: IPoint;
|
|
313
|
+
pb?: IPoint;
|
|
314
|
+
}
|
|
304
315
|
export interface IShape extends IPoint {
|
|
305
316
|
readonly center: IPoint;
|
|
306
317
|
support(dir: IPoint): IPoint;
|
|
307
|
-
|
|
308
|
-
|
|
318
|
+
move(pos: IPoint): IShape;
|
|
319
|
+
intersection(shape: IShape): ShapeIntersection;
|
|
320
|
+
intersects(shape: IShape): boolean;
|
|
321
|
+
minDistance(shape: IShape): ShapeDistance;
|
|
322
|
+
distance(shape: IShape): number;
|
|
309
323
|
}
|
|
324
|
+
export type CanvasResizeMode = "fit" | "fill";
|
|
310
325
|
export type CanvasItemDirection = "horizontal" | "vertical" | "free" | "none";
|
|
311
326
|
export type CanvasPaintFunc = (ctx: CanvasRenderingContext2D) => MaybePromise<GlobalCompositeOperation | null>;
|
|
327
|
+
export type RangeCoords = [from: number, to: number];
|
|
328
|
+
export interface RectCoords {
|
|
329
|
+
x: number;
|
|
330
|
+
y: number;
|
|
331
|
+
width: number;
|
|
332
|
+
height: number;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Interface for an interactive canvas params
|
|
336
|
+
*/
|
|
337
|
+
export interface InteractiveCanvasParams {
|
|
338
|
+
xRange?: RangeCoords;
|
|
339
|
+
yRange?: RangeCoords;
|
|
340
|
+
excludedAreas?: ReadonlyArray<RectCoords>;
|
|
341
|
+
[key: string]: any;
|
|
342
|
+
}
|
|
312
343
|
/**
|
|
313
344
|
* Interface for an interactive canvas item
|
|
314
345
|
*/
|
|
@@ -328,13 +359,19 @@ export type InteractiveCanvasItems = ReadonlyArray<InteractiveCanvasItem>;
|
|
|
328
359
|
* Some properties are optional for compatibility with other kind of renderer functions
|
|
329
360
|
*/
|
|
330
361
|
export interface InteractiveCanvas {
|
|
331
|
-
readonly
|
|
362
|
+
readonly infinite?: boolean;
|
|
363
|
+
readonly resizeMode?: CanvasResizeMode;
|
|
364
|
+
readonly params?: InteractiveCanvasParams;
|
|
365
|
+
readonly realWidth?: number;
|
|
366
|
+
readonly realHeight?: number;
|
|
332
367
|
readonly $items?: Observable<InteractiveCanvasItems>;
|
|
333
368
|
readonly items?: InteractiveCanvasItems;
|
|
334
369
|
readonly canvas: HTMLCanvasElement;
|
|
335
370
|
readonly lockedItem?: InteractiveCanvasItem;
|
|
336
371
|
readonly selectedItem?: InteractiveCanvasItem;
|
|
337
372
|
hoveredItem?: InteractiveCanvasItem;
|
|
373
|
+
readonly xRange?: RangeCoords;
|
|
374
|
+
readonly yRange?: RangeCoords;
|
|
338
375
|
readonly ratio: number;
|
|
339
376
|
readonly styles: CSSStyleDeclaration;
|
|
340
377
|
readonly ctx: CanvasRenderingContext2D;
|
|
@@ -345,6 +382,7 @@ export interface InteractiveCanvas {
|
|
|
345
382
|
readonly rotation: number;
|
|
346
383
|
readonly basePan: number;
|
|
347
384
|
readonly cycles?: ReadonlyArray<number>;
|
|
385
|
+
readonly excludedAreas?: ReadonlyArray<IShape & RectCoords>;
|
|
348
386
|
rendered?: boolean;
|
|
349
387
|
tempPaint(cb: CanvasPaintFunc): Promise<void>;
|
|
350
388
|
}
|
|
@@ -352,7 +390,6 @@ export type InteractiveCanvasRenderer = (renderCanvas: InteractiveCanvas, render
|
|
|
352
390
|
export interface InteractivePanEvent {
|
|
353
391
|
canvas: InteractiveCanvas;
|
|
354
392
|
item: InteractiveCanvasItem;
|
|
355
|
-
pointers?: any[];
|
|
356
393
|
deltaX?: number;
|
|
357
394
|
deltaY?: number;
|
|
358
395
|
[key: string]: any;
|
|
@@ -1,22 +1,31 @@
|
|
|
1
1
|
import { AfterViewInit, ElementRef, EventEmitter, OnChanges, OnDestroy, OnInit, QueryList, Renderer2 } from "@angular/core";
|
|
2
2
|
import { BehaviorSubject, Subscription } from "rxjs";
|
|
3
|
-
import { CanvasPaintFunc, InteractiveCanvas, InteractiveCanvasPointer, InteractiveCanvasRenderer, InteractivePanEvent } from "../../common-types";
|
|
3
|
+
import { CanvasPaintFunc, CanvasResizeMode, InteractiveCanvas, InteractiveCanvasItem, InteractiveCanvasParams, InteractiveCanvasPointer, InteractiveCanvasRenderer, InteractivePanEvent, IPoint, RangeCoords } from "../../common-types";
|
|
4
|
+
import { Point, Rect } from "../../utils/geometry";
|
|
4
5
|
import { InteractiveItemComponent } from "./interactive-item.component";
|
|
5
6
|
import { UniversalService } from "../../services/universal.service";
|
|
6
7
|
import * as i0 from "@angular/core";
|
|
7
8
|
export declare class InteractiveCanvasComponent implements InteractiveCanvas, OnInit, OnDestroy, AfterViewInit, OnChanges {
|
|
8
9
|
readonly renderer: Renderer2;
|
|
9
10
|
readonly universal: UniversalService;
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
infinite: boolean;
|
|
12
|
+
resizeMode: CanvasResizeMode;
|
|
13
|
+
params: InteractiveCanvasParams;
|
|
14
|
+
/**
|
|
15
|
+
* Real life-size width of the canvas
|
|
16
|
+
*/
|
|
17
|
+
realWidth: number;
|
|
18
|
+
/**
|
|
19
|
+
* Real life-size height of the canvas
|
|
20
|
+
*/
|
|
21
|
+
realHeight: number;
|
|
12
22
|
debug: boolean;
|
|
13
23
|
horizontal: boolean;
|
|
14
24
|
selectedIndex: number;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Relative offset of the panning. It is based on the rendered canvas height
|
|
27
|
+
*/
|
|
18
28
|
panOffset: number;
|
|
19
|
-
params: Record<string, any>;
|
|
20
29
|
renderCtx: Record<string, any>;
|
|
21
30
|
beforeItems: ReadonlyArray<InteractiveCanvasRenderer>;
|
|
22
31
|
afterItems: ReadonlyArray<InteractiveCanvasRenderer>;
|
|
@@ -33,16 +42,19 @@ export declare class InteractiveCanvasComponent implements InteractiveCanvas, On
|
|
|
33
42
|
get selectedItem(): InteractiveItemComponent;
|
|
34
43
|
get hoveredItem(): InteractiveItemComponent;
|
|
35
44
|
set hoveredItem(item: InteractiveItemComponent);
|
|
45
|
+
xRange: RangeCoords;
|
|
46
|
+
yRange: RangeCoords;
|
|
36
47
|
ratio: number;
|
|
37
48
|
styles: CSSStyleDeclaration;
|
|
38
49
|
ctx: CanvasRenderingContext2D;
|
|
39
50
|
canvasWidth: number;
|
|
40
51
|
canvasHeight: number;
|
|
52
|
+
fullHeight: number;
|
|
53
|
+
viewRatio: number;
|
|
41
54
|
rotation: number;
|
|
42
55
|
basePan: number;
|
|
43
56
|
cycles: number[];
|
|
44
|
-
|
|
45
|
-
viewRatio: number;
|
|
57
|
+
excludedAreas: Rect[];
|
|
46
58
|
protected tempCanvas: HTMLCanvasElement;
|
|
47
59
|
protected shouldDraw: boolean;
|
|
48
60
|
protected hoveredIndex: number;
|
|
@@ -51,11 +63,10 @@ export declare class InteractiveCanvasComponent implements InteractiveCanvas, On
|
|
|
51
63
|
protected canvasElem: ElementRef<HTMLCanvasElement>;
|
|
52
64
|
protected itemList: QueryList<InteractiveItemComponent>;
|
|
53
65
|
protected touched: boolean;
|
|
54
|
-
protected
|
|
55
|
-
protected
|
|
66
|
+
protected panStartRotation: number;
|
|
67
|
+
protected panStartPos: IPoint;
|
|
56
68
|
protected lockedIndex: number;
|
|
57
|
-
constructor(renderer: Renderer2, universal: UniversalService
|
|
58
|
-
ctrInit(): void;
|
|
69
|
+
constructor(renderer: Renderer2, universal: UniversalService);
|
|
59
70
|
ngOnInit(): void;
|
|
60
71
|
ngOnDestroy(): void;
|
|
61
72
|
ngOnChanges(): void;
|
|
@@ -74,12 +85,14 @@ export declare class InteractiveCanvasComponent implements InteractiveCanvas, On
|
|
|
74
85
|
protected fixRotation(): void;
|
|
75
86
|
protected fixItems(): void;
|
|
76
87
|
protected selectItem(pointer: InteractiveCanvasPointer): void;
|
|
88
|
+
protected toCanvasPoint(pointer: InteractiveCanvasPointer): Point;
|
|
77
89
|
protected getIndexUnderPointer(pointer: InteractiveCanvasPointer): number;
|
|
78
90
|
protected updateCursor(): void;
|
|
79
91
|
protected getCursor(): string;
|
|
80
92
|
protected redraw(): void;
|
|
81
93
|
protected drawItems(): Promise<void>;
|
|
94
|
+
protected drawItem(ctx: CanvasRenderingContext2D, item: InteractiveCanvasItem): Promise<void>;
|
|
82
95
|
protected draw(): Promise<void>;
|
|
83
96
|
static ɵfac: i0.ɵɵFactoryDeclaration<InteractiveCanvasComponent, never>;
|
|
84
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<InteractiveCanvasComponent, "interactive-canvas", never, { "
|
|
97
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<InteractiveCanvasComponent, "interactive-canvas", never, { "infinite": { "alias": "infinite"; "required": false; }; "resizeMode": { "alias": "resizeMode"; "required": false; }; "params": { "alias": "params"; "required": false; }; "realWidth": { "alias": "realWidth"; "required": false; }; "realHeight": { "alias": "realHeight"; "required": false; }; "debug": { "alias": "debug"; "required": false; }; "horizontal": { "alias": "horizontal"; "required": false; }; "selectedIndex": { "alias": "selectedIndex"; "required": false; }; "panOffset": { "alias": "panOffset"; "required": false; }; "renderCtx": { "alias": "renderCtx"; "required": false; }; "beforeItems": { "alias": "beforeItems"; "required": false; }; "afterItems": { "alias": "afterItems"; "required": false; }; }, { "selectedIndexChange": "selectedIndexChange"; "onRotate": "onRotate"; "onItemPan": "onItemPan"; "onItemPanned": "onItemPanned"; "onPan": "onPan"; "onPanned": "onPanned"; }, ["itemList"], never, false, never>;
|
|
85
98
|
}
|
|
@@ -30,8 +30,12 @@ export declare class InteractiveItemComponent implements OnChanges, InteractiveC
|
|
|
30
30
|
ngOnChanges(): void;
|
|
31
31
|
calcShapes(): void;
|
|
32
32
|
hit(point: Point): boolean;
|
|
33
|
+
moveTo(x: number, y: number): void;
|
|
33
34
|
moveBy(dx: number, dy: number): void;
|
|
35
|
+
moveX(x: number): void;
|
|
36
|
+
moveY(y: number): void;
|
|
34
37
|
moveEnd(): void;
|
|
38
|
+
protected restrictPosition(x: number, y: number): IPoint;
|
|
35
39
|
protected isValidByParams(): boolean;
|
|
36
40
|
protected isValidByDistance(other: InteractiveCanvasItem): boolean;
|
|
37
41
|
protected distToPixels(value: number): number;
|
|
@@ -64,8 +64,8 @@ import { UnorderedListComponent } from "./components/unordered-list/unordered-li
|
|
|
64
64
|
import { UploadComponent } from "./components/upload/upload.component";
|
|
65
65
|
export declare const pipes: (typeof FilterPipe | typeof FormatNumberPipe | typeof GlobalTemplatePipe | typeof IncludesPipe | typeof ReducePipe | typeof RoundPipe | typeof SafeHtmlPipe | typeof TranslatePipe)[];
|
|
66
66
|
export declare const directives: (typeof AsyncMethodBase | typeof AsyncMethodTargetDirective | typeof BackgroundDirective | typeof ComponentLoaderDirective | typeof DynamicTableTemplateDirective | typeof GlobalTemplateDirective | typeof IconDirective | typeof NgxTemplateOutletDirective | typeof PaginationDirective | typeof PaginationItemDirective | typeof ResourceIfDirective | typeof StickyDirective | typeof StickyClassDirective | typeof DropdownDirective | typeof DropdownContentDirective | typeof TabsItemDirective | typeof UnorderedListItemDirective | typeof UnorderedListTemplateDirective)[];
|
|
67
|
-
export declare const components: (typeof ChipsComponent | typeof CloseBtnComponent | typeof DropListComponent | typeof DynamicTableComponent | typeof
|
|
68
|
-
export declare const providers: (typeof
|
|
67
|
+
export declare const components: (typeof ChipsComponent | typeof CloseBtnComponent | typeof DropListComponent | typeof DynamicTableComponent | typeof InteractiveCanvasComponent | typeof PaginationMenuComponent | typeof UnorderedListComponent | typeof UploadComponent)[];
|
|
68
|
+
export declare const providers: (typeof UniversalService | typeof StateService | typeof AuthGuard | typeof EventsService | typeof AclService | typeof BaseHttpClient | typeof StorageService | typeof CacheService | typeof BaseHttpService | typeof StaticAuthService | typeof ConfigService | typeof BaseDialogService | typeof ErrorHandlerService | typeof FormatterService | typeof GlobalTemplateService | typeof IconService | typeof StaticLanguageService | typeof OpenApiService | typeof BaseToasterService | typeof ComponentLoaderService | typeof TranslatedUrlSerializer | typeof PromiseService | typeof SocketService | typeof FilterPipe | typeof FormatNumberPipe | typeof GlobalTemplatePipe | typeof IncludesPipe | typeof ReducePipe | typeof RoundPipe | typeof SafeHtmlPipe | typeof TranslatePipe | typeof DeviceDetectorService | {
|
|
69
69
|
provide: import("@angular/core").InjectionToken<import("@angular/platform-browser").EventManagerPlugin[]>;
|
|
70
70
|
useClass: typeof DragDropEventPlugin;
|
|
71
71
|
multi: boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CanvasColor } from "../common-types";
|
|
2
2
|
export declare function drawRect(ctx: CanvasRenderingContext2D, w: number, h: number): void;
|
|
3
3
|
export declare function drawOval(ctx: CanvasRenderingContext2D, w: number, h: number): void;
|
|
4
|
+
export declare function drawPoint(ctx: CanvasRenderingContext2D): void;
|
|
4
5
|
export declare class CanvasUtils {
|
|
5
6
|
static manipulatePixels(canvas: HTMLCanvasElement, ctx: CanvasRenderingContext2D, colorTransformer: (color: CanvasColor, greyscale?: number) => CanvasColor): void;
|
|
6
7
|
static thresholding(canvas: HTMLCanvasElement, ctx: CanvasRenderingContext2D, threshold: number, colorTransformer: (color: CanvasColor, limit: boolean, greyscale?: number) => CanvasColor): void;
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { IPoint } from "../../common-types";
|
|
2
2
|
export declare function dotProduct(a: IPoint, b: IPoint): number;
|
|
3
|
+
export declare function tripleProduct(a: IPoint, b: IPoint, c: IPoint): IPoint;
|
|
3
4
|
export declare function isPoint(v: IPoint | number): v is IPoint;
|
|
5
|
+
export declare function ensurePoint(p: IPoint, fallback?: IPoint): IPoint;
|
|
4
6
|
export declare function perpendicular(p: IPoint): IPoint;
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function
|
|
7
|
+
export declare function negatePt(p: IPoint): IPoint;
|
|
8
|
+
export declare function normalizePt(p: IPoint): IPoint;
|
|
9
|
+
export declare function addPts(a: IPoint, b: IPoint): IPoint;
|
|
10
|
+
export declare function distanceSq(a: IPoint, b: IPoint): number;
|
|
11
|
+
export declare function distance(a: IPoint, b: IPoint): number;
|
|
12
|
+
export declare function lerpPts(a: IPoint, b: IPoint, t: number): IPoint;
|
|
13
|
+
export declare function lengthOfPt(p: IPoint): number;
|
|
14
|
+
export declare function multiplyPts(a: IPoint, b: IPoint | number): IPoint;
|
|
15
|
+
export declare function dividePts(a: IPoint, b: IPoint | number): IPoint;
|
|
16
|
+
export declare function subPts(a: IPoint, b: IPoint): IPoint;
|
|
10
17
|
export declare function rotateDeg(p: IPoint, ang: number): IPoint;
|
|
11
18
|
export declare function rotateRad(p: IPoint, ang: number): IPoint;
|
|
12
19
|
export declare function toDegrees(rad: number): number;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { gjkDistance, gjkIntersection } from "./gjk";
|
|
2
|
+
export { dotProduct, tripleProduct, isPoint, ensurePoint, perpendicular, negatePt, normalizePt, addPts, distanceSq, distance, lerpPts, lengthOfPt, multiplyPts, dividePts, subPts, rotateDeg, rotateRad, toDegrees, toRadians } from "./functions";
|
|
2
3
|
export { Circle, Point, Rect, Oval } from "./shapes";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IPoint, IShape } from "../../common-types";
|
|
1
|
+
import { IPoint, IShape, ShapeDistance, ShapeIntersection } from "../../common-types";
|
|
2
2
|
declare abstract class Shape implements IShape {
|
|
3
3
|
get center(): IPoint;
|
|
4
4
|
get x(): number;
|
|
@@ -6,8 +6,11 @@ declare abstract class Shape implements IShape {
|
|
|
6
6
|
protected pt: IPoint;
|
|
7
7
|
protected constructor(x: number, y: number);
|
|
8
8
|
abstract support(dir: IPoint): IPoint;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
abstract move(pos: IPoint): IShape;
|
|
10
|
+
intersection(shape: IShape): ShapeIntersection;
|
|
11
|
+
intersects(shape: IShape): boolean;
|
|
12
|
+
minDistance(shape: IShape): ShapeDistance;
|
|
13
|
+
distance(shape: IShape): number;
|
|
11
14
|
}
|
|
12
15
|
export declare class Point extends Shape {
|
|
13
16
|
static Zero: Point;
|
|
@@ -15,11 +18,12 @@ export declare class Point extends Shape {
|
|
|
15
18
|
get perpendicular(): Point;
|
|
16
19
|
constructor(xOrP: number | IPoint, y?: number);
|
|
17
20
|
support(): IPoint;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
move(pos: IPoint): IShape;
|
|
22
|
+
add(p: IPoint): Point;
|
|
23
|
+
subtract(p: IPoint): Point;
|
|
24
|
+
multiply(p: IPoint | number): Point;
|
|
25
|
+
divide(p: IPoint | number): Point;
|
|
26
|
+
dot(p: IPoint): Point;
|
|
23
27
|
lerp(p: Point, ratio: number): Point;
|
|
24
28
|
perpendicularTo(p: Point, length: number): Point;
|
|
25
29
|
circleWith(a: Point, b: Point): Circle;
|
|
@@ -33,6 +37,7 @@ export declare class Rect extends Shape {
|
|
|
33
37
|
readonly rotation: number;
|
|
34
38
|
constructor(x: number, y: number, width: number, height: number, rotation?: number);
|
|
35
39
|
support(dir: IPoint): IPoint;
|
|
40
|
+
move(pos: IPoint): Rect;
|
|
36
41
|
}
|
|
37
42
|
export declare class Oval extends Shape {
|
|
38
43
|
readonly width: number;
|
|
@@ -40,9 +45,11 @@ export declare class Oval extends Shape {
|
|
|
40
45
|
readonly rotation: number;
|
|
41
46
|
constructor(x: number, y: number, width: number, height: number, rotation?: number);
|
|
42
47
|
support(dir: IPoint): IPoint;
|
|
48
|
+
move(pos: IPoint): Oval;
|
|
43
49
|
}
|
|
44
50
|
export declare class Circle extends Oval {
|
|
45
51
|
readonly radius: number;
|
|
46
52
|
constructor(x: number, y: number, radius: number, rotation?: number);
|
|
53
|
+
move(pos: IPoint): Circle;
|
|
47
54
|
}
|
|
48
55
|
export {};
|
|
@@ -1,4 +1,38 @@
|
|
|
1
|
+
import { RangeCoords } from "../common-types";
|
|
1
2
|
export declare const EPSILON = 1e-9;
|
|
3
|
+
/**
|
|
4
|
+
* Normalize a range
|
|
5
|
+
* @param minOrRange
|
|
6
|
+
* @param max
|
|
7
|
+
*/
|
|
8
|
+
export declare function normalizeRange(minOrRange: number | RangeCoords, max?: number): RangeCoords;
|
|
9
|
+
/**
|
|
10
|
+
* Clamps a value to a range
|
|
11
|
+
* @param value
|
|
12
|
+
* @param min
|
|
13
|
+
* @param max
|
|
14
|
+
*/
|
|
15
|
+
export declare function clamp(value: number, min: number | RangeCoords, max?: number): number;
|
|
16
|
+
/**
|
|
17
|
+
* Clamps a value to a range in a way, that when it is over in one end, then it appears from the other end
|
|
18
|
+
* @param value
|
|
19
|
+
* @param min
|
|
20
|
+
* @param max
|
|
21
|
+
*/
|
|
22
|
+
export declare function overflow(value: number, min: number | RangeCoords, max?: number): number;
|
|
23
|
+
/**
|
|
24
|
+
* Checks if a number is equal to b number with epsilon tolerance
|
|
25
|
+
* @param a
|
|
26
|
+
* @param b
|
|
27
|
+
* @param epsilon
|
|
28
|
+
*/
|
|
29
|
+
export declare function isEqual(a: number, b: number, epsilon?: number): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Checks if a number is equal to zero with epsilon tolerance
|
|
32
|
+
* @param a
|
|
33
|
+
* @param epsilon
|
|
34
|
+
*/
|
|
35
|
+
export declare function isZero(a: number, epsilon?: number): boolean;
|
|
2
36
|
export declare class MathUtils {
|
|
3
37
|
static equal(a: number, b: number, epsilon?: number): boolean;
|
|
4
38
|
static clamp(value: number, min: number, max: number): number;
|
package/package.json
CHANGED
package/public_api.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "zone.js";
|
|
2
2
|
export { MaybePromise, MaybeArray, KeysOfType, ObjOfType, StringKeys, CapitalizeFirst, CamelJoin, PrefixedPick } from "./ngx-utils/helper-types";
|
|
3
|
-
export { DurationUnit, TypedFactoryProvider, TypedValueProvider, TypedExistingProvider, TypedClassProvider, TypedTokenProvider, TypedProvider, CachedFactory, ResolveFactory, IResolveFactory, CanvasColor, IIconService, ITranslation, ITranslations, ILanguageSetting, ILanguageSettings, ILanguageService, IUserData, IAuthService, RouteValidator, IRouteData, IRoute, IAclComponent, IDialogButtonConfig, IDialogConfig, IConfirmMessageConfig, IConfirmDialogConfig, IDialogService, IPromiseService, IRouteStateInfo, NavigationUrlParam, StorageMode, ToastType, IToasterService, IAsyncMessage, AsyncMethod, IconMap, IconProps, ButtonType, ButtonSize, ButtonProps, TabValue, TabOption, ChipValue, ChipStatus, ChipOption, DropdownAttachTo, UnorderedListTemplate, UnorderedListTemplates, UnorderedListStyle, UploadType, IFileUploadResult, IFileUploadProcess, IAjaxRequestDetails, AjaxRequestCallback, ScriptType, ILoadableElement, ILoaderPromises, ISearchObservable, FactoryDependencies, ObjectType, ITimer, IExtraProperties, IGroupMap, TranslationQuery, IPageInfo, IPaginationData, PaginationDataLoader, PaginationItemContext, IPoint, IShape, CanvasItemDirection, CanvasPaintFunc, InteractiveCanvasItem, InteractiveCanvasItems, InteractiveCanvas, InteractiveCanvasRenderer, InteractivePanEvent, InteractiveCanvasPointer, HttpRequestHeaders, HttpRequestQuery, HttpClientRequestOptions, HttpRequestOptions, UploadData, IIssueContext, IProgress, ProgressListener, CacheExpireMode, IHttpService, IApiService, DynamicSchemaRef, OpenApiSchemaProperty, OpenApiSchema, OpenApiSchemas, TableFilterType, ITableOrders, ITableColumn, ITableColumns, TableColumns, ITableTemplate, ITableTemplates, ITableDataQuery, TableDataItems, TableDataLoader, DragDropEvent, DragEventHandler, ITableDragEvent, DynamicTableDragHandler, ResourceIfContext, CssSelector, CssSelectorList, DynamicComponentLocation, DynamicModuleInfo, DynamicEntryComponents, IConfiguration, IConfigService, ResizeEventStrategy, ErrorHandlerCallback, GlobalComponentModifier, AppInitializerFunc, IModuleConfig, ValuedPromise } from "./ngx-utils/common-types";
|
|
3
|
+
export { DurationUnit, TypedFactoryProvider, TypedValueProvider, TypedExistingProvider, TypedClassProvider, TypedTokenProvider, TypedProvider, CachedFactory, ResolveFactory, IResolveFactory, CanvasColor, IIconService, ITranslation, ITranslations, ILanguageSetting, ILanguageSettings, ILanguageService, IUserData, IAuthService, RouteValidator, IRouteData, IRoute, IAclComponent, IDialogButtonConfig, IDialogConfig, IConfirmMessageConfig, IConfirmDialogConfig, IDialogService, IPromiseService, IRouteStateInfo, NavigationUrlParam, StorageMode, ToastType, IToasterService, IAsyncMessage, AsyncMethod, IconMap, IconProps, ButtonType, ButtonSize, ButtonProps, TabValue, TabOption, ChipValue, ChipStatus, ChipOption, DropdownAttachTo, UnorderedListTemplate, UnorderedListTemplates, UnorderedListStyle, UploadType, IFileUploadResult, IFileUploadProcess, IAjaxRequestDetails, AjaxRequestCallback, ScriptType, ILoadableElement, ILoaderPromises, ISearchObservable, FactoryDependencies, ObjectType, ITimer, IExtraProperties, IGroupMap, TranslationQuery, IPageInfo, IPaginationData, PaginationDataLoader, PaginationItemContext, IPoint, ShapeIntersection, ShapeDistance, IShape, CanvasResizeMode, CanvasItemDirection, CanvasPaintFunc, RangeCoords, RectCoords, InteractiveCanvasParams, InteractiveCanvasItem, InteractiveCanvasItems, InteractiveCanvas, InteractiveCanvasRenderer, InteractivePanEvent, InteractiveCanvasPointer, HttpRequestHeaders, HttpRequestQuery, HttpClientRequestOptions, HttpRequestOptions, UploadData, IIssueContext, IProgress, ProgressListener, CacheExpireMode, IHttpService, IApiService, DynamicSchemaRef, OpenApiSchemaProperty, OpenApiSchema, OpenApiSchemas, TableFilterType, ITableOrders, ITableColumn, ITableColumns, TableColumns, ITableTemplate, ITableTemplates, ITableDataQuery, TableDataItems, TableDataLoader, DragDropEvent, DragEventHandler, ITableDragEvent, DynamicTableDragHandler, ResourceIfContext, CssSelector, CssSelectorList, DynamicComponentLocation, DynamicModuleInfo, DynamicEntryComponents, IConfiguration, IConfigService, ResizeEventStrategy, ErrorHandlerCallback, GlobalComponentModifier, AppInitializerFunc, IModuleConfig, ValuedPromise } from "./ngx-utils/common-types";
|
|
4
4
|
export { ICON_TYPE, ICON_MAP, BUTTON_TYPE, ERROR_HANDLER, STATIC_SCHEMAS, RESIZE_STRATEGY, RESIZE_DELAY, ROOT_ELEMENT, SCRIPT_PARAMS, BASE_CONFIG, CONFIG_SERVICE, APP_BASE_URL, API_SERVICE, EXPRESS_REQUEST, PROMISE_SERVICE, DIALOG_SERVICE, TOASTER_SERVICE, AUTH_SERVICE, LANGUAGE_SERVICE, ICON_SERVICE, OPTIONS_TOKEN } from "./ngx-utils/tokens";
|
|
5
5
|
export { AjaxRequestHandler } from "./ngx-utils/utils/ajax-request-handler";
|
|
6
6
|
export { ArrayUtils } from "./ngx-utils/utils/array.utils";
|
|
@@ -12,12 +12,12 @@ export { FileUtils } from "./ngx-utils/utils/file.utils";
|
|
|
12
12
|
export { ForbiddenZone } from "./ngx-utils/utils/forbidden-zone";
|
|
13
13
|
export { GenericValue } from "./ngx-utils/utils/generic-value";
|
|
14
14
|
export { FileSystemEntryOpenResult, FileSystemEntryOpenCb, FileSystemEntry } from "./ngx-utils/utils/file-system";
|
|
15
|
-
export { dotProduct, isPoint, perpendicular,
|
|
15
|
+
export { dotProduct, tripleProduct, isPoint, ensurePoint, perpendicular, negatePt, normalizePt, addPts, distanceSq, distance, lerpPts, lengthOfPt, multiplyPts, dividePts, subPts, rotateDeg, rotateRad, toDegrees, toRadians, gjkDistance, gjkIntersection, Point, Rect, Oval, Circle } from "./ngx-utils/utils/geometry";
|
|
16
16
|
export { Initializer } from "./ngx-utils/utils/initializer";
|
|
17
17
|
export { JSONfn } from "./ngx-utils/utils/jsonfn";
|
|
18
18
|
export { ReflectUtils } from "./ngx-utils/utils/reflect.utils";
|
|
19
19
|
export { LoaderUtils } from "./ngx-utils/utils/loader.utils";
|
|
20
|
-
export { MathUtils } from "./ngx-utils/utils/math.utils";
|
|
20
|
+
export { EPSILON, normalizeRange, clamp, overflow, MathUtils } from "./ngx-utils/utils/math.utils";
|
|
21
21
|
export { isBrowser, getRoot, hashCode, switchClass, getCssVariables, checkTransitions, getComponentDef, parseSelector, selectorMatchesList, provideEntryComponents, provideWithOptions } from "./ngx-utils/utils/misc";
|
|
22
22
|
export { ObjectUtils } from "./ngx-utils/utils/object.utils";
|
|
23
23
|
export { ObservableUtils, ISubscriberInfo } from "./ngx-utils/utils/observable.utils";
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { IPoint, IShape } from "../../common-types";
|
|
2
|
-
interface SimplexLine {
|
|
3
|
-
p: IPoint;
|
|
4
|
-
a: IPoint;
|
|
5
|
-
b: IPoint;
|
|
6
|
-
}
|
|
7
|
-
type Simplex = SimplexLine[];
|
|
8
|
-
interface ClosestPointResult {
|
|
9
|
-
simplex: Simplex;
|
|
10
|
-
closest: IPoint;
|
|
11
|
-
bary: number[];
|
|
12
|
-
}
|
|
13
|
-
export declare function closestPointToOrigin(simplex: Simplex): ClosestPointResult;
|
|
14
|
-
/**
|
|
15
|
-
* ====== GJK distance (2D) ======
|
|
16
|
-
* We keep, for each simplex vertex, the Minkowski point p = a - b and the witnesses a,b.
|
|
17
|
-
* @param A
|
|
18
|
-
* @param B
|
|
19
|
-
*/
|
|
20
|
-
export declare function gjkDistance(A: IShape, B: IShape): {
|
|
21
|
-
distance: number;
|
|
22
|
-
pa: IPoint;
|
|
23
|
-
pb: IPoint;
|
|
24
|
-
};
|
|
25
|
-
export {};
|