archgine 1.0.49 → 1.0.53
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/README.md +7 -0
- package/lib/applications/app-cvs.d.ts +7 -0
- package/lib/applications/app-offscreen.d.ts +2 -0
- package/lib/applications/application.d.ts +4 -2
- package/lib/controls/orbit-controller.d.ts +1 -0
- package/lib/core/queue.d.ts +6 -0
- package/lib/core/tic.d.ts +9 -0
- package/lib/environment.worker.js +9 -2
- package/lib/extras/adapter.d.ts +0 -26
- package/lib/extras/interfaces.d.ts +1 -0
- package/lib/extras/svg-app.d.ts +1 -1
- package/lib/geometries/geo2.d.ts +2 -0
- package/lib/helpers/canvas-helper.d.ts +2 -2
- package/lib/helpers/geo-helper.d.ts +3 -2
- package/lib/helpers/merge-helper.d.ts +2 -2
- package/lib/helpers/svg-helper.d.ts +30 -0
- package/lib/helpers/texture-helper.d.ts +9 -9
- package/lib/index.mjs +6460 -6101
- package/lib/index.umd.js +25 -25
- package/lib/interfaces.d.ts +6 -0
- package/lib/materials/mat2.d.ts +3 -1
- package/lib/math/box2.d.ts +1 -1
- package/lib/math/matrix3.d.ts +2 -1
- package/lib/objects/shape2.d.ts +1 -0
- package/lib/renderer.worker.js +6584 -6155
- package/lib/renderers/cvs-renderer.d.ts +2 -0
- package/lib/renderers/render-target.d.ts +3 -3
- package/lib/scenes/loading-scene.d.ts +1 -0
- package/lib/shapes2/dummy.d.ts +19 -0
- package/lib/shapes2/svg.d.ts +18 -0
- package/lib/utils/svg.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,11 +6,18 @@ export declare class AppCvs<Config extends IApplicationConfig> extends Applicati
|
|
|
6
6
|
params: Config;
|
|
7
7
|
adapter: Adapter;
|
|
8
8
|
mainScene: MainScene<Config>;
|
|
9
|
+
private _url?;
|
|
10
|
+
private _layers?;
|
|
9
11
|
constructor(config?: Config);
|
|
10
12
|
destroy(): void;
|
|
11
13
|
load(url?: string, layers?: string[]): Promise<void>;
|
|
14
|
+
reload(): Promise<void>;
|
|
15
|
+
/** overwrite */
|
|
16
|
+
usedCacheChanged(v?: boolean): Promise<void>;
|
|
12
17
|
getLayers(lv?: number): ITree[];
|
|
13
18
|
trans2MainScene(): void;
|
|
14
19
|
fullScreen(): void;
|
|
15
20
|
updateLayersVisibility(ids: string | string[], visible?: boolean): void;
|
|
21
|
+
/** overwrite */
|
|
22
|
+
running(time: DOMHighResTimeStamp): void;
|
|
16
23
|
}
|
|
@@ -22,6 +22,8 @@ export declare class AppOffscreen<Config extends IApplicationConfig> extends Eve
|
|
|
22
22
|
resize(): void;
|
|
23
23
|
load(url: string, layers?: string[]): Promise<void>;
|
|
24
24
|
getLayers(lv?: number): Promise<ITree[]>;
|
|
25
|
+
usedCacheChanged(v?: boolean): void;
|
|
26
|
+
wireframeChanged(v?: boolean): void;
|
|
25
27
|
fullscreen(): Promise<void>;
|
|
26
28
|
saveCameraPosition(id?: string): void;
|
|
27
29
|
restoreCameraPosition(id?: string): void;
|
|
@@ -33,7 +33,7 @@ export declare abstract class Application<Config extends IApplicationConfig> ext
|
|
|
33
33
|
scenes: Scene[];
|
|
34
34
|
nextScenes: Scene[];
|
|
35
35
|
nextBoundingBox: Box2;
|
|
36
|
-
loadingScene
|
|
36
|
+
loadingScene?: Scene;
|
|
37
37
|
composer: EffectComposer;
|
|
38
38
|
renderer: IRenderer2;
|
|
39
39
|
view: View<any>;
|
|
@@ -41,7 +41,9 @@ export declare abstract class Application<Config extends IApplicationConfig> ext
|
|
|
41
41
|
protected constructor(config?: Config);
|
|
42
42
|
get isLoadingScene(): boolean;
|
|
43
43
|
destroy(): void;
|
|
44
|
-
|
|
44
|
+
usedCacheChanged(v?: boolean): Promise<void>;
|
|
45
|
+
wireframeChanged(v?: boolean): void;
|
|
46
|
+
trans2LoadingScene(): Promise<void>;
|
|
45
47
|
hasScene(scene: Scene): boolean;
|
|
46
48
|
pushScene(scene: Scene): void;
|
|
47
49
|
clearScenes(): void;
|
|
@@ -52,6 +52,7 @@ export declare class OrbitController extends EventDispatcher implements IOrbitCo
|
|
|
52
52
|
private readonly hammerInputHandler;
|
|
53
53
|
constructor(dom: HTMLElement, camera: ICamera2, isSvg?: boolean);
|
|
54
54
|
destroy(): void;
|
|
55
|
+
resize(): void;
|
|
55
56
|
update(): void;
|
|
56
57
|
bindEvents(): void;
|
|
57
58
|
unbindEvents(): void;
|
package/lib/core/queue.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export interface IQueue<T = any> {
|
|
|
8
8
|
getByIndex(index: number): T | undefined;
|
|
9
9
|
setByIndex(index: number, item: T): boolean;
|
|
10
10
|
sort(comparator?: (a: (T | undefined), b: (T | undefined)) => number): void;
|
|
11
|
+
getAll(): T[] | undefined;
|
|
11
12
|
}
|
|
12
13
|
export declare class OQueue<T = any> implements IQueue<T> {
|
|
13
14
|
private count;
|
|
@@ -24,6 +25,7 @@ export declare class OQueue<T = any> implements IQueue<T> {
|
|
|
24
25
|
getByIndex(index: number): T | undefined;
|
|
25
26
|
setByIndex(index: number, item: T): boolean;
|
|
26
27
|
sort(comparator?: (a: (T | undefined), b: (T | undefined)) => number): void;
|
|
28
|
+
getAll(): T[] | undefined;
|
|
27
29
|
}
|
|
28
30
|
export declare class AQueue<T = any> implements IQueue<T> {
|
|
29
31
|
private items;
|
|
@@ -39,6 +41,7 @@ export declare class AQueue<T = any> implements IQueue<T> {
|
|
|
39
41
|
setByIndex(index: number, item: T): boolean;
|
|
40
42
|
sort(comparator?: (a: (T | undefined), b: (T | undefined)) => number): void;
|
|
41
43
|
toString(): string;
|
|
44
|
+
getAll(): T[] | undefined;
|
|
42
45
|
}
|
|
43
46
|
export declare class ABQueue<T = any> implements IQueue<T> {
|
|
44
47
|
cellCapacity: number;
|
|
@@ -58,6 +61,7 @@ export declare class ABQueue<T = any> implements IQueue<T> {
|
|
|
58
61
|
getByIndex(index: number): T | undefined;
|
|
59
62
|
setByIndex(index: number, item: T): boolean;
|
|
60
63
|
sort(comparator?: (a: (T | undefined), b: (T | undefined)) => number): void;
|
|
64
|
+
getAll(): T[] | undefined;
|
|
61
65
|
}
|
|
62
66
|
export declare class LQueue<T = any> implements IQueue<T> {
|
|
63
67
|
private head;
|
|
@@ -75,6 +79,7 @@ export declare class LQueue<T = any> implements IQueue<T> {
|
|
|
75
79
|
isEmpty(): boolean;
|
|
76
80
|
sort(comparator?: (a: (T | undefined), b: (T | undefined)) => number): void;
|
|
77
81
|
toString(): string;
|
|
82
|
+
getAll(): T[] | undefined;
|
|
78
83
|
}
|
|
79
84
|
export declare class Queue<T = any> implements IQueue<T> {
|
|
80
85
|
private items;
|
|
@@ -92,4 +97,5 @@ export declare class Queue<T = any> implements IQueue<T> {
|
|
|
92
97
|
setByIndex(index: number, item: T): boolean;
|
|
93
98
|
sort(comparator?: (a: T | undefined, b: T | undefined) => number): void;
|
|
94
99
|
toString(): string;
|
|
100
|
+
getAll(): T[] | undefined;
|
|
95
101
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare class Tic {
|
|
2
|
+
duration: number;
|
|
3
|
+
generator?: Generator<undefined, void, unknown>;
|
|
4
|
+
t: number | null;
|
|
5
|
+
constructor(list: number | any[], callback: Function, duration?: number);
|
|
6
|
+
next(): void;
|
|
7
|
+
queue(len: number, callback: Function): Generator<undefined, void, unknown>;
|
|
8
|
+
clear(): void;
|
|
9
|
+
}
|
|
@@ -12,8 +12,15 @@ var Pe = {
|
|
|
12
12
|
syncDelay: 800,
|
|
13
13
|
animateDuration: 600,
|
|
14
14
|
mergeRendering: !1,
|
|
15
|
-
//
|
|
15
|
+
// 合并渲染,相同材质合并渲染;
|
|
16
|
+
sliceRendering: !0,
|
|
17
|
+
// 切片渲染
|
|
18
|
+
sliceDuration: 15,
|
|
19
|
+
// 切片渲染间隔:1 ~ 40
|
|
16
20
|
usedCache: !1,
|
|
21
|
+
// 开启缓存,相同 featureKey 的图形使用 texture,绘制时需先进行画布TRS
|
|
22
|
+
separateCache: !1,
|
|
23
|
+
// 独立缓存,对于需要TRS的,保存独立 texture,渲染时直接 drawImage
|
|
17
24
|
showPoints: !1,
|
|
18
25
|
wireframe: !1,
|
|
19
26
|
castShadow: !1,
|
|
@@ -3997,7 +4004,7 @@ Fu.__DOMHandler = Eu;
|
|
|
3997
4004
|
Fu.normalizeLineEndings = Le;
|
|
3998
4005
|
Fu.DOMParser = Ie;
|
|
3999
4006
|
var gr = Fu.DOMParser;
|
|
4000
|
-
const Er = "1.0.
|
|
4007
|
+
const Er = "1.0.53";
|
|
4001
4008
|
function vr() {
|
|
4002
4009
|
return typeof window < "u" && ({}.toString.call(window) === "[object Window]" || {}.toString.call(window) === "[object global]");
|
|
4003
4010
|
}
|
package/lib/extras/adapter.d.ts
CHANGED
|
@@ -18,37 +18,11 @@ export declare class Adapter extends EventDispatcher {
|
|
|
18
18
|
clear(): void;
|
|
19
19
|
load(url: string, layers?: string[]): Promise<void>;
|
|
20
20
|
init(str?: string): void;
|
|
21
|
-
/**
|
|
22
|
-
* background:
|
|
23
|
-
* ...
|
|
24
|
-
*
|
|
25
|
-
* gros
|
|
26
|
-
* rm
|
|
27
|
-
* ...
|
|
28
|
-
* gros-labels
|
|
29
|
-
* rm-labels
|
|
30
|
-
* ...
|
|
31
|
-
*/
|
|
32
|
-
initResources(): void;
|
|
33
21
|
initResourcesTree(): void;
|
|
34
|
-
initResource(id: string): void;
|
|
35
22
|
getResources(): IObject2[] | undefined;
|
|
36
23
|
getLayers(lv?: number): ITree[];
|
|
37
24
|
getElementById(id?: string): Element | undefined;
|
|
38
25
|
getSymbolElement(el?: Element): Element | undefined;
|
|
39
|
-
trans2Shape(el?: Element, flipY?: boolean): IObject2 | undefined;
|
|
40
|
-
transG(el?: Element, flipY?: boolean): IObject2 | undefined;
|
|
41
|
-
transSymbol(el?: Element, flipY?: boolean): IObject2 | undefined;
|
|
42
|
-
transPath(el?: Element, flipY?: boolean): IObject2 | undefined;
|
|
43
|
-
transUse(el?: Element, flipY?: boolean): IObject2 | undefined;
|
|
44
|
-
transCircle(el?: Element, flipY?: boolean): IObject2 | undefined;
|
|
45
|
-
/**
|
|
46
|
-
* test linked to asset
|
|
47
|
-
* 1、old version: split with ';', use first;
|
|
48
|
-
* 2、new version: use 'aid' attribute;
|
|
49
|
-
* 3、use 'assetId' + SPLITTER + LABEL_TAG save to elementsMap;
|
|
50
|
-
*/
|
|
51
|
-
transText(el?: Element, flipY?: boolean): IObject2 | undefined;
|
|
52
26
|
getAssetLabelId(assetId: string): string;
|
|
53
27
|
getResourceById(id?: string): IObject2 | undefined;
|
|
54
28
|
getResourceTreeById(t: ITree | ITree[], id?: string): ITree | undefined;
|
|
@@ -15,6 +15,7 @@ export interface IApp {
|
|
|
15
15
|
setAssetType(assetType: string, showLayers?: string[]): void;
|
|
16
16
|
updateLayersVisibility(ids: string[], visible?: boolean): void;
|
|
17
17
|
selectByIds(ids: string | string[]): void;
|
|
18
|
+
clearSelectedByIds(ids: string | string[]): void;
|
|
18
19
|
getSelectedIds(): string[] | undefined;
|
|
19
20
|
targetByIds(id: string | string[]): void;
|
|
20
21
|
linkAssetsByTree(o: ITree): void;
|
package/lib/extras/svg-app.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ export declare class SvgApp<Config extends ISvgAppConfig> extends EventDispatche
|
|
|
50
50
|
getLayers(lv?: number): ITree[] | undefined;
|
|
51
51
|
updateLayersVisibility(ids: string[], visible?: boolean): void;
|
|
52
52
|
selectByIds(ids: string | string[]): void;
|
|
53
|
-
|
|
53
|
+
clearSelectedByIds(ids: string | string[]): void;
|
|
54
54
|
clearSelected(): void;
|
|
55
55
|
getSelectedIds(): string[] | undefined;
|
|
56
56
|
targetByIds(ids: string | string[]): Promise<void>;
|
package/lib/geometries/geo2.d.ts
CHANGED
|
@@ -8,9 +8,11 @@ export interface IGeo2Config {
|
|
|
8
8
|
}
|
|
9
9
|
export declare class Geo2<Config extends IGeo2Config> extends SVGPathData implements IGeo2 {
|
|
10
10
|
name: string;
|
|
11
|
+
id: number;
|
|
11
12
|
params: Config;
|
|
12
13
|
viewMatrix: Matrix3;
|
|
13
14
|
boundingBox: IBox2;
|
|
15
|
+
flipY: boolean;
|
|
14
16
|
constructor(config?: Config);
|
|
15
17
|
_version: number;
|
|
16
18
|
get version(): number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICanvas,
|
|
1
|
+
import { ICanvas, IShape2 } from '../interfaces';
|
|
2
2
|
import { default as Vector2 } from '../math/vector2';
|
|
3
3
|
interface ICanvasConfig {
|
|
4
4
|
containerId?: string;
|
|
@@ -17,7 +17,7 @@ export default class CanvasHelper {
|
|
|
17
17
|
/**
|
|
18
18
|
* @todo: cvs.getContext('bitmaprenderer') => ImageBitmapRenderingContext.transferFromImageBitmap()
|
|
19
19
|
*/
|
|
20
|
-
static getContext2D(cvs:
|
|
20
|
+
static getContext2D(cvs: HTMLCanvasElement | OffscreenCanvas, params?: any): CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;
|
|
21
21
|
static resizeCanvas(cvs: ICanvas, w: number, h: number, r?: number): void;
|
|
22
22
|
static getImageBitmapByCanvasAsync(cvs?: ICanvas): Promise<ImageBitmap | undefined>;
|
|
23
23
|
static get(k: string, w: number, h: number, dpr?: number): OffscreenCanvas;
|
|
@@ -3,10 +3,11 @@ import { SVGCommand } from 'svg-pathdata/src/types';
|
|
|
3
3
|
import { IShape2Config } from '../objects/shape2';
|
|
4
4
|
export declare class GeoHelper {
|
|
5
5
|
params: IShape2Config;
|
|
6
|
+
static splitLimit: number;
|
|
6
7
|
constructor(config?: IShape2Config);
|
|
7
8
|
destroy(): void;
|
|
8
|
-
static getInstanceByElement(o: Element, flipY?: boolean): Geo2<any> | undefined;
|
|
9
|
-
static getInstanceByPath(o: Element, flipY?: boolean): Geo2<any> | undefined;
|
|
9
|
+
static getInstanceByElement(o: Element, flipY?: boolean): Geo2<any> | Geo2<any>[] | undefined;
|
|
10
|
+
static getInstanceByPath(o: Element, flipY?: boolean): Geo2<any> | Geo2<any>[] | undefined;
|
|
10
11
|
static getInstanceByCircle(o: Element, flipY?: boolean): Geo2<any> | undefined;
|
|
11
12
|
static getInstance(cmd: string | SVGCommand[], flipY?: boolean): Geo2<any> | undefined;
|
|
12
13
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { IShape2 } from '../interfaces';
|
|
1
|
+
import { IGroup2, IShape2 } from '../interfaces';
|
|
2
2
|
import { IShape2Config } from '../objects/shape2';
|
|
3
3
|
import { ITextConfig } from '../shapes2/text';
|
|
4
4
|
export declare class MergeHelper {
|
|
5
|
-
static getShapeByElement(el: Element, config: IShape2Config, flipY?: boolean): IShape2;
|
|
5
|
+
static getShapeByElement(el: Element, config: IShape2Config, flipY?: boolean): IShape2 | IGroup2;
|
|
6
6
|
static getText(config: ITextConfig): IShape2;
|
|
7
7
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { IObject2 } from '../interfaces';
|
|
2
|
+
export declare class SvgHelper {
|
|
3
|
+
svg: Element | undefined;
|
|
4
|
+
resources: IObject2[];
|
|
5
|
+
resourcesMap: Record<string, IObject2>;
|
|
6
|
+
_traverseMap: WeakMap<Element, boolean>;
|
|
7
|
+
private constructor();
|
|
8
|
+
private static _instance;
|
|
9
|
+
static get instance(): SvgHelper;
|
|
10
|
+
static parse(str: string): SvgHelper;
|
|
11
|
+
static init(svg: Element): SvgHelper;
|
|
12
|
+
initResources(): SvgHelper;
|
|
13
|
+
setTexture(el: Element, o: IObject2): void;
|
|
14
|
+
getResourceById(id?: string): IObject2 | undefined;
|
|
15
|
+
getResourcesMap(): Record<string, IObject2>;
|
|
16
|
+
getResources(): IObject2[];
|
|
17
|
+
trans2Shape(el?: Element, flipY?: boolean): IObject2 | undefined;
|
|
18
|
+
transG(el?: Element, flipY?: boolean): IObject2 | undefined;
|
|
19
|
+
transSymbol(el?: Element, flipY?: boolean): IObject2 | undefined;
|
|
20
|
+
transPath(el?: Element, flipY?: boolean): IObject2 | undefined;
|
|
21
|
+
transUse(el?: Element, flipY?: boolean): IObject2 | undefined;
|
|
22
|
+
transCircle(el?: Element, flipY?: boolean): IObject2 | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* test linked to asset
|
|
25
|
+
* 1、old version: split with ';', use first;
|
|
26
|
+
* 2、new version: use 'aid' attribute;
|
|
27
|
+
* 3、use 'assetId' + SPLITTER + LABEL_TAG save to elementsMap;
|
|
28
|
+
*/
|
|
29
|
+
transText(el?: Element, flipY?: boolean): IObject2 | undefined;
|
|
30
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as Vector2 } from '../math/vector2';
|
|
2
|
-
import { IGroup2, ILight, IPoint2,
|
|
2
|
+
import { IGroup2, ILight, IPoint2, IShape2, ITexture } from '../interfaces';
|
|
3
3
|
import { ITextureConfig, Texture } from '../textures/texture';
|
|
4
4
|
import { default as _ } from 'lodash';
|
|
5
5
|
/**
|
|
@@ -13,6 +13,7 @@ export declare class TextureHelper {
|
|
|
13
13
|
static precisionOptimizeLevels: number[];
|
|
14
14
|
static initialized: boolean;
|
|
15
15
|
static textureMaxSize: Vector2;
|
|
16
|
+
static DEBUG_DisplayCachedTexture: _.DebouncedFuncLeading<(width?: number, opacity?: number) => void>;
|
|
16
17
|
static destroy(): void;
|
|
17
18
|
static has(k: string): boolean;
|
|
18
19
|
static get(k: string | undefined, threshold?: number): ITexture | undefined;
|
|
@@ -21,12 +22,11 @@ export declare class TextureHelper {
|
|
|
21
22
|
static clear(): void;
|
|
22
23
|
static setTextureMaxSize(): void;
|
|
23
24
|
static getTextureMaxSize(): Vector2;
|
|
24
|
-
static getTextureByShape(obj:
|
|
25
|
-
static setPrecisionOptimizeTextures(key: string, obj:
|
|
26
|
-
static renderShapeTexture(obj:
|
|
27
|
-
static setByShape(key: string, obj:
|
|
28
|
-
static setShadowByShape(key: string, obj:
|
|
29
|
-
static setPointsByShape(key: string, obj:
|
|
30
|
-
static setWireframeByShape(key: string, obj:
|
|
31
|
-
static DEBUG_DisplayCachedTexture: _.DebouncedFuncLeading<(width?: number, opacity?: number) => void>;
|
|
25
|
+
static getTextureByShape(obj: IShape2 | IGroup2, originSize?: IPoint2, finalSize?: IPoint2, light?: ILight): Texture<ITextureConfig>;
|
|
26
|
+
static setPrecisionOptimizeTextures(key: string, obj: IShape2 | IGroup2, texture: ITexture, originSize?: IPoint2, light?: ILight): void;
|
|
27
|
+
static renderShapeTexture(obj: IShape2 | IGroup2, texture: ITexture, light?: ILight): void;
|
|
28
|
+
static setByShape(key: string, obj: IShape2 | IGroup2, originSize?: IPoint2, finalSize?: IPoint2): ITexture;
|
|
29
|
+
static setShadowByShape(key: string, obj: IShape2, light?: ILight): ITexture;
|
|
30
|
+
static setPointsByShape(key: string, obj: IShape2 | IGroup2): ITexture;
|
|
31
|
+
static setWireframeByShape(key: string, obj: IShape2): ITexture;
|
|
32
32
|
}
|