archgine 1.0.36 → 1.0.39
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/lib/applications/app-cvs.d.ts +16 -0
- package/lib/applications/app-offscreen.d.ts +27 -8
- package/lib/applications/application.d.ts +27 -10
- package/lib/controls/interactive-controls.d.ts +2 -2
- package/lib/controls/orbit-controller.d.ts +4 -3
- package/lib/controls/orbit-controls.d.ts +8 -8
- package/lib/core/camera2.d.ts +4 -16
- package/lib/core/monitor.d.ts +13 -13
- package/lib/core/object2.d.ts +5 -5
- package/lib/core/ope-view.d.ts +24 -0
- package/lib/core/view.d.ts +16 -9
- package/lib/environment.worker.js +4 -2
- package/lib/extras/adapter.d.ts +62 -0
- package/lib/extras/chef.d.ts +3 -9
- package/lib/extras/interfaces.d.ts +2 -0
- package/lib/extras/svg-app.d.ts +2 -17
- package/lib/extras/svg-chef.d.ts +4 -5
- package/lib/geometries/circle-geo2.d.ts +14 -0
- package/lib/geometries/geo2.d.ts +22 -8
- package/lib/geometries/polygon-geo2.d.ts +5 -0
- package/lib/geometries/polyline-geo2.d.ts +21 -0
- package/lib/helpers/axes-helper.d.ts +2 -3
- package/lib/helpers/axes-helper2.d.ts +19 -0
- package/lib/helpers/canvas-helper.d.ts +5 -5
- package/lib/helpers/geo-helper.d.ts +12 -0
- package/lib/helpers/mat-helper.d.ts +10 -0
- package/lib/helpers/merge-helper.d.ts +7 -0
- package/lib/index.d.ts +3 -1
- package/lib/index.mjs +7861 -6764
- package/lib/index.umd.js +31 -30
- package/lib/interfaces.d.ts +64 -120
- package/lib/materials/mat2.d.ts +2 -1
- package/lib/materials/text-mat2.d.ts +53 -0
- package/lib/math/box2.d.ts +1 -0
- package/lib/objects/shape2.d.ts +20 -7
- package/lib/renderer.worker.js +14066 -0
- package/lib/renderers/binding-states.d.ts +4 -4
- package/lib/renderers/buffer-renderer.d.ts +9 -3
- package/lib/renderers/cvs-renderer.d.ts +4 -2
- package/lib/renderers/render-lists.d.ts +4 -6
- package/lib/renderers/render-target.d.ts +2 -2
- package/lib/renderers/renderer.d.ts +1 -1
- package/lib/renders/render-target.d.ts +2 -2
- package/lib/scenes/loading-scene.d.ts +4 -5
- package/lib/{extras → scenes}/main-scene.d.ts +3 -3
- package/lib/scenes/scene.d.ts +0 -1
- package/lib/scenes/svg-scene.d.ts +3 -4
- package/lib/shapes2/arrow.d.ts +6 -0
- package/lib/shapes2/axes.d.ts +35 -0
- package/lib/shapes2/circle.d.ts +10 -0
- package/lib/shapes2/polygon.d.ts +9 -0
- package/lib/shapes2/text.d.ts +21 -0
- package/lib/textures/texture.d.ts +2 -2
- package/lib/utils/svg.d.ts +14 -0
- package/lib/workers/renderer.worker.d.ts +1 -0
- package/package.json +1 -1
- package/lib/geometries/path2.d.ts +0 -20
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Application, IApplicationConfig } from './application';
|
|
2
|
+
import { MainScene } from '../scenes/main-scene';
|
|
3
|
+
import { ITree } from '../interfaces';
|
|
4
|
+
import { Adapter } from '../extras/adapter';
|
|
5
|
+
export declare class AppCvs<Config extends IApplicationConfig> extends Application<Config> {
|
|
6
|
+
params: Config;
|
|
7
|
+
adapter: Adapter;
|
|
8
|
+
mainScene: MainScene<Config>;
|
|
9
|
+
constructor(config?: Config);
|
|
10
|
+
destroy(): void;
|
|
11
|
+
load(url?: string, layers?: string[]): Promise<void>;
|
|
12
|
+
getLayers(lv?: number): ITree[];
|
|
13
|
+
trans2MainScene(): void;
|
|
14
|
+
fullScreen(): void;
|
|
15
|
+
updateLayersVisibility(ids: string | string[], visible?: boolean): void;
|
|
16
|
+
}
|
|
@@ -1,14 +1,33 @@
|
|
|
1
|
-
import { default as EventDispatcher } from '../core/event-dispatcher';
|
|
2
1
|
import { IApplicationConfig } from './application';
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { OpeView } from '../core/ope-view';
|
|
3
|
+
import { APP_ENUM, ITree } from '../interfaces';
|
|
4
|
+
import { default as EventDispatcher } from '../core/event-dispatcher';
|
|
5
|
+
import { default as Box2 } from '../math/box2';
|
|
6
|
+
export declare class AppOffscreen<Config extends IApplicationConfig> extends EventDispatcher {
|
|
7
7
|
params: Config;
|
|
8
|
-
|
|
8
|
+
cvs: OffscreenCanvas;
|
|
9
|
+
worker: Worker;
|
|
10
|
+
view: OpeView<Config>;
|
|
11
|
+
boundingBox: Box2;
|
|
12
|
+
readonly workerMessageHandler: (e: MessageEvent) => void;
|
|
13
|
+
readonly cameraHandler: (e: MessageEvent) => void;
|
|
14
|
+
readonly runningHandler: (time: DOMHighResTimeStamp) => void;
|
|
9
15
|
constructor(config?: Config);
|
|
10
16
|
destroy(): void;
|
|
17
|
+
bindEvents(): void;
|
|
18
|
+
unbindEvents(): void;
|
|
19
|
+
handleWorkerMessage(e: MessageEvent): void;
|
|
20
|
+
handleCameraChanged(e: MessageEvent): void;
|
|
21
|
+
promiseWorkerResponse<T>(task: APP_ENUM, data: any): Promise<T>;
|
|
22
|
+
resize(): void;
|
|
23
|
+
load(url: string, layers?: string[]): Promise<void>;
|
|
24
|
+
getLayers(lv?: number): Promise<ITree[]>;
|
|
25
|
+
fullscreen(): Promise<void>;
|
|
26
|
+
saveCameraPosition(id?: string): void;
|
|
27
|
+
restoreCameraPosition(id?: string): void;
|
|
28
|
+
clearCameraPosition(id?: string): void;
|
|
29
|
+
updateLayersVisibility(ids: string | string[], visible?: boolean): void;
|
|
11
30
|
start(): void;
|
|
12
|
-
|
|
13
|
-
|
|
31
|
+
running(time: DOMHighResTimeStamp): void;
|
|
32
|
+
stop(): void;
|
|
14
33
|
}
|
|
@@ -1,17 +1,31 @@
|
|
|
1
|
+
import { IRenderer2, IRenderer2Config } from '../interfaces';
|
|
1
2
|
import { default as EventDispatcher } from '../core/event-dispatcher';
|
|
2
|
-
import { IRenderer2Config } from '../interfaces';
|
|
3
|
-
import { default as Scene } from '../scenes/scene';
|
|
4
3
|
import { default as Box2 } from '../math/box2';
|
|
5
|
-
import { default as Renderer2 } from '../renders/renderer2';
|
|
6
4
|
import { View } from '../core/view';
|
|
5
|
+
import { EffectComposer } from '../effects/effect-composer';
|
|
6
|
+
import { default as Scene } from '../scenes/scene';
|
|
7
7
|
export interface IApplicationConfig extends IRenderer2Config {
|
|
8
8
|
frameInterval?: number;
|
|
9
9
|
syncDelay?: number;
|
|
10
10
|
animateDuration?: number;
|
|
11
|
+
defaultFill?: string;
|
|
12
|
+
defaultStroke?: string;
|
|
13
|
+
infoFill?: string;
|
|
14
|
+
infoStroke?: string;
|
|
15
|
+
primaryFill?: string;
|
|
16
|
+
primaryStroke?: string;
|
|
17
|
+
successFill?: string;
|
|
18
|
+
successStroke?: string;
|
|
19
|
+
warningFill?: string;
|
|
20
|
+
warningStroke?: string;
|
|
21
|
+
dangerFill?: string;
|
|
22
|
+
dangerStroke?: string;
|
|
23
|
+
activeFill?: string;
|
|
24
|
+
activeStroke?: string;
|
|
11
25
|
}
|
|
12
26
|
/**
|
|
13
27
|
* @author Dio Zhu
|
|
14
|
-
* @since 2024.
|
|
28
|
+
* @since 2024.11.13
|
|
15
29
|
*/
|
|
16
30
|
export declare abstract class Application<Config extends IApplicationConfig> extends EventDispatcher {
|
|
17
31
|
name: string;
|
|
@@ -19,13 +33,15 @@ export declare abstract class Application<Config extends IApplicationConfig> ext
|
|
|
19
33
|
scenes: Scene[];
|
|
20
34
|
nextScenes: Scene[];
|
|
21
35
|
nextBoundingBox: Box2;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
36
|
+
loadingScene: Scene;
|
|
37
|
+
composer: EffectComposer;
|
|
38
|
+
renderer: IRenderer2;
|
|
39
|
+
view: View<any>;
|
|
40
|
+
readonly runningHandler: (time: DOMHighResTimeStamp) => void;
|
|
25
41
|
protected constructor(config?: Config);
|
|
42
|
+
get isLoadingScene(): boolean;
|
|
26
43
|
destroy(): void;
|
|
27
|
-
|
|
28
|
-
updateScenes(): void;
|
|
44
|
+
trans2LoadingScene(): void;
|
|
29
45
|
hasScene(scene: Scene): boolean;
|
|
30
46
|
pushScene(scene: Scene): void;
|
|
31
47
|
clearScenes(): void;
|
|
@@ -35,5 +51,6 @@ export declare abstract class Application<Config extends IApplicationConfig> ext
|
|
|
35
51
|
trans2Scenes(...scenes: Scene[]): void;
|
|
36
52
|
start(): void;
|
|
37
53
|
/** @description application's lifeCycle */
|
|
38
|
-
running(): void;
|
|
54
|
+
running(time: DOMHighResTimeStamp): void;
|
|
55
|
+
stop(): void;
|
|
39
56
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { OrbitControls } from './orbit-controls';
|
|
2
|
-
import { ICamera2
|
|
2
|
+
import { ICamera2 } from '../interfaces';
|
|
3
3
|
export declare class InteractiveControls extends OrbitControls {
|
|
4
4
|
name: string;
|
|
5
5
|
mouseButtons: any;
|
|
6
6
|
private readonly clickHandler;
|
|
7
|
-
constructor(camera: ICamera2, domElement:
|
|
7
|
+
constructor(camera: ICamera2, domElement: HTMLElement);
|
|
8
8
|
destroy(): void;
|
|
9
9
|
bindMapEvents(): void;
|
|
10
10
|
unbindMapEvents(): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ICamera2, IVector2 } from '../interfaces';
|
|
1
|
+
import { ICamera2, IOrbitController, IVector2 } from '../interfaces';
|
|
2
2
|
import { default as EventDispatcher } from '../core/event-dispatcher';
|
|
3
|
-
export declare class OrbitController extends EventDispatcher {
|
|
3
|
+
export declare class OrbitController extends EventDispatcher implements IOrbitController {
|
|
4
4
|
name: string;
|
|
5
5
|
isSvg: boolean;
|
|
6
6
|
dom: HTMLElement;
|
|
@@ -152,5 +152,6 @@ export declare enum EventsEnum {
|
|
|
152
152
|
PINCH_OUT = "pinchout",
|
|
153
153
|
SWIPE = "swipe",
|
|
154
154
|
CHANGE_START = "change_start",
|
|
155
|
-
CHANGE_END = "change_end"
|
|
155
|
+
CHANGE_END = "change_end",
|
|
156
|
+
CAMERA_CHANGED = "cameraChanged"
|
|
156
157
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as Vector2 } from '../math/vector2';
|
|
2
2
|
import { default as EventDispatcher } from '../core/event-dispatcher';
|
|
3
|
-
import { ICamera2,
|
|
3
|
+
import { ICamera2, IMatrix3, IVector2 } from '../interfaces';
|
|
4
4
|
interface IScene {
|
|
5
5
|
}
|
|
6
6
|
export interface IOrbitControlsConfig {
|
|
@@ -22,7 +22,7 @@ export interface IOrbitControlsConfig {
|
|
|
22
22
|
export declare class OrbitControls extends EventDispatcher {
|
|
23
23
|
name: string;
|
|
24
24
|
camera: ICamera2;
|
|
25
|
-
domElement:
|
|
25
|
+
domElement: HTMLElement;
|
|
26
26
|
domOffset: Vector2;
|
|
27
27
|
enableNegateControl: boolean;
|
|
28
28
|
focus: Vector2;
|
|
@@ -44,20 +44,22 @@ export declare class OrbitControls extends EventDispatcher {
|
|
|
44
44
|
ONE: TouchEnum;
|
|
45
45
|
TWO: TouchEnum;
|
|
46
46
|
};
|
|
47
|
-
private _lastPosition;
|
|
48
47
|
target0: IVector2;
|
|
49
48
|
position0: IVector2;
|
|
50
49
|
scene: IScene | null;
|
|
51
50
|
enabled: boolean;
|
|
52
51
|
state: number;
|
|
53
52
|
EPS: number;
|
|
53
|
+
scaled: number;
|
|
54
|
+
rotateTheta: number;
|
|
55
|
+
enableDamping: boolean;
|
|
56
|
+
dampingFactor: number;
|
|
57
|
+
private _lastPosition;
|
|
54
58
|
private pointers;
|
|
55
59
|
private pointerPositions;
|
|
56
|
-
scaled: number;
|
|
57
60
|
private rotateStart;
|
|
58
61
|
private rotateEnd;
|
|
59
62
|
private rotateDelta;
|
|
60
|
-
rotateTheta: number;
|
|
61
63
|
private panStart;
|
|
62
64
|
private panEnd;
|
|
63
65
|
private panDelta;
|
|
@@ -66,15 +68,13 @@ export declare class OrbitControls extends EventDispatcher {
|
|
|
66
68
|
private dollyEnd;
|
|
67
69
|
private dollyDelta;
|
|
68
70
|
private dollyOffset;
|
|
69
|
-
enableDamping: boolean;
|
|
70
|
-
dampingFactor: number;
|
|
71
71
|
private readonly contextMenuHandler;
|
|
72
72
|
private readonly pointerDownHandler;
|
|
73
73
|
private readonly pointerUpHandler;
|
|
74
74
|
private readonly pointerCancelHandler;
|
|
75
75
|
private readonly pointerMoveHandler;
|
|
76
76
|
private readonly wheelHandler;
|
|
77
|
-
constructor(camera: ICamera2, domElement:
|
|
77
|
+
constructor(camera: ICamera2, domElement: HTMLElement);
|
|
78
78
|
destroy(): void;
|
|
79
79
|
update(): void;
|
|
80
80
|
pan(deltaX: number, deltaY: number): void;
|
package/lib/core/camera2.d.ts
CHANGED
|
@@ -1,28 +1,15 @@
|
|
|
1
1
|
import { default as Vector2 } from '../math/vector2';
|
|
2
|
-
import { ICamera2, ICamera2Position, IObject2, IVector2 } from '../interfaces';
|
|
2
|
+
import { ICamera2, ICamera2Config, ICamera2Position, IObject2, IPoint2, IVector2 } from '../interfaces';
|
|
3
3
|
import { default as Matrix3 } from '../math/matrix3';
|
|
4
4
|
import { Object2 } from './object2';
|
|
5
5
|
import { default as Box2 } from '../math/box2';
|
|
6
|
-
export interface ICamera2Config {
|
|
7
|
-
width?: number;
|
|
8
|
-
height?: number;
|
|
9
|
-
aspect?: number;
|
|
10
|
-
left?: number;
|
|
11
|
-
right?: number;
|
|
12
|
-
top?: number;
|
|
13
|
-
bottom?: number;
|
|
14
|
-
eye?: number[];
|
|
15
|
-
up?: number[];
|
|
16
|
-
helperEnable?: boolean;
|
|
17
|
-
flipY?: boolean;
|
|
18
|
-
}
|
|
19
6
|
interface IView {
|
|
20
7
|
enabled: boolean;
|
|
21
8
|
width: number;
|
|
22
9
|
height: number;
|
|
23
10
|
offset: IVector2;
|
|
24
11
|
}
|
|
25
|
-
export default class Camera2<Config extends ICamera2Config
|
|
12
|
+
export default class Camera2<Config extends ICamera2Config> extends Object2 implements ICamera2 {
|
|
26
13
|
readonly isCamera: boolean;
|
|
27
14
|
type: string;
|
|
28
15
|
name: string;
|
|
@@ -47,6 +34,7 @@ export default class Camera2<Config extends ICamera2Config = ICamera2Config> ext
|
|
|
47
34
|
get pixelWidth(): number;
|
|
48
35
|
set(l?: number, r?: number, t?: number, b?: number): void;
|
|
49
36
|
setByBox(box: Box2): void;
|
|
37
|
+
setTRS(t?: IPoint2, r?: number, s?: number): void;
|
|
50
38
|
resize(): void;
|
|
51
39
|
setSize(w: number, h: number): void;
|
|
52
40
|
getWorldDirection(target: Vector2): Vector2;
|
|
@@ -61,7 +49,7 @@ export default class Camera2<Config extends ICamera2Config = ICamera2Config> ext
|
|
|
61
49
|
toJSON(): any;
|
|
62
50
|
fromJSON(o: any): void;
|
|
63
51
|
clone(): any;
|
|
64
|
-
copy(source: Camera2
|
|
52
|
+
copy(source: Camera2<Config>, recursive?: boolean): IObject2;
|
|
65
53
|
}
|
|
66
54
|
export declare enum CAMERA_ENUM {
|
|
67
55
|
UPDATE = "update"
|
package/lib/core/monitor.d.ts
CHANGED
|
@@ -9,6 +9,13 @@ interface IMonitorRecord {
|
|
|
9
9
|
}
|
|
10
10
|
export declare class Monitor {
|
|
11
11
|
static idCounter: number;
|
|
12
|
+
static children: Monitor[];
|
|
13
|
+
static isRunning: boolean;
|
|
14
|
+
static actived: boolean;
|
|
15
|
+
static duration: number;
|
|
16
|
+
static lastTime: number;
|
|
17
|
+
static messages: IMonitorRecord[];
|
|
18
|
+
static maxLetters: number;
|
|
12
19
|
id: number;
|
|
13
20
|
timers: Map<string, number[]>;
|
|
14
21
|
timersDuration: Map<string, number>;
|
|
@@ -16,6 +23,12 @@ export declare class Monitor {
|
|
|
16
23
|
countersAmount: Map<string, number>;
|
|
17
24
|
out: IMonitorRecord[];
|
|
18
25
|
constructor();
|
|
26
|
+
static active(duration?: number): void;
|
|
27
|
+
static add(o: Monitor): void;
|
|
28
|
+
static remove(o: Monitor): void;
|
|
29
|
+
static handleStart(): void;
|
|
30
|
+
static runLoop(): void;
|
|
31
|
+
static runFrames(): void;
|
|
19
32
|
destroy(): void;
|
|
20
33
|
addTimer(key: string, t?: number, duration?: number): void;
|
|
21
34
|
addTimerDuration(key: string, duration: number): void;
|
|
@@ -34,18 +47,5 @@ export declare class Monitor {
|
|
|
34
47
|
stdDev(durations: number[], avg: number): number;
|
|
35
48
|
fd(d: number): string;
|
|
36
49
|
fx(d: number, l?: number): number;
|
|
37
|
-
static children: Monitor[];
|
|
38
|
-
static isRunning: boolean;
|
|
39
|
-
static actived: boolean;
|
|
40
|
-
static duration: number;
|
|
41
|
-
static lastTime: number;
|
|
42
|
-
static messages: IMonitorRecord[];
|
|
43
|
-
static maxLetters: number;
|
|
44
|
-
static active(duration?: number): void;
|
|
45
|
-
static add(o: Monitor): void;
|
|
46
|
-
static remove(o: Monitor): void;
|
|
47
|
-
static handleStart(): void;
|
|
48
|
-
static runLoop(): void;
|
|
49
|
-
static runFrames(): void;
|
|
50
50
|
}
|
|
51
51
|
export {};
|
package/lib/core/object2.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as EventDispatcher } from './event-dispatcher';
|
|
2
|
-
import { IAnimationClip, IBox2, ICamera2, IObject2, IPoint2, IVector2 } from '../interfaces';
|
|
2
|
+
import { IAnimationClip, IBox2, ICamera2, IMatrix3, IObject2, IPoint2, IVector2 } from '../interfaces';
|
|
3
3
|
import { default as Vector2 } from '../math/vector2';
|
|
4
4
|
import { default as Matrix3 } from '../math/matrix3';
|
|
5
5
|
import { default as Box2 } from '../math/box2';
|
|
@@ -16,7 +16,6 @@ export declare class Object2 extends EventDispatcher implements IObject2 {
|
|
|
16
16
|
name: string;
|
|
17
17
|
type: string;
|
|
18
18
|
featureKey: string;
|
|
19
|
-
_version: number;
|
|
20
19
|
parent: IObject2 | undefined;
|
|
21
20
|
children: IObject2[];
|
|
22
21
|
up: Vector2;
|
|
@@ -49,13 +48,14 @@ export declare class Object2 extends EventDispatcher implements IObject2 {
|
|
|
49
48
|
animations: IAnimationClip[];
|
|
50
49
|
finalSize?: IPoint2;
|
|
51
50
|
userData: any;
|
|
52
|
-
[prop: string]: any;
|
|
53
51
|
DefaultUp: Vector2;
|
|
52
|
+
[prop: string]: any;
|
|
54
53
|
private _autoSort;
|
|
55
54
|
constructor(config?: IObject2Config);
|
|
56
|
-
|
|
55
|
+
_version: number;
|
|
57
56
|
get version(): number;
|
|
58
57
|
set version(v: number);
|
|
58
|
+
set needsUpdate(v: boolean);
|
|
59
59
|
destroy(): void;
|
|
60
60
|
setPosition(v: IVector2): this;
|
|
61
61
|
translate(x: number, y: number): void;
|
|
@@ -67,7 +67,7 @@ export declare class Object2 extends EventDispatcher implements IObject2 {
|
|
|
67
67
|
localToWorld(v: Vector2): Vector2;
|
|
68
68
|
worldToLocal(v: Vector2): Vector2;
|
|
69
69
|
lookAt(v: Vector2): void;
|
|
70
|
-
applyMatrix3(matrix:
|
|
70
|
+
applyMatrix3(matrix: IMatrix3): void;
|
|
71
71
|
updateMatrix(): void;
|
|
72
72
|
updateMatrixWorld(force?: boolean): void;
|
|
73
73
|
updateWorldMatrix(updateParents?: boolean, updateChildren?: boolean): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ICamera2, ICamera2Config, ICanvas, IRenderer2Config } from '../interfaces';
|
|
2
|
+
import { IOrbitControlsConfig } from '../controls/orbit-controls';
|
|
3
|
+
import { OrbitController } from '../controls/orbit-controller';
|
|
4
|
+
import { IAxesHelperConfig } from '../helpers/axes-helper';
|
|
5
|
+
import { View } from './view';
|
|
6
|
+
export interface IViewConfig extends IRenderer2Config {
|
|
7
|
+
name?: string;
|
|
8
|
+
cvs?: ICanvas;
|
|
9
|
+
camera?: ICamera2Config;
|
|
10
|
+
controls?: IOrbitControlsConfig;
|
|
11
|
+
axesHelper?: IAxesHelperConfig;
|
|
12
|
+
alignStageCenter?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @author Dio Zhu 2024.8.22
|
|
16
|
+
*/
|
|
17
|
+
export declare class OpeView<Config extends IViewConfig> extends View<Config> {
|
|
18
|
+
name: string;
|
|
19
|
+
controller: OrbitController;
|
|
20
|
+
constructor(config?: Config);
|
|
21
|
+
destroy(): void;
|
|
22
|
+
initController(camera?: ICamera2): void;
|
|
23
|
+
handleCameraChanged(e: any): void;
|
|
24
|
+
}
|
package/lib/core/view.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { IBox2, ICamera2, ICanvas, IRenderer2Config, IView } from '../interfaces';
|
|
1
|
+
import { IBox2, ICamera2, ICamera2Config, ICamera2Position, ICanvas, IRenderer2Config, IView } from '../interfaces';
|
|
2
2
|
import { IOrbitControlsConfig } from '../controls/orbit-controls';
|
|
3
|
-
import { ICamera2Config } from './camera2';
|
|
4
3
|
import { default as Scene } from '../scenes/scene';
|
|
5
4
|
import { OrbitController } from '../controls/orbit-controller';
|
|
6
5
|
import { default as Box2 } from '../math/box2';
|
|
7
6
|
import { IAxesHelperConfig } from '../helpers/axes-helper';
|
|
7
|
+
import { Tween } from '@tweenjs/tween.js';
|
|
8
8
|
export interface IViewConfig extends IRenderer2Config {
|
|
9
9
|
name?: string;
|
|
10
10
|
cvs?: ICanvas;
|
|
@@ -12,6 +12,7 @@ export interface IViewConfig extends IRenderer2Config {
|
|
|
12
12
|
controls?: IOrbitControlsConfig;
|
|
13
13
|
axesHelper?: IAxesHelperConfig;
|
|
14
14
|
alignStageCenter?: boolean;
|
|
15
|
+
animateDuration?: number;
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
18
|
* @author Dio Zhu 2024.8.22
|
|
@@ -20,23 +21,29 @@ export declare class View<Config extends IViewConfig> implements IView {
|
|
|
20
21
|
name: string;
|
|
21
22
|
params: Config;
|
|
22
23
|
visible: boolean;
|
|
23
|
-
container: HTMLElement;
|
|
24
24
|
cvs: ICanvas | undefined;
|
|
25
25
|
scene: Scene | undefined;
|
|
26
26
|
scenes: Scene[];
|
|
27
|
-
camera: ICamera2
|
|
27
|
+
camera: ICamera2;
|
|
28
28
|
controller?: OrbitController;
|
|
29
|
+
tween?: Tween;
|
|
30
|
+
animateDuration: number;
|
|
29
31
|
constructor(config?: Config);
|
|
30
32
|
destroy(): void;
|
|
31
|
-
|
|
33
|
+
bindScene(scene: Scene): void;
|
|
34
|
+
saveCameraPosition(id?: string): void;
|
|
35
|
+
clearCameraPosition(id?: string): void;
|
|
36
|
+
restoreCameraPosition(id?: string): void;
|
|
37
|
+
fullscreen(padding?: number, animate?: boolean): void;
|
|
32
38
|
handleCameraChanged(e: any): void;
|
|
33
39
|
reset(): void;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
40
|
+
resetCameraByBoundingBox(box: IBox2, animate?: boolean): Promise<void>;
|
|
41
|
+
animateCamera(from: ICamera2Position, to: ICamera2Position): Promise<void>;
|
|
42
|
+
computeBoundingBox(scenes: Scene[], target?: Box2): Box2;
|
|
37
43
|
expandScenesBoundingBox(scenes: Scene[], box?: Box2): void;
|
|
38
44
|
/**
|
|
39
45
|
* @see Application.running
|
|
40
46
|
*/
|
|
41
|
-
update(): void;
|
|
47
|
+
update(time?: DOMHighResTimeStamp): void;
|
|
42
48
|
}
|
|
49
|
+
export declare const CAMERA_SESSION_KEY = "camera_position_";
|
|
@@ -11,6 +11,8 @@ var Pe = {
|
|
|
11
11
|
fps: 60,
|
|
12
12
|
syncDelay: 800,
|
|
13
13
|
animateDuration: 600,
|
|
14
|
+
mergeRendering: !1,
|
|
15
|
+
// 合并渲染
|
|
14
16
|
usedCache: !1,
|
|
15
17
|
showPoints: !1,
|
|
16
18
|
wireframe: !1,
|
|
@@ -3995,7 +3997,7 @@ Fu.__DOMHandler = Eu;
|
|
|
3995
3997
|
Fu.normalizeLineEndings = Le;
|
|
3996
3998
|
Fu.DOMParser = Ie;
|
|
3997
3999
|
var gr = Fu.DOMParser;
|
|
3998
|
-
const Er = "1.0.
|
|
4000
|
+
const Er = "1.0.39";
|
|
3999
4001
|
function vr() {
|
|
4000
4002
|
return typeof window < "u" && ({}.toString.call(window) === "[object Window]" || {}.toString.call(window) === "[object global]");
|
|
4001
4003
|
}
|
|
@@ -4432,7 +4434,7 @@ function Tr(u) {
|
|
|
4432
4434
|
`, postMessage({ cmd: "echo", data: { msg: e } });
|
|
4433
4435
|
}
|
|
4434
4436
|
function Nr() {
|
|
4435
|
-
console.log("- DOMParser: ", !!P.window.DOMParser);
|
|
4437
|
+
console.log("- DOMParser: ", !!DOMParser, !!P.window.DOMParser);
|
|
4436
4438
|
const u = new P.window.DOMParser().parseFromString(
|
|
4437
4439
|
`<xml xmlns="a" xmlns:c="./lite">
|
|
4438
4440
|
<child>test</child>
|
package/lib/extras/adapter.d.ts
CHANGED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { default as EventDispatcher } from '../core/event-dispatcher';
|
|
2
|
+
import { default as Box2 } from '../math/box2';
|
|
3
|
+
import { IObject2, ITree } from '../interfaces';
|
|
4
|
+
import { IApplicationConfig } from '../applications/application';
|
|
5
|
+
export declare class Adapter extends EventDispatcher {
|
|
6
|
+
name: string;
|
|
7
|
+
params: IApplicationConfig;
|
|
8
|
+
boundingBox: Box2;
|
|
9
|
+
resources: Record<string, IObject2[]>;
|
|
10
|
+
_resourcesMap: Record<string, IObject2>;
|
|
11
|
+
_resourcesTree: ITree[];
|
|
12
|
+
private _svg?;
|
|
13
|
+
private _svgRoot?;
|
|
14
|
+
private _viewBox;
|
|
15
|
+
private _elementsMap;
|
|
16
|
+
constructor(config?: IApplicationConfig);
|
|
17
|
+
destroy(): void;
|
|
18
|
+
clear(): void;
|
|
19
|
+
load(url: string, layers?: string[]): Promise<void>;
|
|
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
|
+
initResourcesTree(): void;
|
|
34
|
+
initResource(id: string): void;
|
|
35
|
+
getResources(): IObject2[] | undefined;
|
|
36
|
+
getLayers(lv?: number): ITree[];
|
|
37
|
+
getElementById(id?: string): Element | undefined;
|
|
38
|
+
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
|
+
getAssetLabelId(assetId: string): string;
|
|
53
|
+
getResourceById(id?: string): IObject2 | undefined;
|
|
54
|
+
getResourceTreeById(t: ITree | ITree[], id?: string): ITree | undefined;
|
|
55
|
+
updateLayersVisibility(ids: string | string[], visible?: boolean): void;
|
|
56
|
+
_updateAllLayersVisibility(visible?: boolean): void;
|
|
57
|
+
_updateLayersVisibility(t: ITree, visible?: boolean): void;
|
|
58
|
+
}
|
|
59
|
+
export declare enum AdapterEnum {
|
|
60
|
+
INITIALIZATION_START = "INITIALIZATION_START",
|
|
61
|
+
INITIALIZATION_COMPLETE = "INITIALIZATION_COMPLETE"
|
|
62
|
+
}
|
package/lib/extras/chef.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IElement, ISvgElement } from '../svg/interfaces';
|
|
2
|
-
import { IGroup2, IShape } from '../interfaces';
|
|
2
|
+
import { IGroup2, IShape, ITree } from '../interfaces';
|
|
3
3
|
import { default as Box2 } from '../math/box2';
|
|
4
4
|
export declare class Chef {
|
|
5
5
|
svg?: HTMLElement;
|
|
@@ -15,15 +15,9 @@ export declare class Chef {
|
|
|
15
15
|
bind(data: ISvgElement): this;
|
|
16
16
|
splitDefs(): this;
|
|
17
17
|
splitLayers(ids?: string[], out?: (IGroup2 | IShape)[]): this;
|
|
18
|
-
getLayers(lv?: number):
|
|
19
|
-
_getLayer(el: IElement, lv?: number, lvi?: number, out?:
|
|
18
|
+
getLayers(lv?: number): ITree[];
|
|
19
|
+
_getLayer(el: IElement, lv?: number, lvi?: number, out?: ITree[]): ITree[];
|
|
20
20
|
getById(id: string): IGroup2 | IShape | undefined;
|
|
21
21
|
getByIds(ids: string[]): (IGroup2 | IShape)[];
|
|
22
22
|
trans2RenderObject(el: IElement): IGroup2 | IShape | undefined;
|
|
23
23
|
}
|
|
24
|
-
export type TLayer = {
|
|
25
|
-
id: string;
|
|
26
|
-
label: string;
|
|
27
|
-
selected?: boolean;
|
|
28
|
-
children?: TLayer[];
|
|
29
|
-
};
|
package/lib/extras/svg-app.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { default as EventDispatcher } from '../core/event-dispatcher';
|
|
2
2
|
import { IApplicationConfig } from '../applications/application';
|
|
3
|
-
import { TLayer } from './chef';
|
|
4
3
|
import { default as SvgRenderer } from '../renders/svg-renderer';
|
|
5
4
|
import { IApp, IDummyVo } from './interfaces';
|
|
6
5
|
import { default as Scene } from '../scenes/scene';
|
|
@@ -16,20 +15,6 @@ export interface ISvgAppConfig extends IApplicationConfig {
|
|
|
16
15
|
selectEnable?: boolean;
|
|
17
16
|
multiSelectEnable?: boolean;
|
|
18
17
|
socialDistanceEnable?: boolean;
|
|
19
|
-
defaultFill?: string;
|
|
20
|
-
defaultStroke?: string;
|
|
21
|
-
infoFill?: string;
|
|
22
|
-
infoStroke?: string;
|
|
23
|
-
primaryFill?: string;
|
|
24
|
-
primaryStroke?: string;
|
|
25
|
-
successFill?: string;
|
|
26
|
-
successStroke?: string;
|
|
27
|
-
warningFill?: string;
|
|
28
|
-
warningStroke?: string;
|
|
29
|
-
dangerFill?: string;
|
|
30
|
-
dangerStroke?: string;
|
|
31
|
-
activeFill?: string;
|
|
32
|
-
activeStroke?: string;
|
|
33
18
|
}
|
|
34
19
|
export declare class SvgApp<Config extends ISvgAppConfig> extends EventDispatcher implements IApp {
|
|
35
20
|
name: string;
|
|
@@ -59,9 +44,9 @@ export declare class SvgApp<Config extends ISvgAppConfig> extends EventDispatche
|
|
|
59
44
|
start(): void;
|
|
60
45
|
/** @description application's lifeCycle */
|
|
61
46
|
running(time: DOMHighResTimeStamp): void;
|
|
62
|
-
load(url: string, layers?: string[], lv?: number, skeletons?: string[]): Promise<
|
|
47
|
+
load(url: string, layers?: string[], lv?: number, skeletons?: string[]): Promise<ITree[]>;
|
|
63
48
|
setSkeletons(skeletons: string[]): void;
|
|
64
|
-
getLayers(lv?: number):
|
|
49
|
+
getLayers(lv?: number): ITree[] | undefined;
|
|
65
50
|
updateLayersVisibility(ids: string[], visible?: boolean): void;
|
|
66
51
|
selectByIds(ids: string | string[]): void;
|
|
67
52
|
getSelectedIds(): string[] | undefined;
|
package/lib/extras/svg-chef.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { ISvgElement } from '../svg/interfaces';
|
|
2
2
|
import { default as Box2 } from '../math/box2';
|
|
3
3
|
import { default as Vector2 } from '../math/vector2';
|
|
4
|
-
import { TLayer } from './chef';
|
|
5
4
|
import { ITree, IVector2 } from '../interfaces';
|
|
6
5
|
export declare class SvgChef {
|
|
7
6
|
svg?: HTMLElement;
|
|
8
7
|
offset: Vector2;
|
|
9
8
|
svgRoot?: Element;
|
|
10
|
-
layers:
|
|
9
|
+
layers: ITree[];
|
|
11
10
|
elementsMap: Record<string, Element>;
|
|
12
11
|
boundingBoxMap: Record<string, Box2>;
|
|
13
12
|
boundingBox: Box2;
|
|
@@ -17,8 +16,8 @@ export declare class SvgChef {
|
|
|
17
16
|
private readonly _exceptIds;
|
|
18
17
|
private _lvi;
|
|
19
18
|
bindSvg(data: HTMLElement): this;
|
|
20
|
-
getLayers(lv?: number):
|
|
21
|
-
_getSvgLayer(el: HTMLElement, lv?: number, lvi?: number, out?:
|
|
19
|
+
getLayers(lv?: number): ITree[];
|
|
20
|
+
_getSvgLayer(el: HTMLElement, lv?: number, lvi?: number, out?: ITree[]): ITree[];
|
|
22
21
|
getElementsMap(el: Element, out?: Record<string, Element>): Record<string, Element>;
|
|
23
22
|
computeBoundingBoxMap(): Record<string, Box2>;
|
|
24
23
|
updateLayersVisibility(ids: string[], visible?: boolean): void;
|
|
@@ -31,7 +30,7 @@ export declare class SvgChef {
|
|
|
31
30
|
findSkeletonByPath(out?: Element[]): Element[];
|
|
32
31
|
setTextInChildren2(o: Element, v: string): void;
|
|
33
32
|
traverseSvg(o: Element, cb: Function): void;
|
|
34
|
-
traverseSvgTLayers(o:
|
|
33
|
+
traverseSvgTLayers(o: ITree | ITree[], cb: Function): void;
|
|
35
34
|
getLabelElementsByType(assetType: string, out?: Record<string, Element>): Record<string, Element>;
|
|
36
35
|
getLabelElementById(id: string, assetType?: string): Element | undefined;
|
|
37
36
|
setLabelsById(id: string, labels?: string[], assetType?: string): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Geo2, IGeo2Config } from './geo2';
|
|
2
|
+
export interface ICircleGeo2 extends IGeo2Config {
|
|
3
|
+
radius?: number;
|
|
4
|
+
start?: number;
|
|
5
|
+
end?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare class CircleGeo2<Config extends ICircleGeo2> extends Geo2<Config> {
|
|
8
|
+
readonly isCircle: boolean;
|
|
9
|
+
radius: number;
|
|
10
|
+
start: number;
|
|
11
|
+
end: number;
|
|
12
|
+
constructor(config?: Config);
|
|
13
|
+
recomputePath(): this;
|
|
14
|
+
}
|