@stemy/ngx-utils 19.6.12 → 19.7.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/fesm2022/stemy-ngx-utils.mjs +669 -798
- package/fesm2022/stemy-ngx-utils.mjs.map +1 -1
- package/ngx-utils/common-types.d.ts +22 -36
- package/ngx-utils/components/interactive-canvas/interactive-canvas.component.d.ts +31 -15
- package/ngx-utils/components/interactive-canvas/interactive-circle.component.d.ts +4 -8
- package/ngx-utils/components/interactive-canvas/interactive-item.component.d.ts +23 -21
- package/ngx-utils/components/interactive-canvas/interactive-rect.component.d.ts +6 -9
- package/ngx-utils/ngx-utils.imports.d.ts +2 -5
- package/ngx-utils/tokens.d.ts +1 -2
- package/ngx-utils/utils/{canvas.utils.d.ts → canvas.d.ts} +2 -0
- package/ngx-utils/utils/geometry/distance.d.ts +25 -0
- package/ngx-utils/utils/geometry/functions.d.ts +13 -0
- package/ngx-utils/utils/geometry/index.d.ts +2 -0
- package/ngx-utils/utils/geometry/shapes.d.ts +48 -0
- package/ngx-utils/utils/misc.d.ts +2 -1
- package/package.json +1 -1
- package/public_api.d.ts +5 -8
- package/ngx-utils/services/wasm.service.d.ts +0 -25
- package/ngx-utils/utils/geometry.d.ts +0 -46
- package/ngx-utils/utils/vector.d.ts +0 -23
- package/ngx-utils/utils/wasi.d.ts +0 -26
- package/ngx-utils/utils/wasm-worker-proxy.d.ts +0 -17
- package/ngx-utils/utils/with-options-provider.d.ts +0 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'zone.js';
|
|
2
2
|
import 'reflect-metadata';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { InjectionToken, PLATFORM_ID, Inject, Injectable, Optional, Injector, untracked, computed, signal, inject, DestroyRef, isDevMode, ErrorHandler, EventEmitter, createComponent, NgZone, Pipe, input, output, ChangeDetectorRef, ElementRef, effect, HostListener, Directive, Input, HostBinding, Output, TemplateRef, ChangeDetectionStrategy, ViewEncapsulation, Component, ViewChild, forwardRef, ContentChild, ContentChildren, model, contentChildren,
|
|
4
|
+
import { InjectionToken, PLATFORM_ID, Inject, Injectable, Optional, Injector, untracked, computed, signal, inject, DestroyRef, isDevMode, ErrorHandler, EventEmitter, createComponent, NgZone, Pipe, input, output, ChangeDetectorRef, ElementRef, effect, HostListener, Directive, Input, HostBinding, Output, TemplateRef, ChangeDetectionStrategy, ViewEncapsulation, Component, ViewChild, forwardRef, ContentChild, ContentChildren, model, contentChildren, provideAppInitializer, makeEnvironmentProviders, NgModule } from '@angular/core';
|
|
5
5
|
import * as i2 from '@angular/router';
|
|
6
6
|
import { ActivatedRouteSnapshot, Scroll, NavigationEnd, Router, DefaultUrlSerializer, UrlTree, UrlSegmentGroup, UrlSegment, UrlSerializer, ROUTES } from '@angular/router';
|
|
7
7
|
import { BehaviorSubject, Observable, firstValueFrom, Subject, Subscription, from, delay, timer, TimeoutError, combineLatest, lastValueFrom } from 'rxjs';
|
|
@@ -471,7 +471,6 @@ const TOASTER_SERVICE = new InjectionToken("toaster-service");
|
|
|
471
471
|
const DIALOG_SERVICE = new InjectionToken("dialog-service");
|
|
472
472
|
const SOCKET_IO_PATH = new InjectionToken("socket-io-path");
|
|
473
473
|
const PROMISE_SERVICE = new InjectionToken("promise-service");
|
|
474
|
-
const WASI_IMPLEMENTATION = new InjectionToken("wasi-implementation");
|
|
475
474
|
const EXPRESS_REQUEST = new InjectionToken("express-request");
|
|
476
475
|
const API_SERVICE = new InjectionToken("api-service");
|
|
477
476
|
const DYNAMIC_ENTRY_COMPONENTS = new InjectionToken("dynamic-entry-components");
|
|
@@ -1137,6 +1136,16 @@ const shg_table = [
|
|
|
1137
1136
|
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
|
1138
1137
|
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24
|
|
1139
1138
|
];
|
|
1139
|
+
function drawRect(ctx, w, h) {
|
|
1140
|
+
ctx.beginPath();
|
|
1141
|
+
ctx.rect(-w / 2, -h / 2, w, h);
|
|
1142
|
+
ctx.closePath();
|
|
1143
|
+
}
|
|
1144
|
+
function drawOval(ctx, w, h) {
|
|
1145
|
+
ctx.beginPath();
|
|
1146
|
+
ctx.ellipse(0, 0, w / 2, h / 2, 0, 0, Math.PI * 2);
|
|
1147
|
+
ctx.closePath();
|
|
1148
|
+
}
|
|
1140
1149
|
class CanvasUtils {
|
|
1141
1150
|
static manipulatePixels(canvas, ctx, colorTransformer) {
|
|
1142
1151
|
const imgData = ctx.getImageData(0, 0, canvas.width, canvas.height);
|
|
@@ -1720,102 +1729,228 @@ class FileSystemEntry {
|
|
|
1720
1729
|
}
|
|
1721
1730
|
}
|
|
1722
1731
|
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
}
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1732
|
+
function dotProduct(a, b) {
|
|
1733
|
+
return a.x * b.x + a.y * b.y;
|
|
1734
|
+
}
|
|
1735
|
+
function isPoint(v) {
|
|
1736
|
+
return typeof v === "object" && !isNaN(v.x) && !isNaN(v.y);
|
|
1737
|
+
}
|
|
1738
|
+
function perpendicular(p) {
|
|
1739
|
+
return { x: -p.y, y: +p.x };
|
|
1740
|
+
}
|
|
1741
|
+
function ptAdd(a, b) {
|
|
1742
|
+
return { x: a.x + b.x, y: a.y + b.y };
|
|
1743
|
+
}
|
|
1744
|
+
function ptDistance(a, b) {
|
|
1745
|
+
const x = b.x - a.x;
|
|
1746
|
+
const y = b.y - a.y;
|
|
1747
|
+
return Math.sqrt(x * x + y * y);
|
|
1748
|
+
}
|
|
1749
|
+
function ptLength(p) {
|
|
1750
|
+
return Math.hypot(p.x, p.y);
|
|
1751
|
+
}
|
|
1752
|
+
function ptMultiply(a, b) {
|
|
1753
|
+
const s = isPoint(b) ? b : { x: b, y: b };
|
|
1754
|
+
return { x: a.x * s.x, y: a.y * s.y };
|
|
1755
|
+
}
|
|
1756
|
+
function ptSubtract(a, b) {
|
|
1757
|
+
return { x: a.x - b.x, y: a.y - b.y };
|
|
1758
|
+
}
|
|
1759
|
+
function rotateDeg(p, ang) {
|
|
1760
|
+
return rotateRad(p, toRadians(ang));
|
|
1761
|
+
}
|
|
1762
|
+
function rotateRad(p, ang) {
|
|
1763
|
+
const c = Math.cos(ang), s = Math.sin(ang);
|
|
1764
|
+
return { x: p.x * c - p.y * s, y: p.x * s + p.y * c };
|
|
1765
|
+
}
|
|
1766
|
+
function toDegrees(rad) {
|
|
1767
|
+
return rad * 180 / Math.PI;
|
|
1768
|
+
}
|
|
1769
|
+
function toRadians(deg) {
|
|
1770
|
+
return deg * Math.PI / 180;
|
|
1771
|
+
}
|
|
1772
|
+
|
|
1773
|
+
function combineA(simplex, bary) {
|
|
1774
|
+
let out = { x: 0, y: 0 };
|
|
1775
|
+
for (let i = 0; i < simplex.length; i++)
|
|
1776
|
+
out = ptAdd(out, ptMultiply(simplex[i].a, bary[i] || 0));
|
|
1777
|
+
return out;
|
|
1778
|
+
}
|
|
1779
|
+
function combineB(simplex, bary) {
|
|
1780
|
+
let out = { x: 0, y: 0 };
|
|
1781
|
+
for (let i = 0; i < simplex.length; i++)
|
|
1782
|
+
out = ptAdd(out, ptMultiply(simplex[i].b, bary[i] || 0));
|
|
1783
|
+
return out;
|
|
1784
|
+
}
|
|
1785
|
+
function closestPointToOrigin(simplex) {
|
|
1786
|
+
// returns { simplex: prunedSimplex, closest: vec, bary: weights[] }
|
|
1787
|
+
if (simplex.length === 1) {
|
|
1788
|
+
return { simplex, closest: simplex[0].p, bary: [1] };
|
|
1789
|
+
}
|
|
1790
|
+
if (simplex.length === 2) {
|
|
1791
|
+
const A = simplex[0], B = simplex[1];
|
|
1792
|
+
const ab = ptSubtract(B.p, A.p);
|
|
1793
|
+
const ab2 = dotProduct(ab, ab);
|
|
1794
|
+
if (ab2 <= 1e-18) {
|
|
1795
|
+
return { simplex: [B], closest: B.p, bary: [1] };
|
|
1796
|
+
}
|
|
1797
|
+
const t = Math.max(0, Math.min(1, -dotProduct(A.p, ab) / ab2));
|
|
1798
|
+
const closest = ptAdd(A.p, ptMultiply(ab, t));
|
|
1799
|
+
if (t <= 1e-9) {
|
|
1800
|
+
return { simplex: [A], closest: A.p, bary: [1] };
|
|
1801
|
+
}
|
|
1802
|
+
if (t >= 1 - 1e-9) {
|
|
1803
|
+
return { simplex: [B], closest: B.p, bary: [1] };
|
|
1804
|
+
}
|
|
1805
|
+
return { simplex: [A, B], closest, bary: [1 - t, t] };
|
|
1806
|
+
}
|
|
1807
|
+
// Triangle case (A,B,C) – use Ericson's closest-point to triangle (p=origin)
|
|
1808
|
+
const A = simplex[0], B = simplex[1], C = simplex[2];
|
|
1809
|
+
const a = A.p, b = B.p, c = C.p;
|
|
1810
|
+
const ab = ptSubtract(b, a), ac = ptSubtract(c, a), ap = { x: -a.x, y: -a.y };
|
|
1811
|
+
const d1 = dotProduct(ab, ap), d2 = dotProduct(ac, ap);
|
|
1812
|
+
if (d1 <= 0 && d2 <= 0)
|
|
1813
|
+
return { simplex: [A], closest: a, bary: [1] };
|
|
1814
|
+
const bp = { x: -b.x, y: -b.y };
|
|
1815
|
+
const d3 = dotProduct(ab, bp), d4 = dotProduct(ac, bp);
|
|
1816
|
+
if (d3 >= 0 && d4 <= d3)
|
|
1817
|
+
return { simplex: [B], closest: b, bary: [1] };
|
|
1818
|
+
const vc = d1 * d4 - d3 * d2;
|
|
1819
|
+
if (vc <= 0 && d1 >= 0 && d3 <= 0) {
|
|
1820
|
+
const v = d1 / (d1 - d3);
|
|
1821
|
+
const closest = ptAdd(a, ptMultiply(ab, v));
|
|
1822
|
+
return { simplex: [A, B], closest, bary: [1 - v, v] };
|
|
1823
|
+
}
|
|
1824
|
+
const cp = { x: -c.x, y: -c.y };
|
|
1825
|
+
const bc = ptSubtract(c, b);
|
|
1826
|
+
const d5 = dotProduct(bc, cp), d6 = dotProduct(ac, cp);
|
|
1827
|
+
if (d6 >= 0 && d5 <= d6)
|
|
1828
|
+
return { simplex: [C], closest: c, bary: [1] };
|
|
1829
|
+
const vb = d5 * d2 - d1 * d6;
|
|
1830
|
+
if (vb <= 0 && d2 >= 0 && d6 <= 0) {
|
|
1831
|
+
const w = d2 / (d2 - d6);
|
|
1832
|
+
const closest = ptAdd(a, ptMultiply(ac, w));
|
|
1833
|
+
return { simplex: [A, C], closest, bary: [1 - w, 0, w] };
|
|
1834
|
+
}
|
|
1835
|
+
const va = d3 * d6 - d5 * d4;
|
|
1836
|
+
if (va <= 0) {
|
|
1837
|
+
const denom = (d4 - d3) + (d5 - d6);
|
|
1838
|
+
const w = denom !== 0 ? (d4 - d3) / denom : 0.5;
|
|
1839
|
+
const closest = ptAdd(b, ptMultiply(bc, w));
|
|
1840
|
+
return { simplex: [B, C], closest, bary: [0, 1 - w, w] };
|
|
1841
|
+
}
|
|
1842
|
+
// Origin inside triangle – distance is zero
|
|
1843
|
+
return { simplex: [A, B, C], closest: { x: 0, y: 0 }, bary: [0, 0, 0] };
|
|
1752
1844
|
}
|
|
1753
|
-
|
|
1845
|
+
/**
|
|
1846
|
+
* ====== GJK distance (2D) ======
|
|
1847
|
+
* We keep, for each simplex vertex, the Minkowski point p = a - b and the witnesses a,b.
|
|
1848
|
+
* @param A
|
|
1849
|
+
* @param B
|
|
1850
|
+
*/
|
|
1851
|
+
function gjkDistance(A, B) {
|
|
1852
|
+
const MAX = 64, EPS = 1e-9;
|
|
1853
|
+
const centerA = { x: A.x, y: A.y }, centerB = { x: B.x, y: B.y };
|
|
1854
|
+
let d = ptSubtract(centerB, centerA);
|
|
1855
|
+
if (Math.abs(d.x) < EPS && Math.abs(d.y) < EPS)
|
|
1856
|
+
d = { x: 1, y: 0 };
|
|
1857
|
+
const sup = (dir) => {
|
|
1858
|
+
const a = A.support(dir);
|
|
1859
|
+
const b = B.support({ x: -dir.x, y: -dir.y });
|
|
1860
|
+
return { p: ptSubtract(a, b), a, b };
|
|
1861
|
+
};
|
|
1862
|
+
let simplex = [sup(d)];
|
|
1863
|
+
let closest = simplex[0].p; // vector to origin
|
|
1864
|
+
let dir = { x: -closest.x, y: -closest.y };
|
|
1865
|
+
let best2 = dotProduct(closest, closest);
|
|
1866
|
+
for (let iter = 0; iter < MAX; iter++) {
|
|
1867
|
+
if (ptLength(dir) <= EPS) { // origin reached
|
|
1868
|
+
const a = simplex[simplex.length - 1].a, b = simplex[simplex.length - 1].b;
|
|
1869
|
+
return { distance: 0, pa: a, pb: b };
|
|
1870
|
+
}
|
|
1871
|
+
const vtx = sup(dir);
|
|
1872
|
+
// termination: support didn't pass beyond previous closest along dir
|
|
1873
|
+
if (dotProduct(vtx.p, dir) - Math.sqrt(best2) <= EPS) {
|
|
1874
|
+
break;
|
|
1875
|
+
}
|
|
1876
|
+
simplex.push(vtx);
|
|
1877
|
+
const reduced = closestPointToOrigin(simplex);
|
|
1878
|
+
simplex = reduced.simplex;
|
|
1879
|
+
closest = reduced.closest;
|
|
1880
|
+
best2 = dotProduct(closest, closest);
|
|
1881
|
+
dir = { x: -closest.x, y: -closest.y };
|
|
1882
|
+
if (best2 <= EPS * EPS) {
|
|
1883
|
+
const pa = combineA(simplex, reduced.bary);
|
|
1884
|
+
const pb = combineB(simplex, reduced.bary);
|
|
1885
|
+
return { distance: 0, pa, pb };
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
const res = closestPointToOrigin(simplex);
|
|
1889
|
+
const pa = combineA(simplex, res.bary);
|
|
1890
|
+
const pb = combineB(simplex, res.bary);
|
|
1891
|
+
return { distance: Math.sqrt(dotProduct(res.closest, res.closest)), pa, pb };
|
|
1892
|
+
}
|
|
1893
|
+
|
|
1894
|
+
class Shape {
|
|
1754
1895
|
get center() {
|
|
1755
|
-
return
|
|
1756
|
-
}
|
|
1757
|
-
get left() {
|
|
1758
|
-
return new Point(this.x - this.radius, this.y);
|
|
1759
|
-
}
|
|
1760
|
-
get right() {
|
|
1761
|
-
return new Point(this.x + this.radius, this.y);
|
|
1896
|
+
return this.pt;
|
|
1762
1897
|
}
|
|
1763
|
-
get
|
|
1764
|
-
return
|
|
1765
|
-
}
|
|
1766
|
-
get bottom() {
|
|
1767
|
-
return new Point(this.x, this.y - this.radius);
|
|
1898
|
+
get x() {
|
|
1899
|
+
return this.center.x;
|
|
1768
1900
|
}
|
|
1769
|
-
get
|
|
1770
|
-
return
|
|
1901
|
+
get y() {
|
|
1902
|
+
return this.center.y;
|
|
1771
1903
|
}
|
|
1772
|
-
constructor(x, y
|
|
1773
|
-
this.
|
|
1774
|
-
this.y = y;
|
|
1775
|
-
this.radius = radius;
|
|
1904
|
+
constructor(x, y) {
|
|
1905
|
+
this.pt = { x, y };
|
|
1776
1906
|
}
|
|
1777
1907
|
distance(p) {
|
|
1778
|
-
return this.center
|
|
1908
|
+
return ptDistance(this.center, p);
|
|
1909
|
+
}
|
|
1910
|
+
minDistance(shape) {
|
|
1911
|
+
return gjkDistance(this, shape).distance;
|
|
1779
1912
|
}
|
|
1780
1913
|
}
|
|
1781
|
-
class Point {
|
|
1914
|
+
class Point extends Shape {
|
|
1782
1915
|
static { this.Zero = new Point(0, 0); }
|
|
1783
1916
|
get length() {
|
|
1784
|
-
return this
|
|
1917
|
+
return ptLength(this);
|
|
1785
1918
|
}
|
|
1786
1919
|
get perpendicular() {
|
|
1787
|
-
return new Point(this
|
|
1920
|
+
return new Point(perpendicular(this));
|
|
1788
1921
|
}
|
|
1789
|
-
constructor(
|
|
1790
|
-
|
|
1791
|
-
|
|
1922
|
+
constructor(xOrP, y = 0) {
|
|
1923
|
+
super(0, y);
|
|
1924
|
+
const x = Number(xOrP);
|
|
1925
|
+
this.pt = isPoint(xOrP) ? xOrP : { x: isNaN(x) ? 0 : xOrP, y };
|
|
1926
|
+
}
|
|
1927
|
+
support() {
|
|
1928
|
+
return this.pt;
|
|
1792
1929
|
}
|
|
1793
1930
|
add(p) {
|
|
1794
|
-
return new Point(this
|
|
1931
|
+
return new Point(ptAdd(this, p));
|
|
1795
1932
|
}
|
|
1796
|
-
|
|
1797
|
-
return new Point(this
|
|
1933
|
+
sub(p) {
|
|
1934
|
+
return new Point(ptSubtract(this, p));
|
|
1798
1935
|
}
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
return new Point(this
|
|
1936
|
+
mul(p) {
|
|
1937
|
+
return new Point(ptMultiply(this, p));
|
|
1938
|
+
}
|
|
1939
|
+
dot(p) {
|
|
1940
|
+
return new Point(dotProduct(this, p));
|
|
1804
1941
|
}
|
|
1805
|
-
distance(
|
|
1806
|
-
|
|
1807
|
-
const y = b.y - this.y;
|
|
1808
|
-
return Math.sqrt(x * x + y * y);
|
|
1942
|
+
distance(p) {
|
|
1943
|
+
return ptDistance(this, p);
|
|
1809
1944
|
}
|
|
1810
1945
|
lerp(p, ratio) {
|
|
1811
|
-
const diff = p.
|
|
1812
|
-
return this.add(diff.
|
|
1946
|
+
const diff = p.sub(this);
|
|
1947
|
+
return this.add(diff.mul(ratio));
|
|
1813
1948
|
}
|
|
1814
1949
|
perpendicularTo(p, length) {
|
|
1815
|
-
const diff = p.perpendicular.
|
|
1950
|
+
const diff = p.perpendicular.sub(this.perpendicular);
|
|
1816
1951
|
const ratio = length / diff.length;
|
|
1817
1952
|
const center = this.lerp(p, .5);
|
|
1818
|
-
return center.add(diff.
|
|
1953
|
+
return center.add(diff.mul(ratio));
|
|
1819
1954
|
}
|
|
1820
1955
|
circleWith(a, b) {
|
|
1821
1956
|
const yDelta_a = b.y - a.y;
|
|
@@ -1830,8 +1965,8 @@ class Point {
|
|
|
1830
1965
|
return new Circle(center.x, center.y, center.distance(this));
|
|
1831
1966
|
}
|
|
1832
1967
|
tangents(c) {
|
|
1833
|
-
const pd = c.center
|
|
1834
|
-
const a = Math.asin(c.radius / pd
|
|
1968
|
+
const pd = ptSubtract(c.center, this);
|
|
1969
|
+
const a = Math.asin(c.radius / ptLength(pd));
|
|
1835
1970
|
const b = Math.atan2(pd.y, pd.x);
|
|
1836
1971
|
// Tangent points
|
|
1837
1972
|
let t = b - a;
|
|
@@ -1841,7 +1976,7 @@ class Point {
|
|
|
1841
1976
|
return [t1, t2];
|
|
1842
1977
|
}
|
|
1843
1978
|
angle(p) {
|
|
1844
|
-
const diff = p.
|
|
1979
|
+
const diff = p.sub(this);
|
|
1845
1980
|
return Math.atan2(diff.y, diff.x) * 180 / Math.PI;
|
|
1846
1981
|
}
|
|
1847
1982
|
rotateAround(p, angle) {
|
|
@@ -1851,6 +1986,48 @@ class Point {
|
|
|
1851
1986
|
return p.add(rotated);
|
|
1852
1987
|
}
|
|
1853
1988
|
}
|
|
1989
|
+
class Rect extends Shape {
|
|
1990
|
+
constructor(x, y, width, height, rotation = 0) {
|
|
1991
|
+
super(x, y);
|
|
1992
|
+
this.width = width;
|
|
1993
|
+
this.height = height;
|
|
1994
|
+
this.rotation = rotation;
|
|
1995
|
+
}
|
|
1996
|
+
support(dir) {
|
|
1997
|
+
const ang = this.rotation ?? 0;
|
|
1998
|
+
const dLocal = rotateDeg(dir, -ang);
|
|
1999
|
+
const hw = Math.max(0, this.width / 2), hh = Math.max(0, this.height / 2);
|
|
2000
|
+
const lx = dLocal.x >= 0 ? hw : -hw;
|
|
2001
|
+
const ly = dLocal.y >= 0 ? hh : -hh;
|
|
2002
|
+
return ptAdd(rotateDeg({ x: lx, y: ly }, ang), { x: this.x, y: this.y });
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
class Oval extends Shape {
|
|
2006
|
+
constructor(x, y, width, height, rotation = 0) {
|
|
2007
|
+
super(x, y);
|
|
2008
|
+
this.width = width;
|
|
2009
|
+
this.height = height;
|
|
2010
|
+
this.rotation = rotation;
|
|
2011
|
+
}
|
|
2012
|
+
support(dir) {
|
|
2013
|
+
const ang = this.rotation ?? 0;
|
|
2014
|
+
const d = rotateDeg(dir, -ang);
|
|
2015
|
+
const a = Math.max(0, this.width / 2);
|
|
2016
|
+
const b = Math.max(0, this.height / 2);
|
|
2017
|
+
if (Math.abs(d.x) < 1e-12 && Math.abs(d.y) < 1e-12)
|
|
2018
|
+
return { x: this.x, y: this.y };
|
|
2019
|
+
const q = Math.hypot(a * d.x, b * d.y) || 1; // sqrt((a*dx)^2 + (b*dy)^2)
|
|
2020
|
+
const lx = (a * a * d.x) / q;
|
|
2021
|
+
const ly = (b * b * d.y) / q;
|
|
2022
|
+
return ptAdd(rotateDeg({ x: lx, y: ly }, ang), { x: this.x, y: this.y });
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
class Circle extends Oval {
|
|
2026
|
+
constructor(x, y, radius, rotation = 0) {
|
|
2027
|
+
super(x, y, radius * 2, radius * 2, rotation);
|
|
2028
|
+
this.radius = radius;
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
1854
2031
|
|
|
1855
2032
|
class Initializer {
|
|
1856
2033
|
get isInitialized() {
|
|
@@ -2158,6 +2335,27 @@ function provideEntryComponents(components, moduleId) {
|
|
|
2158
2335
|
multi: true
|
|
2159
2336
|
};
|
|
2160
2337
|
}
|
|
2338
|
+
function provideWithOptions(type, options) {
|
|
2339
|
+
return {
|
|
2340
|
+
useFactory: function (parent) {
|
|
2341
|
+
const providers = [
|
|
2342
|
+
{
|
|
2343
|
+
provide: OPTIONS_TOKEN,
|
|
2344
|
+
useValue: options
|
|
2345
|
+
},
|
|
2346
|
+
{
|
|
2347
|
+
provide: type,
|
|
2348
|
+
useClass: type
|
|
2349
|
+
}
|
|
2350
|
+
];
|
|
2351
|
+
return Injector.create({
|
|
2352
|
+
providers,
|
|
2353
|
+
parent
|
|
2354
|
+
}).get(type, null, { optional: true });
|
|
2355
|
+
},
|
|
2356
|
+
deps: [Injector]
|
|
2357
|
+
};
|
|
2358
|
+
}
|
|
2161
2359
|
|
|
2162
2360
|
class TimerUtils {
|
|
2163
2361
|
static createTimeout(func, time) {
|
|
@@ -2575,202 +2773,112 @@ class UniqueUtils {
|
|
|
2575
2773
|
}
|
|
2576
2774
|
}
|
|
2577
2775
|
|
|
2578
|
-
class
|
|
2579
|
-
get
|
|
2580
|
-
return
|
|
2581
|
-
}
|
|
2582
|
-
get length() {
|
|
2583
|
-
return Math.sqrt(this.dot(this));
|
|
2584
|
-
}
|
|
2585
|
-
get unit() {
|
|
2586
|
-
return this.divide(this.length);
|
|
2776
|
+
class EventsService {
|
|
2777
|
+
get isSticky() {
|
|
2778
|
+
return this.sticky;
|
|
2587
2779
|
}
|
|
2588
|
-
get
|
|
2589
|
-
return
|
|
2780
|
+
get isAuthenticated() {
|
|
2781
|
+
return !!this.user;
|
|
2590
2782
|
}
|
|
2591
|
-
|
|
2592
|
-
|
|
2783
|
+
constructor() {
|
|
2784
|
+
this.eventForwarded = new Subject();
|
|
2785
|
+
this.stickyUpdated = new Subject();
|
|
2786
|
+
this.languageChanged = new Subject();
|
|
2787
|
+
this.translationsEnabled = new Subject();
|
|
2788
|
+
this.userChanged = new Subject();
|
|
2789
|
+
this.sticky = false;
|
|
2790
|
+
this.user = null;
|
|
2791
|
+
this.userChanged.subscribe(user => {
|
|
2792
|
+
this.user = user;
|
|
2793
|
+
});
|
|
2593
2794
|
}
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
theta: Math.atan2(this.z, this.x),
|
|
2597
|
-
phi: Math.asin(this.y / this.length)
|
|
2598
|
-
};
|
|
2795
|
+
event(e) {
|
|
2796
|
+
this.eventForwarded.next(e);
|
|
2599
2797
|
}
|
|
2600
|
-
|
|
2601
|
-
this.
|
|
2602
|
-
this.
|
|
2603
|
-
this.z = z;
|
|
2604
|
-
}
|
|
2605
|
-
add(v) {
|
|
2606
|
-
if (v instanceof Vector)
|
|
2607
|
-
return new Vector(this.x + v.x, this.y + v.y, this.z + v.z);
|
|
2608
|
-
else
|
|
2609
|
-
return new Vector(this.x + v, this.y + v, this.z + v);
|
|
2610
|
-
}
|
|
2611
|
-
subtract(v) {
|
|
2612
|
-
if (v instanceof Vector)
|
|
2613
|
-
return new Vector(this.x - v.x, this.y - v.y, this.z - v.z);
|
|
2614
|
-
else
|
|
2615
|
-
return new Vector(this.x - v, this.y - v, this.z - v);
|
|
2616
|
-
}
|
|
2617
|
-
multiply(v) {
|
|
2618
|
-
if (v instanceof Vector)
|
|
2619
|
-
return new Vector(this.x * v.x, this.y * v.y, this.z * v.z);
|
|
2620
|
-
else
|
|
2621
|
-
return new Vector(this.x * v, this.y * v, this.z * v);
|
|
2622
|
-
}
|
|
2623
|
-
divide(v) {
|
|
2624
|
-
if (v instanceof Vector)
|
|
2625
|
-
return new Vector(this.x / v.x, this.y / v.y, this.z / v.z);
|
|
2626
|
-
else
|
|
2627
|
-
return new Vector(this.x / v, this.y / v, this.z / v);
|
|
2628
|
-
}
|
|
2629
|
-
equals(v) {
|
|
2630
|
-
return this.x == v.x && this.y == v.y && this.z == v.z;
|
|
2631
|
-
}
|
|
2632
|
-
dot(v) {
|
|
2633
|
-
return this.x * v.x + this.y * v.y + this.z * v.z;
|
|
2634
|
-
}
|
|
2635
|
-
cross(v) {
|
|
2636
|
-
return new Vector(this.y * v.z - this.z * v.y, this.z * v.x - this.x * v.z, this.x * v.y - this.y * v.x);
|
|
2637
|
-
}
|
|
2638
|
-
angleTo(v) {
|
|
2639
|
-
return Math.acos(this.dot(v) / (this.length * v.length));
|
|
2640
|
-
}
|
|
2641
|
-
toArray(n) {
|
|
2642
|
-
return [this.x, this.y, this.z].slice(0, n || 3);
|
|
2643
|
-
}
|
|
2644
|
-
clone() {
|
|
2645
|
-
return new Vector(this.x, this.y, this.z);
|
|
2646
|
-
}
|
|
2647
|
-
init(x, y, z) {
|
|
2648
|
-
this.x = x;
|
|
2649
|
-
this.y = y;
|
|
2650
|
-
this.z = z;
|
|
2651
|
-
return this;
|
|
2798
|
+
updateSticky(sticky) {
|
|
2799
|
+
this.sticky = sticky;
|
|
2800
|
+
this.stickyUpdated.next(sticky);
|
|
2652
2801
|
}
|
|
2802
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: EventsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2803
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: EventsService }); }
|
|
2653
2804
|
}
|
|
2805
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: EventsService, decorators: [{
|
|
2806
|
+
type: Injectable
|
|
2807
|
+
}], ctorParameters: () => [] });
|
|
2654
2808
|
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
wasmResolve = resolve;
|
|
2681
|
-
});
|
|
2682
|
-
self.onmessage = function (e) {
|
|
2683
|
-
const data = e.data;
|
|
2684
|
-
const { type, payload } = data;
|
|
2685
|
-
switch (type) {
|
|
2686
|
-
case "wasm":
|
|
2687
|
-
const { url, wasi } = payload;
|
|
2688
|
-
fetch(url).then(response => response.arrayBuffer()).then(bytes => {
|
|
2689
|
-
const wasiImpl = JSONfn.parse(wasi);
|
|
2690
|
-
return new wasiImpl().instantiate(bytes);
|
|
2691
|
-
}).then(instance => {
|
|
2692
|
-
wasmResolve(instance);
|
|
2693
|
-
const methods = Object.getOwnPropertyNames(instance).filter(key => typeof instance[key] === "function");
|
|
2694
|
-
self.postMessage({ type: "methods", payload: methods });
|
|
2695
|
-
});
|
|
2696
|
-
break;
|
|
2697
|
-
case "call":
|
|
2698
|
-
wasmInstance.then(instance => {
|
|
2699
|
-
const { name, id, args } = payload;
|
|
2700
|
-
if (logTimes) {
|
|
2701
|
-
console.time(id);
|
|
2702
|
-
console.timeLog(id, `Calling ${name} ...`);
|
|
2809
|
+
const emptyGuards = [];
|
|
2810
|
+
class AclService {
|
|
2811
|
+
constructor(injector, state, events) {
|
|
2812
|
+
this.injector = injector;
|
|
2813
|
+
this.state = state;
|
|
2814
|
+
this.events = events;
|
|
2815
|
+
this.components = [];
|
|
2816
|
+
this.events.userChanged.subscribe(() => {
|
|
2817
|
+
this.components.forEach(t => t.dirty = true);
|
|
2818
|
+
const info = this.getStateInfo();
|
|
2819
|
+
const check = info && info.guard instanceof AuthGuard ? info.guard.checkRoute(info.route) : Promise.resolve(true);
|
|
2820
|
+
check.then(result => {
|
|
2821
|
+
if (result) {
|
|
2822
|
+
if (!info || !info.dirty)
|
|
2823
|
+
return;
|
|
2824
|
+
info.dirty = false;
|
|
2825
|
+
const component = info.component;
|
|
2826
|
+
if (!info.component)
|
|
2827
|
+
return;
|
|
2828
|
+
if (info.first) {
|
|
2829
|
+
if (ObjectUtils.isFunction(component.onUserInitialized)) {
|
|
2830
|
+
component.onUserInitialized();
|
|
2831
|
+
}
|
|
2832
|
+
info.first = false;
|
|
2833
|
+
return;
|
|
2703
2834
|
}
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
if (logTimes) {
|
|
2707
|
-
console.timeLog(id, `Called ${name}`);
|
|
2708
|
-
console.timeEnd(id);
|
|
2835
|
+
if (ObjectUtils.isFunction(component.onUserChanged)) {
|
|
2836
|
+
component.onUserChanged();
|
|
2709
2837
|
}
|
|
2710
|
-
|
|
2838
|
+
return;
|
|
2839
|
+
}
|
|
2840
|
+
info.guard.getReturnState(info.route).then(returnState => {
|
|
2841
|
+
if (!returnState)
|
|
2842
|
+
return;
|
|
2843
|
+
this.state.navigate(returnState);
|
|
2711
2844
|
});
|
|
2712
|
-
|
|
2713
|
-
}
|
|
2714
|
-
};
|
|
2715
|
-
}
|
|
2716
|
-
class WasmWorkerProxy {
|
|
2717
|
-
constructor(wasmPath, wasi, logTimes = false) {
|
|
2718
|
-
this.methods = new Promise(resolve => {
|
|
2719
|
-
this.onMethods = resolve;
|
|
2720
|
-
});
|
|
2721
|
-
const lt = logTimes ? "true" : "false";
|
|
2722
|
-
const blob = new Blob([`${JSONfn.toString()} (${workerFunction.toString()})(JSONfn, ${lt})`], { type: 'application/javascript' });
|
|
2723
|
-
this.worker = new Worker(URL.createObjectURL(blob));
|
|
2724
|
-
this.worker.postMessage({
|
|
2725
|
-
type: "wasm",
|
|
2726
|
-
payload: { url: wasmPath, wasi: JSONfn.stringify(wasi), logTimes }
|
|
2845
|
+
});
|
|
2727
2846
|
});
|
|
2728
|
-
this.
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
}
|
|
2736
|
-
return (...args) => {
|
|
2737
|
-
return this.call(prop.toString(), args);
|
|
2738
|
-
};
|
|
2847
|
+
this.state.subscribe(() => {
|
|
2848
|
+
const info = this.getStateInfo();
|
|
2849
|
+
if (!info?.component)
|
|
2850
|
+
return;
|
|
2851
|
+
const component = info.component;
|
|
2852
|
+
if (ObjectUtils.isFunction(component.onUserInitialized)) {
|
|
2853
|
+
component.onUserInitialized();
|
|
2739
2854
|
}
|
|
2855
|
+
info.first = false;
|
|
2740
2856
|
});
|
|
2741
2857
|
}
|
|
2742
|
-
|
|
2743
|
-
const
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
break;
|
|
2757
|
-
}
|
|
2758
|
-
}
|
|
2759
|
-
async call(method, args) {
|
|
2760
|
-
const methods = await this.methods;
|
|
2761
|
-
if (!methods.includes(method)) {
|
|
2762
|
-
throw new Error(`Method ${method} not found`);
|
|
2858
|
+
getStateInfo() {
|
|
2859
|
+
const route = this.state.route;
|
|
2860
|
+
if (!route)
|
|
2861
|
+
return null;
|
|
2862
|
+
let info = this.components.find(t => t.route == this.state.route);
|
|
2863
|
+
if (!info) {
|
|
2864
|
+
const guardType = (route.canActivate || emptyGuards)[0];
|
|
2865
|
+
info = {
|
|
2866
|
+
route: this.state.route,
|
|
2867
|
+
guard: guardType ? this.injector.get(guardType) : null,
|
|
2868
|
+
dirty: true,
|
|
2869
|
+
first: true
|
|
2870
|
+
};
|
|
2871
|
+
this.components.push(info);
|
|
2763
2872
|
}
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
this.worker.postMessage({
|
|
2767
|
-
type: "call",
|
|
2768
|
-
payload: { name: method, id, args }
|
|
2769
|
-
});
|
|
2770
|
-
this.promises.set(id, { resolve, reject });
|
|
2771
|
-
});
|
|
2873
|
+
info.component = this.state.component;
|
|
2874
|
+
return info;
|
|
2772
2875
|
}
|
|
2876
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AclService, deps: [{ token: i0.Injector }, { token: StateService }, { token: EventsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2877
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AclService }); }
|
|
2773
2878
|
}
|
|
2879
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AclService, decorators: [{
|
|
2880
|
+
type: Injectable
|
|
2881
|
+
}], ctorParameters: () => [{ type: i0.Injector }, { type: StateService }, { type: EventsService }] });
|
|
2774
2882
|
|
|
2775
2883
|
class BaseHttpClient extends HttpClient {
|
|
2776
2884
|
constructor(handler) {
|
|
@@ -2858,39 +2966,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
2858
2966
|
type: Injectable
|
|
2859
2967
|
}], ctorParameters: () => [{ type: UniversalService }] });
|
|
2860
2968
|
|
|
2861
|
-
class EventsService {
|
|
2862
|
-
get isSticky() {
|
|
2863
|
-
return this.sticky;
|
|
2864
|
-
}
|
|
2865
|
-
get isAuthenticated() {
|
|
2866
|
-
return !!this.user;
|
|
2867
|
-
}
|
|
2868
|
-
constructor() {
|
|
2869
|
-
this.eventForwarded = new Subject();
|
|
2870
|
-
this.stickyUpdated = new Subject();
|
|
2871
|
-
this.languageChanged = new Subject();
|
|
2872
|
-
this.translationsEnabled = new Subject();
|
|
2873
|
-
this.userChanged = new Subject();
|
|
2874
|
-
this.sticky = false;
|
|
2875
|
-
this.user = null;
|
|
2876
|
-
this.userChanged.subscribe(user => {
|
|
2877
|
-
this.user = user;
|
|
2878
|
-
});
|
|
2879
|
-
}
|
|
2880
|
-
event(e) {
|
|
2881
|
-
this.eventForwarded.next(e);
|
|
2882
|
-
}
|
|
2883
|
-
updateSticky(sticky) {
|
|
2884
|
-
this.sticky = sticky;
|
|
2885
|
-
this.stickyUpdated.next(sticky);
|
|
2886
|
-
}
|
|
2887
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: EventsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2888
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: EventsService }); }
|
|
2889
|
-
}
|
|
2890
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: EventsService, decorators: [{
|
|
2891
|
-
type: Injectable
|
|
2892
|
-
}], ctorParameters: () => [] });
|
|
2893
|
-
|
|
2894
2969
|
class CacheService {
|
|
2895
2970
|
get userChanged() {
|
|
2896
2971
|
return this.events.userChanged;
|
|
@@ -3234,190 +3309,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
3234
3309
|
type: Inject,
|
|
3235
3310
|
args: [EXPRESS_REQUEST]
|
|
3236
3311
|
}] }] });
|
|
3237
|
-
class HttpPromise extends Promise {
|
|
3238
|
-
constructor(rejectHandler, executor) {
|
|
3239
|
-
super(executor);
|
|
3240
|
-
this.rejectHandler = rejectHandler;
|
|
3241
|
-
this.attachCount = 0;
|
|
3242
|
-
this.runCount = 0;
|
|
3243
|
-
}
|
|
3244
|
-
then(onFulfilled, onRejected) {
|
|
3245
|
-
this.attachCount++;
|
|
3246
|
-
return super.then(value => {
|
|
3247
|
-
this.runCount++;
|
|
3248
|
-
return onFulfilled ? onFulfilled(value) : null;
|
|
3249
|
-
}, (reason) => {
|
|
3250
|
-
const result = onRejected ? onRejected(reason) : null;
|
|
3251
|
-
this.hasRejectHandler = this.hasRejectHandler || (onRejected && result !== false);
|
|
3252
|
-
this.runCount++;
|
|
3253
|
-
this.rejectHandler(this.runCount == this.attachCount && !this.hasRejectHandler ? reason : null);
|
|
3254
|
-
return result;
|
|
3255
|
-
});
|
|
3256
|
-
}
|
|
3257
|
-
catch(onRejected) {
|
|
3258
|
-
return this.then(null, onRejected);
|
|
3259
|
-
}
|
|
3260
|
-
}
|
|
3261
|
-
|
|
3262
|
-
class LocalHttpService extends BaseHttpService {
|
|
3263
|
-
get name() {
|
|
3264
|
-
return "local-http";
|
|
3265
|
-
}
|
|
3266
|
-
get config() {
|
|
3267
|
-
return this.configs.config;
|
|
3268
|
-
}
|
|
3269
|
-
get withCredentials() {
|
|
3270
|
-
return false;
|
|
3271
|
-
}
|
|
3272
|
-
initService() {
|
|
3273
|
-
super.initService();
|
|
3274
|
-
this.images = {};
|
|
3275
|
-
}
|
|
3276
|
-
url(url) {
|
|
3277
|
-
if (!url)
|
|
3278
|
-
return url;
|
|
3279
|
-
const config = this.config;
|
|
3280
|
-
const baseUrl = config.cdnUrl || config.baseUrl || "";
|
|
3281
|
-
return url.startsWith("data:") || url.startsWith("http") || url.startsWith("//")
|
|
3282
|
-
? url
|
|
3283
|
-
: `${baseUrl}${url}`;
|
|
3284
|
-
}
|
|
3285
|
-
get(url, options, body) {
|
|
3286
|
-
options = this.makeOptions(options, "GET", body, this.caches.permanent);
|
|
3287
|
-
return this.toPromise(url, options);
|
|
3288
|
-
}
|
|
3289
|
-
getImage(url) {
|
|
3290
|
-
if (this.universal.isServer)
|
|
3291
|
-
return Promise.resolve(null);
|
|
3292
|
-
if (!url)
|
|
3293
|
-
return Promise.resolve(new Image());
|
|
3294
|
-
this.images[url] = this.images[url] || new Promise((resolve, reject) => {
|
|
3295
|
-
const image = new Image();
|
|
3296
|
-
image.crossOrigin = "Anonymous";
|
|
3297
|
-
image.src = this.url(url);
|
|
3298
|
-
image.onload = () => resolve(image);
|
|
3299
|
-
image.onerror = reject;
|
|
3300
|
-
});
|
|
3301
|
-
return this.images[url];
|
|
3302
|
-
}
|
|
3303
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LocalHttpService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3304
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LocalHttpService }); }
|
|
3305
|
-
}
|
|
3306
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LocalHttpService, decorators: [{
|
|
3307
|
-
type: Injectable
|
|
3308
|
-
}] });
|
|
3309
|
-
|
|
3310
|
-
/**
|
|
3311
|
-
* Use this service to load WebAssembly modules
|
|
3312
|
-
*/
|
|
3313
|
-
class WasmService {
|
|
3314
|
-
constructor(universal, http, wasi) {
|
|
3315
|
-
this.universal = universal;
|
|
3316
|
-
this.http = http;
|
|
3317
|
-
this.wasi = wasi.constructor;
|
|
3318
|
-
}
|
|
3319
|
-
async getModule(name) {
|
|
3320
|
-
if (!this.universal.isBrowser || !name)
|
|
3321
|
-
return null;
|
|
3322
|
-
this.modules = this.modules || {};
|
|
3323
|
-
this.modules[name] = this.modules[name] || this.http.get(`wasm/${name}.wasm`, {
|
|
3324
|
-
responseType: "arraybuffer"
|
|
3325
|
-
}).then(async (bytes) => {
|
|
3326
|
-
const wasi = new this.wasi();
|
|
3327
|
-
return await wasi.instantiate(bytes);
|
|
3328
|
-
});
|
|
3329
|
-
return this.modules[name];
|
|
3330
|
-
}
|
|
3331
|
-
getWorkerModule(name) {
|
|
3332
|
-
if (!this.universal.isBrowser || !name)
|
|
3333
|
-
return null;
|
|
3334
|
-
this.workerModules = this.workerModules || {};
|
|
3335
|
-
this.workerModules[name] = new WasmWorkerProxy(this.http.url(`wasm/${name}.wasm`), this.wasi);
|
|
3336
|
-
return this.workerModules[name];
|
|
3337
|
-
}
|
|
3338
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: WasmService, deps: [{ token: UniversalService }, { token: LocalHttpService }, { token: WASI_IMPLEMENTATION }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3339
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: WasmService }); }
|
|
3340
|
-
}
|
|
3341
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: WasmService, decorators: [{
|
|
3342
|
-
type: Injectable
|
|
3343
|
-
}], ctorParameters: () => [{ type: UniversalService }, { type: LocalHttpService }, { type: undefined, decorators: [{
|
|
3344
|
-
type: Inject,
|
|
3345
|
-
args: [WASI_IMPLEMENTATION]
|
|
3346
|
-
}] }] });
|
|
3347
|
-
|
|
3348
|
-
const emptyGuards = [];
|
|
3349
|
-
class AclService {
|
|
3350
|
-
constructor(injector, state, events) {
|
|
3351
|
-
this.injector = injector;
|
|
3352
|
-
this.state = state;
|
|
3353
|
-
this.events = events;
|
|
3354
|
-
this.components = [];
|
|
3355
|
-
this.events.userChanged.subscribe(() => {
|
|
3356
|
-
this.components.forEach(t => t.dirty = true);
|
|
3357
|
-
const info = this.getStateInfo();
|
|
3358
|
-
const check = info && info.guard instanceof AuthGuard ? info.guard.checkRoute(info.route) : Promise.resolve(true);
|
|
3359
|
-
check.then(result => {
|
|
3360
|
-
if (result) {
|
|
3361
|
-
if (!info || !info.dirty)
|
|
3362
|
-
return;
|
|
3363
|
-
info.dirty = false;
|
|
3364
|
-
const component = info.component;
|
|
3365
|
-
if (!info.component)
|
|
3366
|
-
return;
|
|
3367
|
-
if (info.first) {
|
|
3368
|
-
if (ObjectUtils.isFunction(component.onUserInitialized)) {
|
|
3369
|
-
component.onUserInitialized();
|
|
3370
|
-
}
|
|
3371
|
-
info.first = false;
|
|
3372
|
-
return;
|
|
3373
|
-
}
|
|
3374
|
-
if (ObjectUtils.isFunction(component.onUserChanged)) {
|
|
3375
|
-
component.onUserChanged();
|
|
3376
|
-
}
|
|
3377
|
-
return;
|
|
3378
|
-
}
|
|
3379
|
-
info.guard.getReturnState(info.route).then(returnState => {
|
|
3380
|
-
if (!returnState)
|
|
3381
|
-
return;
|
|
3382
|
-
this.state.navigate(returnState);
|
|
3383
|
-
});
|
|
3384
|
-
});
|
|
3385
|
-
});
|
|
3386
|
-
this.state.subscribe(() => {
|
|
3387
|
-
const info = this.getStateInfo();
|
|
3388
|
-
if (!info?.component)
|
|
3389
|
-
return;
|
|
3390
|
-
const component = info.component;
|
|
3391
|
-
if (ObjectUtils.isFunction(component.onUserInitialized)) {
|
|
3392
|
-
component.onUserInitialized();
|
|
3393
|
-
}
|
|
3394
|
-
info.first = false;
|
|
3312
|
+
class HttpPromise extends Promise {
|
|
3313
|
+
constructor(rejectHandler, executor) {
|
|
3314
|
+
super(executor);
|
|
3315
|
+
this.rejectHandler = rejectHandler;
|
|
3316
|
+
this.attachCount = 0;
|
|
3317
|
+
this.runCount = 0;
|
|
3318
|
+
}
|
|
3319
|
+
then(onFulfilled, onRejected) {
|
|
3320
|
+
this.attachCount++;
|
|
3321
|
+
return super.then(value => {
|
|
3322
|
+
this.runCount++;
|
|
3323
|
+
return onFulfilled ? onFulfilled(value) : null;
|
|
3324
|
+
}, (reason) => {
|
|
3325
|
+
const result = onRejected ? onRejected(reason) : null;
|
|
3326
|
+
this.hasRejectHandler = this.hasRejectHandler || (onRejected && result !== false);
|
|
3327
|
+
this.runCount++;
|
|
3328
|
+
this.rejectHandler(this.runCount == this.attachCount && !this.hasRejectHandler ? reason : null);
|
|
3329
|
+
return result;
|
|
3395
3330
|
});
|
|
3396
3331
|
}
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
if (!route)
|
|
3400
|
-
return null;
|
|
3401
|
-
let info = this.components.find(t => t.route == this.state.route);
|
|
3402
|
-
if (!info) {
|
|
3403
|
-
const guardType = (route.canActivate || emptyGuards)[0];
|
|
3404
|
-
info = {
|
|
3405
|
-
route: this.state.route,
|
|
3406
|
-
guard: guardType ? this.injector.get(guardType) : null,
|
|
3407
|
-
dirty: true,
|
|
3408
|
-
first: true
|
|
3409
|
-
};
|
|
3410
|
-
this.components.push(info);
|
|
3411
|
-
}
|
|
3412
|
-
info.component = this.state.component;
|
|
3413
|
-
return info;
|
|
3332
|
+
catch(onRejected) {
|
|
3333
|
+
return this.then(null, onRejected);
|
|
3414
3334
|
}
|
|
3415
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AclService, deps: [{ token: i0.Injector }, { token: StateService }, { token: EventsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3416
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AclService }); }
|
|
3417
3335
|
}
|
|
3418
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AclService, decorators: [{
|
|
3419
|
-
type: Injectable
|
|
3420
|
-
}], ctorParameters: () => [{ type: i0.Injector }, { type: StateService }, { type: EventsService }] });
|
|
3421
3336
|
|
|
3422
3337
|
class ApiService extends BaseHttpService {
|
|
3423
3338
|
get name() {
|
|
@@ -4078,6 +3993,54 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
4078
3993
|
type: Injectable
|
|
4079
3994
|
}] });
|
|
4080
3995
|
|
|
3996
|
+
class LocalHttpService extends BaseHttpService {
|
|
3997
|
+
get name() {
|
|
3998
|
+
return "local-http";
|
|
3999
|
+
}
|
|
4000
|
+
get config() {
|
|
4001
|
+
return this.configs.config;
|
|
4002
|
+
}
|
|
4003
|
+
get withCredentials() {
|
|
4004
|
+
return false;
|
|
4005
|
+
}
|
|
4006
|
+
initService() {
|
|
4007
|
+
super.initService();
|
|
4008
|
+
this.images = {};
|
|
4009
|
+
}
|
|
4010
|
+
url(url) {
|
|
4011
|
+
if (!url)
|
|
4012
|
+
return url;
|
|
4013
|
+
const config = this.config;
|
|
4014
|
+
const baseUrl = config.cdnUrl || config.baseUrl || "";
|
|
4015
|
+
return url.startsWith("data:") || url.startsWith("http") || url.startsWith("//")
|
|
4016
|
+
? url
|
|
4017
|
+
: `${baseUrl}${url}`;
|
|
4018
|
+
}
|
|
4019
|
+
get(url, options, body) {
|
|
4020
|
+
options = this.makeOptions(options, "GET", body, this.caches.permanent);
|
|
4021
|
+
return this.toPromise(url, options);
|
|
4022
|
+
}
|
|
4023
|
+
getImage(url) {
|
|
4024
|
+
if (this.universal.isServer)
|
|
4025
|
+
return Promise.resolve(null);
|
|
4026
|
+
if (!url)
|
|
4027
|
+
return Promise.resolve(new Image());
|
|
4028
|
+
this.images[url] = this.images[url] || new Promise((resolve, reject) => {
|
|
4029
|
+
const image = new Image();
|
|
4030
|
+
image.crossOrigin = "Anonymous";
|
|
4031
|
+
image.src = this.url(url);
|
|
4032
|
+
image.onload = () => resolve(image);
|
|
4033
|
+
image.onerror = reject;
|
|
4034
|
+
});
|
|
4035
|
+
return this.images[url];
|
|
4036
|
+
}
|
|
4037
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LocalHttpService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
4038
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LocalHttpService }); }
|
|
4039
|
+
}
|
|
4040
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: LocalHttpService, decorators: [{
|
|
4041
|
+
type: Injectable
|
|
4042
|
+
}] });
|
|
4043
|
+
|
|
4081
4044
|
class OpenApiService {
|
|
4082
4045
|
constructor(api, staticSchemas) {
|
|
4083
4046
|
this.api = api;
|
|
@@ -7616,78 +7579,69 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
7616
7579
|
}] } });
|
|
7617
7580
|
|
|
7618
7581
|
class InteractiveItemComponent {
|
|
7582
|
+
get shapes() {
|
|
7583
|
+
return this.mShapes;
|
|
7584
|
+
}
|
|
7585
|
+
get x() {
|
|
7586
|
+
return this.pos.x;
|
|
7587
|
+
}
|
|
7619
7588
|
set x(value) {
|
|
7620
|
-
if (isNaN(value))
|
|
7589
|
+
if (isNaN(value) || value === this.pos.x)
|
|
7621
7590
|
return;
|
|
7622
7591
|
this.pos = new Point(value, this.pos.y);
|
|
7592
|
+
this.validPosition = this.pos;
|
|
7593
|
+
}
|
|
7594
|
+
get y() {
|
|
7595
|
+
return this.pos.y;
|
|
7623
7596
|
}
|
|
7624
7597
|
set y(value) {
|
|
7625
|
-
if (isNaN(value))
|
|
7598
|
+
if (isNaN(value) || value === this.pos.y)
|
|
7626
7599
|
return;
|
|
7627
7600
|
this.pos = new Point(this.pos.x, value);
|
|
7601
|
+
this.validPosition = this.pos;
|
|
7602
|
+
}
|
|
7603
|
+
get position() {
|
|
7604
|
+
return this.pos;
|
|
7628
7605
|
}
|
|
7629
7606
|
set position(value) {
|
|
7630
7607
|
if (typeof value !== "object" || isNaN(value.x) || isNaN(value.y) || value === this.pos)
|
|
7631
7608
|
return;
|
|
7632
7609
|
this.pos = new Point(value.x, value.y);
|
|
7610
|
+
this.validPosition = this.pos;
|
|
7633
7611
|
}
|
|
7634
|
-
get
|
|
7635
|
-
return this.
|
|
7636
|
-
}
|
|
7637
|
-
get canvas() {
|
|
7638
|
-
return null;
|
|
7639
|
-
}
|
|
7640
|
-
get position() {
|
|
7641
|
-
return this.pos;
|
|
7642
|
-
}
|
|
7643
|
-
get x() {
|
|
7644
|
-
return this.pos.x;
|
|
7612
|
+
get isValid() {
|
|
7613
|
+
return this.valid;
|
|
7645
7614
|
}
|
|
7646
|
-
get
|
|
7647
|
-
return this.
|
|
7615
|
+
get validPosition() {
|
|
7616
|
+
return this.validPos;
|
|
7648
7617
|
}
|
|
7649
|
-
|
|
7650
|
-
|
|
7618
|
+
set validPosition(value) {
|
|
7619
|
+
if (typeof value !== "object" || isNaN(value.x) || isNaN(value.y) || value === this.validPos)
|
|
7620
|
+
return;
|
|
7621
|
+
this.validPos = new Point(value.x, value.y);
|
|
7622
|
+
this.valid = true;
|
|
7651
7623
|
}
|
|
7652
7624
|
constructor() {
|
|
7653
|
-
this.onClick = new EventEmitter();
|
|
7654
|
-
this.onPan = new EventEmitter();
|
|
7655
|
-
this.onPanStart = new EventEmitter();
|
|
7656
|
-
this.onPanEnd = new EventEmitter();
|
|
7657
7625
|
this.active = false;
|
|
7658
7626
|
this.index = -1;
|
|
7627
|
+
this.valid = true;
|
|
7659
7628
|
this.cycles = [0];
|
|
7660
7629
|
this.pos = Point.Zero;
|
|
7661
|
-
this.rotation = 0;
|
|
7662
7630
|
this.direction = "none";
|
|
7663
7631
|
this.mShapes = [];
|
|
7664
|
-
this.subscription = ObservableUtils.multiSubscription(this.onPan.subscribe(ev => {
|
|
7665
|
-
switch (this.direction) {
|
|
7666
|
-
case "free":
|
|
7667
|
-
this.x += ev.deltaX;
|
|
7668
|
-
this.y += ev.deltaY;
|
|
7669
|
-
break;
|
|
7670
|
-
case "horizontal":
|
|
7671
|
-
this.x += ev.deltaX;
|
|
7672
|
-
break;
|
|
7673
|
-
case "vertical":
|
|
7674
|
-
this.y += ev.deltaY;
|
|
7675
|
-
break;
|
|
7676
|
-
}
|
|
7677
|
-
if (this.direction !== "none") {
|
|
7678
|
-
this.calcShapes();
|
|
7679
|
-
}
|
|
7680
|
-
}));
|
|
7681
7632
|
}
|
|
7682
|
-
|
|
7683
|
-
|
|
7633
|
+
draw(ctx) {
|
|
7634
|
+
drawOval(ctx, 4, 4);
|
|
7635
|
+
ctx.fill();
|
|
7636
|
+
ctx.stroke();
|
|
7684
7637
|
}
|
|
7685
7638
|
ngOnChanges() {
|
|
7639
|
+
if (!this.canvas)
|
|
7640
|
+
return;
|
|
7686
7641
|
this.calcShapes();
|
|
7687
7642
|
}
|
|
7688
7643
|
calcShapes(cycles) {
|
|
7689
|
-
const
|
|
7690
|
-
const ratio = canvas.ratio;
|
|
7644
|
+
const ratio = this.canvas.ratio ?? 1;
|
|
7691
7645
|
const x = this.pos.x * ratio;
|
|
7692
7646
|
this.cycles = cycles ?? this.cycles;
|
|
7693
7647
|
this.mShapes = this.cycles.map(pan => {
|
|
@@ -7697,25 +7651,57 @@ class InteractiveItemComponent {
|
|
|
7697
7651
|
}
|
|
7698
7652
|
hit(point) {
|
|
7699
7653
|
for (const shape of this.shapes) {
|
|
7700
|
-
if (shape.
|
|
7654
|
+
if (shape.minDistance(point) <= 0)
|
|
7701
7655
|
return true;
|
|
7702
7656
|
}
|
|
7703
7657
|
return false;
|
|
7704
7658
|
}
|
|
7705
|
-
|
|
7706
|
-
|
|
7659
|
+
move(dx, dy) {
|
|
7660
|
+
if (this.direction === "none")
|
|
7661
|
+
return;
|
|
7662
|
+
switch (this.direction) {
|
|
7663
|
+
case "horizontal":
|
|
7664
|
+
this.pos = new Point(this.pos.x + dx, this.pos.y);
|
|
7665
|
+
break;
|
|
7666
|
+
case "vertical":
|
|
7667
|
+
this.pos = new Point(this.pos.x, this.pos.y + dy);
|
|
7668
|
+
break;
|
|
7669
|
+
default:
|
|
7670
|
+
this.pos = new Point(this.pos.x + dx, this.pos.y + dy);
|
|
7671
|
+
break;
|
|
7672
|
+
}
|
|
7673
|
+
const params = this.canvas.params || {};
|
|
7674
|
+
this.calcShapes();
|
|
7675
|
+
this.valid = this.isValidByParams() && this.canvas.items.every(other => this === other || this.isValidByDistance(other));
|
|
7676
|
+
this.validPos = this.valid ? this.pos : this.validPos;
|
|
7677
|
+
}
|
|
7678
|
+
moveEnd() {
|
|
7679
|
+
if (this.valid)
|
|
7680
|
+
return;
|
|
7681
|
+
this.pos = this.validPos;
|
|
7682
|
+
this.valid = true;
|
|
7683
|
+
this.calcShapes();
|
|
7684
|
+
}
|
|
7685
|
+
isValidByParams() {
|
|
7686
|
+
return true;
|
|
7707
7687
|
}
|
|
7708
|
-
|
|
7709
|
-
this.
|
|
7710
|
-
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
|
|
7688
|
+
isValidByDistance(other) {
|
|
7689
|
+
const min = this.getMinDistance(other);
|
|
7690
|
+
const minPixels = isNaN(min) || min <= 0 ? 1 : min * this.canvas.ratio;
|
|
7691
|
+
return !this.shapes.some(shape => {
|
|
7692
|
+
return other.shapes.some(os => {
|
|
7693
|
+
return os.minDistance(shape) <= minPixels;
|
|
7694
|
+
});
|
|
7715
7695
|
});
|
|
7716
7696
|
}
|
|
7697
|
+
getMinDistance(other) {
|
|
7698
|
+
return !other ? 0 : null;
|
|
7699
|
+
}
|
|
7700
|
+
calcShape(x, y) {
|
|
7701
|
+
return new Point(x, y);
|
|
7702
|
+
}
|
|
7717
7703
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: InteractiveItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7718
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: InteractiveItemComponent, isStandalone: false, selector: "__interactive-item__", inputs: { x: "x", y: "y", position: "position",
|
|
7704
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: InteractiveItemComponent, isStandalone: false, selector: "__interactive-item__", inputs: { x: "x", y: "y", position: "position", direction: "direction", disabled: "disabled" }, usesOnChanges: true, ngImport: i0, template: "", isInline: true }); }
|
|
7719
7705
|
}
|
|
7720
7706
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: InteractiveItemComponent, decorators: [{
|
|
7721
7707
|
type: Component,
|
|
@@ -7730,50 +7716,57 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
7730
7716
|
type: Input
|
|
7731
7717
|
}], position: [{
|
|
7732
7718
|
type: Input
|
|
7733
|
-
}], rotation: [{
|
|
7734
|
-
type: Input
|
|
7735
7719
|
}], direction: [{
|
|
7736
7720
|
type: Input
|
|
7737
7721
|
}], disabled: [{
|
|
7738
7722
|
type: Input
|
|
7739
|
-
}], onClick: [{
|
|
7740
|
-
type: Output
|
|
7741
|
-
}], onPan: [{
|
|
7742
|
-
type: Output
|
|
7743
|
-
}], onPanStart: [{
|
|
7744
|
-
type: Output
|
|
7745
|
-
}], onPanEnd: [{
|
|
7746
|
-
type: Output
|
|
7747
7723
|
}] } });
|
|
7748
7724
|
|
|
7749
7725
|
class InteractiveCanvasComponent {
|
|
7750
|
-
get
|
|
7751
|
-
return this.
|
|
7726
|
+
get items() {
|
|
7727
|
+
return this.itemComponents;
|
|
7752
7728
|
}
|
|
7753
|
-
get
|
|
7754
|
-
return this.
|
|
7729
|
+
get canvas() {
|
|
7730
|
+
return this.canvasElem?.nativeElement;
|
|
7755
7731
|
}
|
|
7756
7732
|
get lockedItem() {
|
|
7757
|
-
return this.
|
|
7733
|
+
return this.itemComponents[this.lockedIndex];
|
|
7734
|
+
}
|
|
7735
|
+
get selectedItem() {
|
|
7736
|
+
return this.itemComponents[this.selectedIndex];
|
|
7737
|
+
}
|
|
7738
|
+
get hoveredItem() {
|
|
7739
|
+
return this.itemComponents[this.hoveredIndex];
|
|
7758
7740
|
}
|
|
7759
|
-
constructor(renderer) {
|
|
7741
|
+
constructor(renderer, universal, element, rootElement) {
|
|
7760
7742
|
this.renderer = renderer;
|
|
7743
|
+
this.universal = universal;
|
|
7744
|
+
this.element = element;
|
|
7745
|
+
this.rootElement = rootElement;
|
|
7746
|
+
this.debug = false;
|
|
7761
7747
|
this.horizontal = false;
|
|
7762
7748
|
this.selectedIndex = 0;
|
|
7763
7749
|
this.resizeMode = "fit";
|
|
7764
|
-
this.
|
|
7765
|
-
this.
|
|
7766
|
-
this.shouldDraw = true;
|
|
7750
|
+
this.realWidth = 100;
|
|
7751
|
+
this.realHeight = 100;
|
|
7767
7752
|
this.panOffset = 0;
|
|
7768
|
-
this.
|
|
7753
|
+
this.params = {};
|
|
7754
|
+
this.selectedIndexChange = new EventEmitter();
|
|
7755
|
+
this.itemPan = new EventEmitter();
|
|
7756
|
+
this.itemPanEnd = new EventEmitter();
|
|
7757
|
+
this.tempCanvas = this.universal.isServer ? null : document.createElement("canvas");
|
|
7758
|
+
this.shouldDraw = !this.universal.isServer;
|
|
7769
7759
|
this.rotation = 0;
|
|
7770
7760
|
this.canvasWidth = 0;
|
|
7771
7761
|
this.canvasHeight = 0;
|
|
7772
7762
|
this.hoveredIndex = null;
|
|
7773
|
-
this.
|
|
7763
|
+
this.itemComponents = [];
|
|
7774
7764
|
this.touched = false;
|
|
7775
7765
|
this.deltaX = 0;
|
|
7776
7766
|
this.deltaY = 0;
|
|
7767
|
+
this.ctrInit();
|
|
7768
|
+
}
|
|
7769
|
+
ctrInit() {
|
|
7777
7770
|
}
|
|
7778
7771
|
ngOnInit() {
|
|
7779
7772
|
this.redraw();
|
|
@@ -7783,12 +7776,26 @@ class InteractiveCanvasComponent {
|
|
|
7783
7776
|
this.subscription?.unsubscribe();
|
|
7784
7777
|
}
|
|
7785
7778
|
ngOnChanges() {
|
|
7779
|
+
this.params = this.params || {};
|
|
7786
7780
|
this.resize();
|
|
7787
7781
|
}
|
|
7788
7782
|
ngAfterViewInit() {
|
|
7789
7783
|
this.subscription = this.itemList.changes.subscribe(() => this.fixItems());
|
|
7790
7784
|
this.fixItems();
|
|
7791
7785
|
}
|
|
7786
|
+
async tempPaint(cb) {
|
|
7787
|
+
const renderCanvas = this.canvas;
|
|
7788
|
+
const canvas = this.tempCanvas;
|
|
7789
|
+
canvas.width = renderCanvas.width;
|
|
7790
|
+
canvas.height = renderCanvas.height;
|
|
7791
|
+
const ctx = canvas.getContext("2d");
|
|
7792
|
+
ctx.globalCompositeOperation = "source-over";
|
|
7793
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
7794
|
+
const bgCtx = renderCanvas.getContext("2d");
|
|
7795
|
+
bgCtx.globalCompositeOperation = await cb(ctx) || "source-over";
|
|
7796
|
+
bgCtx.drawImage(canvas, 0, 0);
|
|
7797
|
+
bgCtx.globalCompositeOperation = "source-over";
|
|
7798
|
+
}
|
|
7792
7799
|
resize() {
|
|
7793
7800
|
if (!this.canvasElem || !this.containerElem || !this.realWidth || !this.realWidth)
|
|
7794
7801
|
return;
|
|
@@ -7805,11 +7812,12 @@ class InteractiveCanvasComponent {
|
|
|
7805
7812
|
canvas[axisX] = this.realWidth * this.ratio;
|
|
7806
7813
|
canvas[axisY] = this.realHeight * this.ratio;
|
|
7807
7814
|
}
|
|
7815
|
+
this.styles = getComputedStyle(canvas);
|
|
7816
|
+
this.ctx = canvas.getContext("2d");
|
|
7808
7817
|
this.canvasWidth = canvas[axisX];
|
|
7809
7818
|
this.canvasHeight = canvas[axisY];
|
|
7810
7819
|
this.fullHeight = this.realHeight * this.ratio;
|
|
7811
|
-
this.
|
|
7812
|
-
this.fixPan();
|
|
7820
|
+
this.fixRotation();
|
|
7813
7821
|
}
|
|
7814
7822
|
onTouchStart($event) {
|
|
7815
7823
|
this.hoveredIndex = this.getIndexUnderPointer($event.touches.item(0));
|
|
@@ -7836,12 +7844,6 @@ class InteractiveCanvasComponent {
|
|
|
7836
7844
|
}
|
|
7837
7845
|
onPanStart($event) {
|
|
7838
7846
|
this.lockedIndex = this.getIndexUnderPointer($event?.pointers[0]);
|
|
7839
|
-
this.lockedItem?.onPanStart.emit({
|
|
7840
|
-
pointers: [],
|
|
7841
|
-
deltaX: 0,
|
|
7842
|
-
deltaY: 0,
|
|
7843
|
-
item: this.lockedItem
|
|
7844
|
-
});
|
|
7845
7847
|
this.deltaX = 0;
|
|
7846
7848
|
this.deltaY = 0;
|
|
7847
7849
|
}
|
|
@@ -7854,47 +7856,47 @@ class InteractiveCanvasComponent {
|
|
|
7854
7856
|
? { pointers: $event.pointers, deltaX: -deltaY, deltaY: +deltaX }
|
|
7855
7857
|
: { pointers: $event.pointers, deltaX, deltaY };
|
|
7856
7858
|
data.item = item;
|
|
7857
|
-
item.
|
|
7859
|
+
item.move(data.deltaX, data.deltaY);
|
|
7860
|
+
this.itemPan.emit(data);
|
|
7858
7861
|
}
|
|
7859
7862
|
else if (this.resizeMode == "fill") {
|
|
7860
|
-
this.
|
|
7861
|
-
this.
|
|
7863
|
+
this.rotation += (this.horizontal ? deltaX : deltaY) / this.realHeight * 360;
|
|
7864
|
+
this.fixRotation();
|
|
7862
7865
|
}
|
|
7863
7866
|
this.deltaX = $event.deltaX;
|
|
7864
7867
|
this.deltaY = $event.deltaY;
|
|
7865
7868
|
}
|
|
7866
7869
|
onPanEnd() {
|
|
7867
7870
|
const item = this.lockedItem;
|
|
7868
|
-
item
|
|
7869
|
-
|
|
7870
|
-
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
|
|
7871
|
+
if (item) {
|
|
7872
|
+
item.moveEnd();
|
|
7873
|
+
this.itemPanEnd.emit({
|
|
7874
|
+
pointers: [],
|
|
7875
|
+
deltaX: 0,
|
|
7876
|
+
deltaY: 0,
|
|
7877
|
+
item
|
|
7878
|
+
});
|
|
7879
|
+
}
|
|
7874
7880
|
this.lockedIndex = -1;
|
|
7875
7881
|
}
|
|
7876
|
-
|
|
7882
|
+
fixRotation() {
|
|
7877
7883
|
if (this.fullHeight <= 0)
|
|
7878
7884
|
return;
|
|
7879
|
-
|
|
7880
|
-
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
|
|
7884
|
-
}
|
|
7885
|
-
this.rotation = Math.round(this.pan / this.fullHeight * 360);
|
|
7886
|
-
const basePan = (this.rotation / 360 - 1) * this.fullHeight;
|
|
7887
|
-
const cycles = this.resizeMode == "fit" ? [0] : [basePan - this.fullHeight, basePan, basePan + this.fullHeight];
|
|
7888
|
-
this.items.forEach(item => {
|
|
7885
|
+
this.rotation = ((this.rotation + 180) % 360 + 360) % 360 - 180;
|
|
7886
|
+
this.basePan = (this.rotation / 360 - 1) * this.fullHeight + this.canvasHeight * this.panOffset;
|
|
7887
|
+
const cycles = this.resizeMode == "fit"
|
|
7888
|
+
? [0] : [this.basePan - this.fullHeight, this.basePan, this.basePan + this.fullHeight];
|
|
7889
|
+
this.itemComponents.forEach(item => {
|
|
7889
7890
|
item.calcShapes(cycles);
|
|
7890
7891
|
});
|
|
7891
7892
|
}
|
|
7892
7893
|
fixItems() {
|
|
7893
|
-
this.
|
|
7894
|
-
this.
|
|
7894
|
+
this.itemComponents = this.itemList.toArray();
|
|
7895
|
+
this.itemComponents.forEach((item, ix) => {
|
|
7896
|
+
item.canvas = this;
|
|
7895
7897
|
item.index = ix;
|
|
7896
7898
|
});
|
|
7897
|
-
this.
|
|
7899
|
+
this.fixRotation();
|
|
7898
7900
|
}
|
|
7899
7901
|
selectItem(pointer) {
|
|
7900
7902
|
const selected = this.getIndexUnderPointer(pointer);
|
|
@@ -7917,7 +7919,7 @@ class InteractiveCanvasComponent {
|
|
|
7917
7919
|
: new Point(pointer.clientX - canvasRect.left, pointer.clientY - canvasRect.top);
|
|
7918
7920
|
const length = this.items.length;
|
|
7919
7921
|
for (let ix = 0; ix < length; ix++) {
|
|
7920
|
-
const item = this.
|
|
7922
|
+
const item = this.itemComponents[ix];
|
|
7921
7923
|
if (item?.hit(point)) {
|
|
7922
7924
|
return item.disabled ? null : ix;
|
|
7923
7925
|
}
|
|
@@ -7946,7 +7948,6 @@ class InteractiveCanvasComponent {
|
|
|
7946
7948
|
redraw() {
|
|
7947
7949
|
if (!this.shouldDraw)
|
|
7948
7950
|
return;
|
|
7949
|
-
this.ctx = this.canvasElem.nativeElement?.getContext("2d");
|
|
7950
7951
|
if (!this.ctx) {
|
|
7951
7952
|
requestAnimationFrame(() => this.redraw());
|
|
7952
7953
|
return;
|
|
@@ -7955,29 +7956,67 @@ class InteractiveCanvasComponent {
|
|
|
7955
7956
|
requestAnimationFrame(() => this.redraw());
|
|
7956
7957
|
});
|
|
7957
7958
|
}
|
|
7959
|
+
async drawItems() {
|
|
7960
|
+
const ctx = this.ctx;
|
|
7961
|
+
for (const item of this.items) {
|
|
7962
|
+
for (const shape of item.shapes) {
|
|
7963
|
+
ctx.save();
|
|
7964
|
+
ctx.translate(shape.x, shape.y);
|
|
7965
|
+
ctx.lineWidth = 1;
|
|
7966
|
+
ctx.strokeStyle = "black";
|
|
7967
|
+
ctx.fillStyle = "white";
|
|
7968
|
+
await item.draw(ctx);
|
|
7969
|
+
ctx.restore();
|
|
7970
|
+
}
|
|
7971
|
+
}
|
|
7972
|
+
if (!this.debug)
|
|
7973
|
+
return;
|
|
7974
|
+
ctx.lineWidth = 2;
|
|
7975
|
+
ctx.strokeStyle = "rgba(114,232,45,0.55)";
|
|
7976
|
+
for (const item of this.items) {
|
|
7977
|
+
for (const shape of item.shapes) {
|
|
7978
|
+
ctx.save();
|
|
7979
|
+
ctx.translate(shape.x, shape.y);
|
|
7980
|
+
if (shape instanceof Rect || shape instanceof Oval) {
|
|
7981
|
+
ctx.rotate(toRadians(shape.rotation));
|
|
7982
|
+
if (shape instanceof Oval) {
|
|
7983
|
+
drawOval(ctx, shape.width, shape.height);
|
|
7984
|
+
}
|
|
7985
|
+
else {
|
|
7986
|
+
drawRect(ctx, shape.width, shape.height);
|
|
7987
|
+
}
|
|
7988
|
+
ctx.stroke();
|
|
7989
|
+
}
|
|
7990
|
+
ctx.restore();
|
|
7991
|
+
}
|
|
7992
|
+
}
|
|
7993
|
+
}
|
|
7958
7994
|
async draw() {
|
|
7959
7995
|
const ctx = this.ctx;
|
|
7960
7996
|
const canvas = ctx.canvas;
|
|
7961
7997
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
7962
7998
|
ctx.save();
|
|
7963
|
-
const width = this.realWidth * this.ratio;
|
|
7964
|
-
const height = this.realHeight * this.ratio;
|
|
7965
|
-
const x = canvas.width / 2 - width / 2;
|
|
7966
|
-
const y = canvas.height / 2 - height / 2;
|
|
7967
7999
|
if (this.horizontal) {
|
|
7968
8000
|
ctx.rotate(-Math.PI / 2);
|
|
7969
8001
|
ctx.translate(-this.canvasWidth, 0);
|
|
7970
8002
|
}
|
|
7971
|
-
await this.
|
|
8003
|
+
await this.beforeItems?.call(this, this);
|
|
8004
|
+
await this.drawItems();
|
|
8005
|
+
await this.afterItems?.call(this, this);
|
|
7972
8006
|
ctx.restore();
|
|
7973
8007
|
}
|
|
7974
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: InteractiveCanvasComponent, deps: [{ token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7975
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: InteractiveCanvasComponent, isStandalone: false, selector: "interactive-canvas", inputs: { horizontal: "horizontal", selectedIndex: "selectedIndex", resizeMode: "resizeMode", realWidth: "realWidth", realHeight: "realHeight",
|
|
8008
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: InteractiveCanvasComponent, deps: [{ token: i0.Renderer2 }, { token: UniversalService }, { token: i0.ElementRef }, { token: ROOT_ELEMENT }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8009
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: InteractiveCanvasComponent, isStandalone: false, selector: "interactive-canvas", inputs: { debug: "debug", horizontal: "horizontal", selectedIndex: "selectedIndex", resizeMode: "resizeMode", realWidth: "realWidth", realHeight: "realHeight", panOffset: "panOffset", params: "params", beforeItems: "beforeItems", afterItems: "afterItems" }, outputs: { selectedIndexChange: "selectedIndexChange", itemPan: "itemPan", itemPanEnd: "itemPanEnd" }, host: { listeners: { "window:touchend": "onTouchEnd($event)", "window:mouseup": "onMouseUp($event)" } }, queries: [{ propertyName: "itemList", predicate: InteractiveItemComponent }], viewQueries: [{ propertyName: "containerElem", first: true, predicate: ["containerElem"], descendants: true, static: true }, { propertyName: "canvasElem", first: true, predicate: ["canvasElem"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div #containerElem\n [ngClass]=\"['interactive-canvas-wrapper', horizontal ? 'horizontal' : 'vertical']\"\n (resize)=\"resize()\"\n (touchstart)=\"onTouchStart($event)\"\n (mousedown)=\"onMouseDown()\"\n (mousemove)=\"onMouseMove($event)\"\n (mouseleave)=\"onMouseLeave()\"\n (panend)=\"onPanEnd()\"\n (panmove)=\"onPan($event)\"\n (panstart)=\"onPanStart($event)\">\n <canvas #canvasElem class=\"interactive-canvas-element\"></canvas>\n</div>\n", styles: [".interactive-canvas-wrapper{width:100%;height:100%;position:relative;display:flex;align-items:center;justify-content:center}.interactive-canvas-wrapper .interactive-canvas-element{position:absolute;pointer-events:none}\n"], dependencies: [{ kind: "directive", type: i1$3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] }); }
|
|
7976
8010
|
}
|
|
7977
8011
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: InteractiveCanvasComponent, decorators: [{
|
|
7978
8012
|
type: Component,
|
|
7979
8013
|
args: [{ standalone: false, selector: "interactive-canvas", template: "<div #containerElem\n [ngClass]=\"['interactive-canvas-wrapper', horizontal ? 'horizontal' : 'vertical']\"\n (resize)=\"resize()\"\n (touchstart)=\"onTouchStart($event)\"\n (mousedown)=\"onMouseDown()\"\n (mousemove)=\"onMouseMove($event)\"\n (mouseleave)=\"onMouseLeave()\"\n (panend)=\"onPanEnd()\"\n (panmove)=\"onPan($event)\"\n (panstart)=\"onPanStart($event)\">\n <canvas #canvasElem class=\"interactive-canvas-element\"></canvas>\n</div>\n", styles: [".interactive-canvas-wrapper{width:100%;height:100%;position:relative;display:flex;align-items:center;justify-content:center}.interactive-canvas-wrapper .interactive-canvas-element{position:absolute;pointer-events:none}\n"] }]
|
|
7980
|
-
}], ctorParameters: () => [{ type: i0.Renderer2 }
|
|
8014
|
+
}], ctorParameters: () => [{ type: i0.Renderer2 }, { type: UniversalService }, { type: i0.ElementRef }, { type: HTMLElement, decorators: [{
|
|
8015
|
+
type: Inject,
|
|
8016
|
+
args: [ROOT_ELEMENT]
|
|
8017
|
+
}] }], propDecorators: { debug: [{
|
|
8018
|
+
type: Input
|
|
8019
|
+
}], horizontal: [{
|
|
7981
8020
|
type: Input
|
|
7982
8021
|
}], selectedIndex: [{
|
|
7983
8022
|
type: Input
|
|
@@ -7987,10 +8026,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
7987
8026
|
type: Input
|
|
7988
8027
|
}], realHeight: [{
|
|
7989
8028
|
type: Input
|
|
7990
|
-
}],
|
|
8029
|
+
}], panOffset: [{
|
|
8030
|
+
type: Input
|
|
8031
|
+
}], params: [{
|
|
8032
|
+
type: Input
|
|
8033
|
+
}], beforeItems: [{
|
|
8034
|
+
type: Input
|
|
8035
|
+
}], afterItems: [{
|
|
7991
8036
|
type: Input
|
|
7992
8037
|
}], selectedIndexChange: [{
|
|
7993
8038
|
type: Output
|
|
8039
|
+
}], itemPan: [{
|
|
8040
|
+
type: Output
|
|
8041
|
+
}], itemPanEnd: [{
|
|
8042
|
+
type: Output
|
|
7994
8043
|
}], containerElem: [{
|
|
7995
8044
|
type: ViewChild,
|
|
7996
8045
|
args: ["containerElem", { static: true }]
|
|
@@ -8009,31 +8058,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
8009
8058
|
}] } });
|
|
8010
8059
|
|
|
8011
8060
|
class InteractiveCircleComponent extends InteractiveItemComponent {
|
|
8012
|
-
|
|
8013
|
-
return this.iCanvas;
|
|
8014
|
-
}
|
|
8015
|
-
get shape() {
|
|
8016
|
-
return "circle";
|
|
8017
|
-
}
|
|
8018
|
-
constructor(iCanvas) {
|
|
8061
|
+
constructor() {
|
|
8019
8062
|
super();
|
|
8020
|
-
this.
|
|
8063
|
+
this.radius = 10;
|
|
8064
|
+
}
|
|
8065
|
+
draw(ctx) {
|
|
8066
|
+
const diameter = this.radius * 2 * this.canvas.ratio;
|
|
8067
|
+
drawOval(ctx, diameter, diameter);
|
|
8068
|
+
ctx.fill();
|
|
8069
|
+
ctx.stroke();
|
|
8021
8070
|
}
|
|
8022
8071
|
calcShape(x, y) {
|
|
8023
8072
|
const ratio = this.canvas.ratio;
|
|
8024
8073
|
return new Circle(x, y, this.radius * ratio);
|
|
8025
8074
|
}
|
|
8026
|
-
|
|
8027
|
-
const radius = this.radius * this.canvas.ratio * scale;
|
|
8028
|
-
this.shapes.forEach(shape => {
|
|
8029
|
-
ctx.beginPath();
|
|
8030
|
-
ctx.arc(shape.x, shape.y, radius, 0, Math.PI * 2);
|
|
8031
|
-
ctx.closePath();
|
|
8032
|
-
ctx.fill();
|
|
8033
|
-
ctx.stroke();
|
|
8034
|
-
});
|
|
8035
|
-
}
|
|
8036
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: InteractiveCircleComponent, deps: [{ token: InteractiveCanvasComponent }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8075
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: InteractiveCircleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8037
8076
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: InteractiveCircleComponent, isStandalone: false, selector: "interactive-circle", inputs: { radius: "radius" }, providers: [
|
|
8038
8077
|
{ provide: InteractiveItemComponent, useExisting: InteractiveCircleComponent },
|
|
8039
8078
|
], usesInheritance: true, ngImport: i0, template: "", isInline: true }); }
|
|
@@ -8048,39 +8087,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
8048
8087
|
{ provide: InteractiveItemComponent, useExisting: InteractiveCircleComponent },
|
|
8049
8088
|
]
|
|
8050
8089
|
}]
|
|
8051
|
-
}], ctorParameters: () => [
|
|
8090
|
+
}], ctorParameters: () => [], propDecorators: { radius: [{
|
|
8052
8091
|
type: Input
|
|
8053
8092
|
}] } });
|
|
8054
8093
|
|
|
8055
8094
|
class InteractiveRectComponent extends InteractiveItemComponent {
|
|
8056
|
-
|
|
8057
|
-
return this.iCanvas;
|
|
8058
|
-
}
|
|
8059
|
-
get shape() {
|
|
8060
|
-
return "rect";
|
|
8061
|
-
}
|
|
8062
|
-
constructor(iCanvas) {
|
|
8095
|
+
constructor() {
|
|
8063
8096
|
super();
|
|
8064
|
-
this.
|
|
8097
|
+
this.width = 10;
|
|
8098
|
+
this.height = 10;
|
|
8099
|
+
this.rotation = 0;
|
|
8100
|
+
}
|
|
8101
|
+
draw(ctx) {
|
|
8102
|
+
const ratio = this.canvas.ratio;
|
|
8103
|
+
ctx.rotate(toRadians(this.rotation));
|
|
8104
|
+
drawRect(ctx, this.width * ratio, this.height * ratio);
|
|
8105
|
+
ctx.fill();
|
|
8106
|
+
ctx.stroke();
|
|
8065
8107
|
}
|
|
8066
8108
|
calcShape(x, y) {
|
|
8067
8109
|
const ratio = this.canvas.ratio;
|
|
8068
8110
|
return new Rect(x, y, this.width * ratio, this.height * ratio, this.rotation);
|
|
8069
8111
|
}
|
|
8070
|
-
|
|
8071
|
-
|
|
8072
|
-
const width = this.width * scale;
|
|
8073
|
-
const height = this.height * scale;
|
|
8074
|
-
this.shapes.forEach(shape => {
|
|
8075
|
-
ctx.beginPath();
|
|
8076
|
-
ctx.rect(shape.x - width / 2, shape.y - height / 2, width, height);
|
|
8077
|
-
ctx.closePath();
|
|
8078
|
-
ctx.fill();
|
|
8079
|
-
ctx.stroke();
|
|
8080
|
-
});
|
|
8081
|
-
}
|
|
8082
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: InteractiveRectComponent, deps: [{ token: InteractiveCanvasComponent }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8083
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: InteractiveRectComponent, isStandalone: false, selector: "interactive-rect", inputs: { width: "width", height: "height" }, providers: [
|
|
8112
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: InteractiveRectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8113
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: InteractiveRectComponent, isStandalone: false, selector: "interactive-rect", inputs: { width: "width", height: "height", rotation: "rotation" }, providers: [
|
|
8084
8114
|
{ provide: InteractiveItemComponent, useExisting: InteractiveRectComponent },
|
|
8085
8115
|
], usesInheritance: true, ngImport: i0, template: "", isInline: true }); }
|
|
8086
8116
|
}
|
|
@@ -8094,10 +8124,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
8094
8124
|
{ provide: InteractiveItemComponent, useExisting: InteractiveRectComponent },
|
|
8095
8125
|
]
|
|
8096
8126
|
}]
|
|
8097
|
-
}], ctorParameters: () => [
|
|
8127
|
+
}], ctorParameters: () => [], propDecorators: { width: [{
|
|
8098
8128
|
type: Input
|
|
8099
8129
|
}], height: [{
|
|
8100
8130
|
type: Input
|
|
8131
|
+
}], rotation: [{
|
|
8132
|
+
type: Input
|
|
8101
8133
|
}] } });
|
|
8102
8134
|
|
|
8103
8135
|
class TabsComponent {
|
|
@@ -8586,7 +8618,6 @@ const providers = [
|
|
|
8586
8618
|
ComponentLoaderService,
|
|
8587
8619
|
TranslatedUrlSerializer,
|
|
8588
8620
|
UniversalService,
|
|
8589
|
-
WasmService,
|
|
8590
8621
|
DeviceDetectorService,
|
|
8591
8622
|
GlobalTemplateService,
|
|
8592
8623
|
{
|
|
@@ -8617,163 +8648,6 @@ function loadConfig(config) {
|
|
|
8617
8648
|
return config.load;
|
|
8618
8649
|
}
|
|
8619
8650
|
|
|
8620
|
-
class Wasi {
|
|
8621
|
-
constructor() {
|
|
8622
|
-
this.env = {};
|
|
8623
|
-
this.instantiated = false;
|
|
8624
|
-
this.wasi = [
|
|
8625
|
-
"emscripten_notify_memory_growth",
|
|
8626
|
-
"proc_exit",
|
|
8627
|
-
"environ_get",
|
|
8628
|
-
"environ_sizes_get",
|
|
8629
|
-
"fd_close",
|
|
8630
|
-
"fd_write",
|
|
8631
|
-
"fd_read",
|
|
8632
|
-
"fd_seek",
|
|
8633
|
-
].reduce((res, key) => {
|
|
8634
|
-
if (typeof this[key] === "function") {
|
|
8635
|
-
res[key] = this[key].bind(this);
|
|
8636
|
-
}
|
|
8637
|
-
return res;
|
|
8638
|
-
}, {});
|
|
8639
|
-
}
|
|
8640
|
-
instantiate(bytes) {
|
|
8641
|
-
if (this.instantiated) {
|
|
8642
|
-
throw new Error("WASI already instantiated");
|
|
8643
|
-
}
|
|
8644
|
-
this.instantiated = true;
|
|
8645
|
-
return WebAssembly.instantiate(bytes, {
|
|
8646
|
-
wasi_snapshot_preview1: this.wasi,
|
|
8647
|
-
env: this.wasi
|
|
8648
|
-
}).then(module => {
|
|
8649
|
-
const exports = module.instance.exports;
|
|
8650
|
-
this.wasm = {
|
|
8651
|
-
...exports,
|
|
8652
|
-
writeArrayToMemory: (array) => {
|
|
8653
|
-
const bytes = array.length * array.BYTES_PER_ELEMENT;
|
|
8654
|
-
const pointer = exports.malloc(bytes);
|
|
8655
|
-
const ctr = array.constructor;
|
|
8656
|
-
const heapArray = new ctr(this.wasm.memory.buffer, pointer, array.length);
|
|
8657
|
-
heapArray.set(array);
|
|
8658
|
-
return pointer;
|
|
8659
|
-
},
|
|
8660
|
-
readArrayFromMemory: (pointer, array) => {
|
|
8661
|
-
const ctr = array.constructor;
|
|
8662
|
-
const heapArray = new ctr(this.wasm.memory.buffer, pointer, array.length);
|
|
8663
|
-
array.set(heapArray);
|
|
8664
|
-
return array;
|
|
8665
|
-
}
|
|
8666
|
-
};
|
|
8667
|
-
this.updateMemoryViews();
|
|
8668
|
-
return this.wasm;
|
|
8669
|
-
});
|
|
8670
|
-
}
|
|
8671
|
-
updateMemoryViews() {
|
|
8672
|
-
const buffer = this.wasm.memory.buffer;
|
|
8673
|
-
this.wasm.HEAP8 = new Int8Array(buffer);
|
|
8674
|
-
this.wasm.HEAP16 = new Int16Array(buffer);
|
|
8675
|
-
this.wasm.HEAP32 = new Int32Array(buffer);
|
|
8676
|
-
this.wasm.HEAPU8 = new Uint8Array(buffer);
|
|
8677
|
-
this.wasm.HEAPU16 = new Uint16Array(buffer);
|
|
8678
|
-
this.wasm.HEAPU32 = new Uint32Array(buffer);
|
|
8679
|
-
this.wasm.HEAPF32 = new Float32Array(buffer);
|
|
8680
|
-
this.wasm.HEAPF64 = new Float64Array(buffer);
|
|
8681
|
-
}
|
|
8682
|
-
getEnvStrings() {
|
|
8683
|
-
if (!this.envStrings) {
|
|
8684
|
-
let x;
|
|
8685
|
-
const env = {};
|
|
8686
|
-
for (x in this.env) {
|
|
8687
|
-
if (this.env[x] === undefined)
|
|
8688
|
-
delete env[x];
|
|
8689
|
-
else
|
|
8690
|
-
env[x] = this.env[x];
|
|
8691
|
-
}
|
|
8692
|
-
const strings = [];
|
|
8693
|
-
for (x in env) {
|
|
8694
|
-
strings.push(x + "=" + env[x]);
|
|
8695
|
-
}
|
|
8696
|
-
this.envStrings = strings;
|
|
8697
|
-
}
|
|
8698
|
-
return this.envStrings;
|
|
8699
|
-
}
|
|
8700
|
-
stringToAscii(str, buffer) {
|
|
8701
|
-
const HEAP8 = this.wasm.HEAP8;
|
|
8702
|
-
for (let i = 0; i < str.length; ++i) {
|
|
8703
|
-
HEAP8[buffer++ >> 0] = str.charCodeAt(i);
|
|
8704
|
-
}
|
|
8705
|
-
HEAP8[buffer >> 0] = 0;
|
|
8706
|
-
}
|
|
8707
|
-
emscripten_notify_memory_growth(memoryIndex) {
|
|
8708
|
-
this.updateMemoryViews();
|
|
8709
|
-
}
|
|
8710
|
-
proc_exit(rval) {
|
|
8711
|
-
console.log("proc_exit", rval);
|
|
8712
|
-
}
|
|
8713
|
-
environ_get(environ, environ_buf) {
|
|
8714
|
-
if (!this.wasm.HEAP8.byteLength) {
|
|
8715
|
-
this.emscripten_notify_memory_growth(0);
|
|
8716
|
-
}
|
|
8717
|
-
const HEAPU32 = this.wasm.HEAPU32;
|
|
8718
|
-
let bufSize = 0;
|
|
8719
|
-
this.getEnvStrings().forEach((str, i) => {
|
|
8720
|
-
const ptr = environ_buf + bufSize;
|
|
8721
|
-
HEAPU32[environ + i * 4 >> 2] = ptr;
|
|
8722
|
-
this.stringToAscii(str, ptr);
|
|
8723
|
-
bufSize += str.length + 1;
|
|
8724
|
-
});
|
|
8725
|
-
return 0;
|
|
8726
|
-
}
|
|
8727
|
-
environ_sizes_get(penviron_count, penviron_buf_size) {
|
|
8728
|
-
if (!this.wasm.HEAP8.byteLength) {
|
|
8729
|
-
this.emscripten_notify_memory_growth(0);
|
|
8730
|
-
}
|
|
8731
|
-
const HEAPU32 = this.wasm.HEAPU32;
|
|
8732
|
-
const strings = this.getEnvStrings();
|
|
8733
|
-
HEAPU32[penviron_count >> 2] = strings.length;
|
|
8734
|
-
let bufSize = 0;
|
|
8735
|
-
strings.forEach(function (string) {
|
|
8736
|
-
bufSize += string.length + 1;
|
|
8737
|
-
});
|
|
8738
|
-
HEAPU32[penviron_buf_size >> 2] = bufSize;
|
|
8739
|
-
// WASI_ESUCCESS
|
|
8740
|
-
return 0;
|
|
8741
|
-
}
|
|
8742
|
-
fd_close(fd) {
|
|
8743
|
-
// WASI_ESUCCESS
|
|
8744
|
-
return 0;
|
|
8745
|
-
}
|
|
8746
|
-
fd_write(fd, iovs, iovs_len, nwritten) {
|
|
8747
|
-
if (fd !== 1) {
|
|
8748
|
-
// WASI_EBADF
|
|
8749
|
-
return 8;
|
|
8750
|
-
}
|
|
8751
|
-
if (iovs_len !== 1) {
|
|
8752
|
-
// WASI_ENOSYS
|
|
8753
|
-
return 52;
|
|
8754
|
-
}
|
|
8755
|
-
this.wasm.HEAPU32[nwritten >> 2] = this.wasm.HEAPU32[iovs + 4 >> 2];
|
|
8756
|
-
// WASI_ESUCCESS
|
|
8757
|
-
return 0;
|
|
8758
|
-
}
|
|
8759
|
-
fd_read(fd, iovs, iovs_len, nread) {
|
|
8760
|
-
// WASI_EINVAL
|
|
8761
|
-
return 28;
|
|
8762
|
-
}
|
|
8763
|
-
fd_seek(fd, offset, whence, newOffset) {
|
|
8764
|
-
// WASI_EINVAL
|
|
8765
|
-
return 28;
|
|
8766
|
-
}
|
|
8767
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: Wasi, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
8768
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: Wasi, providedIn: "root" }); }
|
|
8769
|
-
}
|
|
8770
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: Wasi, decorators: [{
|
|
8771
|
-
type: Injectable,
|
|
8772
|
-
args: [{
|
|
8773
|
-
providedIn: "root"
|
|
8774
|
-
}]
|
|
8775
|
-
}], ctorParameters: () => [] });
|
|
8776
|
-
|
|
8777
8651
|
function loadBaseUrl() {
|
|
8778
8652
|
if (typeof (document) === "undefined" || typeof (location) === "undefined")
|
|
8779
8653
|
return "/";
|
|
@@ -8853,10 +8727,6 @@ class NgxUtilsModule {
|
|
|
8853
8727
|
provide: DIALOG_SERVICE,
|
|
8854
8728
|
useExisting: (!config ? null : config.dialogService) || BaseDialogService
|
|
8855
8729
|
},
|
|
8856
|
-
{
|
|
8857
|
-
provide: WASI_IMPLEMENTATION,
|
|
8858
|
-
useExisting: (!config ? null : config.wasiImplementation) || Wasi
|
|
8859
|
-
},
|
|
8860
8730
|
{
|
|
8861
8731
|
provide: ICON_TYPE,
|
|
8862
8732
|
useValue: (!config ? null : config.iconType) || IconDefaultComponent,
|
|
@@ -8894,17 +8764,18 @@ class NgxUtilsModule {
|
|
|
8894
8764
|
provide: STATIC_SCHEMAS,
|
|
8895
8765
|
useValue: (!config ? null : config.staticSchemas) ?? {},
|
|
8896
8766
|
},
|
|
8897
|
-
{
|
|
8898
|
-
provide: APP_INITIALIZER,
|
|
8899
|
-
useFactory: (!config ? null : config.initializeApp) || loadConfig,
|
|
8900
|
-
multi: true,
|
|
8901
|
-
deps: [(!config ? null : config.initializeApp) ? Injector : CONFIG_SERVICE]
|
|
8902
|
-
},
|
|
8903
8767
|
{
|
|
8904
8768
|
provide: APP_BASE_HREF,
|
|
8905
8769
|
useFactory: loadBaseHref,
|
|
8906
8770
|
deps: [APP_BASE_URL]
|
|
8907
|
-
}
|
|
8771
|
+
},
|
|
8772
|
+
provideAppInitializer(() => {
|
|
8773
|
+
if (config && config.initializeApp) {
|
|
8774
|
+
const initializer = config.initializeApp(inject(Injector));
|
|
8775
|
+
return initializer();
|
|
8776
|
+
}
|
|
8777
|
+
return loadConfig(inject(CONFIG_SERVICE));
|
|
8778
|
+
}),
|
|
8908
8779
|
];
|
|
8909
8780
|
}
|
|
8910
8781
|
static forRoot(config) {
|
|
@@ -8976,5 +8847,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
8976
8847
|
* Generated bundle index. Do not edit.
|
|
8977
8848
|
*/
|
|
8978
8849
|
|
|
8979
|
-
export { API_SERVICE, APP_BASE_URL, AUTH_SERVICE, AclService, AjaxRequestHandler, ApiService, ArrayUtils, AsyncMethodBase, AsyncMethodDirective, AsyncMethodTargetDirective, AuthGuard, BASE_CONFIG, BUTTON_TYPE, BackgroundDirective, BaseDialogService, BaseHttpClient, BaseHttpService, BaseToasterService, BtnComponent, BtnDefaultComponent, CONFIG_SERVICE, CacheService, CanvasColor, CanvasUtils, ChipsComponent, ChunkPipe, Circle, CloseBtnComponent, ComponentLoaderDirective, ComponentLoaderService, ConfigService, DIALOG_SERVICE, DateUtils, DragDropEventPlugin, DropListComponent, DropdownBoxComponent, DropdownContentDirective, DropdownDirective, DropdownToggleDirective, DynamicTableComponent, DynamicTableTemplateDirective, ERROR_HANDLER, EXPRESS_REQUEST, EntriesPipe, ErrorHandlerService, EventsService, ExtraItemPropertiesPipe, FactoryDependencies, FakeModuleComponent, FileSystemEntry, FileUtils, FilterPipe, FindPipe, ForbiddenZone, FormatNumberPipe, FormatterService, GenericValue, GetOffsetPipe, GetTypePipe, GetValuePipe, GlobalTemplateDirective, GlobalTemplatePipe, GlobalTemplateService, GroupByPipe, ICON_MAP, ICON_SERVICE, ICON_TYPE, IConfiguration, IconComponent, IconDefaultComponent, IconDirective, IconService, IncludesPipe, Initializer, InteractiveCanvasComponent, InteractiveCircleComponent, InteractiveItemComponent, InteractiveRectComponent, IsTypePipe, JSONfn, JoinPipe, KeysPipe, LANGUAGE_SERVICE, LanguageService, LoaderUtils, LocalHttpService, MapPipe, MathUtils, MaxPipe, MinPipe, NgxTemplateOutletDirective, NgxUtilsModule, OPTIONS_TOKEN, ObjectType, ObjectUtils, ObservableUtils, OpenApiService, PROMISE_SERVICE, PaginationDirective, PaginationItemContext, PaginationItemDirective, PaginationMenuComponent, Point, PopPipe, PromiseService, RESIZE_DELAY, RESIZE_STRATEGY, ROOT_ELEMENT, Rect, ReducePipe, ReflectUtils, RemapPipe, ReplacePipe, ResizeEventPlugin, ResourceIfContext, ResourceIfDirective, ReversePipe, RoundPipe, SCRIPT_PARAMS, STATIC_SCHEMAS, SafeHtmlPipe, ScrollEventPlugin, SetUtils, ShiftPipe, SocketClient, SocketService, SplitPipe, StateService, StaticAuthService, StaticLanguageService, StickyClassDirective, StickyDirective, StorageMode, StorageService, StringUtils, TOASTER_SERVICE, TabsComponent, TabsItemDirective, TabsTemplateDirective, TimerUtils, TranslatePipe, TranslatedUrlSerializer, UniqueUtils, UniversalService, UnorderedListComponent, UnorderedListItemDirective, UnorderedListTemplateDirective, UploadComponent, ValuedPromise, ValuesPipe,
|
|
8850
|
+
export { API_SERVICE, APP_BASE_URL, AUTH_SERVICE, AclService, AjaxRequestHandler, ApiService, ArrayUtils, AsyncMethodBase, AsyncMethodDirective, AsyncMethodTargetDirective, AuthGuard, BASE_CONFIG, BUTTON_TYPE, BackgroundDirective, BaseDialogService, BaseHttpClient, BaseHttpService, BaseToasterService, BtnComponent, BtnDefaultComponent, CONFIG_SERVICE, CacheService, CanvasColor, CanvasUtils, ChipsComponent, ChunkPipe, Circle, CloseBtnComponent, ComponentLoaderDirective, ComponentLoaderService, ConfigService, DIALOG_SERVICE, DateUtils, DragDropEventPlugin, DropListComponent, DropdownBoxComponent, DropdownContentDirective, DropdownDirective, DropdownToggleDirective, DynamicTableComponent, DynamicTableTemplateDirective, ERROR_HANDLER, EXPRESS_REQUEST, EntriesPipe, ErrorHandlerService, EventsService, ExtraItemPropertiesPipe, FactoryDependencies, FakeModuleComponent, FileSystemEntry, FileUtils, FilterPipe, FindPipe, ForbiddenZone, FormatNumberPipe, FormatterService, GenericValue, GetOffsetPipe, GetTypePipe, GetValuePipe, GlobalTemplateDirective, GlobalTemplatePipe, GlobalTemplateService, GroupByPipe, ICON_MAP, ICON_SERVICE, ICON_TYPE, IConfiguration, IconComponent, IconDefaultComponent, IconDirective, IconService, IncludesPipe, Initializer, InteractiveCanvasComponent, InteractiveCircleComponent, InteractiveItemComponent, InteractiveRectComponent, IsTypePipe, JSONfn, JoinPipe, KeysPipe, LANGUAGE_SERVICE, LanguageService, LoaderUtils, LocalHttpService, MapPipe, MathUtils, MaxPipe, MinPipe, NgxTemplateOutletDirective, NgxUtilsModule, OPTIONS_TOKEN, ObjectType, ObjectUtils, ObservableUtils, OpenApiService, Oval, PROMISE_SERVICE, PaginationDirective, PaginationItemContext, PaginationItemDirective, PaginationMenuComponent, Point, PopPipe, PromiseService, RESIZE_DELAY, RESIZE_STRATEGY, ROOT_ELEMENT, Rect, ReducePipe, ReflectUtils, RemapPipe, ReplacePipe, ResizeEventPlugin, ResourceIfContext, ResourceIfDirective, ReversePipe, RoundPipe, SCRIPT_PARAMS, STATIC_SCHEMAS, SafeHtmlPipe, ScrollEventPlugin, SetUtils, ShiftPipe, SocketClient, SocketService, SplitPipe, StateService, StaticAuthService, StaticLanguageService, StickyClassDirective, StickyDirective, StorageMode, StorageService, StringUtils, TOASTER_SERVICE, TabsComponent, TabsItemDirective, TabsTemplateDirective, TimerUtils, TranslatePipe, TranslatedUrlSerializer, UniqueUtils, UniversalService, UnorderedListComponent, UnorderedListItemDirective, UnorderedListTemplateDirective, UploadComponent, ValuedPromise, ValuesPipe, cachedFactory, cancelablePromise, checkTransitions, computedPrevious, createTypedProvider, cssStyles, cssVariables, dotProduct, drawOval, drawRect, getComponentDef, getCssVariables, getRoot, hashCode, impatientPromise, isBrowser, isPoint, parseSelector, perpendicular, provideEntryComponents, provideWithOptions, ptAdd, ptDistance, ptLength, ptMultiply, ptSubtract, rotateDeg, rotateRad, selectorMatchesList, switchClass, toDegrees, toRadians };
|
|
8980
8851
|
//# sourceMappingURL=stemy-ngx-utils.mjs.map
|