@vvfx/sdk 0.1.19-alpha.37 → 0.1.19-alpha.38
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/LICENSE +22 -0
- package/dist/index.js +87037 -14
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +87141 -0
- package/dist/index.mjs.map +1 -0
- package/dist/src/config.d.ts +855 -0
- package/dist/src/exporter/config.d.ts +18 -0
- package/dist/src/exporter/const.d.ts +71 -0
- package/dist/src/exporter/export-media.d.ts +68 -0
- package/dist/src/exporter/exporter.d.ts +22 -0
- package/dist/src/exporter/index.d.ts +2 -0
- package/dist/src/exporter/types.d.ts +194 -0
- package/dist/src/exporter/utils.d.ts +22 -0
- package/dist/src/exporter/wav-audio.d.ts +27 -0
- package/dist/src/gesture-handler/gizmo/adsorption-gizmo.d.ts +68 -0
- package/dist/src/gesture-handler/gizmo/control-gizmo.d.ts +67 -0
- package/dist/src/gesture-handler/gizmo/gizmo.d.ts +59 -0
- package/dist/src/gesture-handler/gizmo/icon-gizmo.d.ts +44 -0
- package/dist/src/gesture-handler/gizmo/index.d.ts +6 -0
- package/dist/src/gesture-handler/gizmo/item-create-gizmo.d.ts +43 -0
- package/dist/src/gesture-handler/gizmo/loading-gizmo.d.ts +48 -0
- package/dist/src/gesture-handler/gizmo/mask-gizmo.d.ts +113 -0
- package/dist/src/gesture-handler/gizmo/picture-cut-gizmo.d.ts +94 -0
- package/dist/src/gesture-handler/gizmo/picture-expand-gizmo.d.ts +57 -0
- package/dist/src/gesture-handler/gizmo/preference-gizmo.d.ts +32 -0
- package/dist/src/gesture-handler/gizmo/selector-gizmo.d.ts +101 -0
- package/dist/src/gesture-handler/gizmo/sprite-text-edit-gizmo.d.ts +36 -0
- package/dist/src/gesture-handler/gizmo/text-gizmo.d.ts +128 -0
- package/dist/src/gesture-handler/gizmo/transform-gizmo.d.ts +233 -0
- package/dist/src/gesture-handler/gizmo/type.d.ts +402 -0
- package/dist/src/gesture-handler/index.d.ts +3 -0
- package/dist/src/gesture-handler/src/gesture-handler.d.ts +143 -0
- package/dist/src/gesture-handler/src/icons.d.ts +7 -0
- package/dist/src/gesture-handler/utils.d.ts +2 -0
- package/dist/src/html-overlay/document-runtime.d.ts +3 -0
- package/dist/src/html-overlay/document-transform.d.ts +7 -0
- package/dist/src/html-overlay/index.d.ts +1 -0
- package/dist/src/html-overlay/manager.d.ts +43 -0
- package/dist/src/html-overlay/mime-utils.d.ts +2 -0
- package/dist/src/html-overlay/path-utils.d.ts +8 -0
- package/dist/src/index.d.ts +14 -0
- package/dist/src/math/box2.d.ts +166 -0
- package/dist/src/math/circle.d.ts +82 -0
- package/dist/src/math/euler.d.ts +20 -0
- package/dist/src/math/index.d.ts +13 -0
- package/dist/src/math/line2.d.ts +93 -0
- package/dist/src/math/line3.d.ts +17 -0
- package/dist/src/math/matrix4.d.ts +28 -0
- package/dist/src/math/plane.d.ts +14 -0
- package/dist/src/math/quaternion.d.ts +3 -0
- package/dist/src/math/ray-caster.d.ts +10 -0
- package/dist/src/math/ray.d.ts +18 -0
- package/dist/src/math/type.d.ts +32 -0
- package/dist/src/math/utils.d.ts +19 -0
- package/dist/src/math/vector2.d.ts +30 -0
- package/dist/src/math/vector3.d.ts +29 -0
- package/dist/src/screen-shot/index.d.ts +1 -0
- package/dist/src/screen-shot/screen-shot.d.ts +35 -0
- package/dist/src/sdk-item/base-item.d.ts +126 -0
- package/dist/src/sdk-item/card-item.d.ts +57 -0
- package/dist/src/sdk-item/effects-item.d.ts +70 -0
- package/dist/src/sdk-item/frame-item.d.ts +112 -0
- package/dist/src/sdk-item/generator-item.d.ts +86 -0
- package/dist/src/sdk-item/group-item.d.ts +57 -0
- package/dist/src/sdk-item/index.d.ts +36 -0
- package/dist/src/sdk-item/sprite-item.d.ts +67 -0
- package/dist/src/sdk-item/text-item.d.ts +107 -0
- package/dist/src/sdk-item/types.d.ts +153 -0
- package/dist/src/sdk-item/video-item.d.ts +87 -0
- package/dist/src/sdk.d.ts +589 -0
- package/dist/src/service/UndoRedo.d.ts +48 -0
- package/dist/src/shared/index.d.ts +1 -0
- package/dist/src/shared/player.d.ts +9 -0
- package/dist/src/size-adapte/index.d.ts +1 -0
- package/dist/src/size-adapte/size-adapt.d.ts +28 -0
- package/dist/src/types.d.ts +1235 -0
- package/dist/src/utils/background-manager.d.ts +72 -0
- package/dist/src/utils/common-utils.d.ts +28 -0
- package/dist/src/utils/index.d.ts +8 -0
- package/dist/src/utils/interaction-utils.d.ts +60 -0
- package/dist/src/utils/json-data-utils.d.ts +165 -0
- package/dist/src/utils/layout-utils.d.ts +219 -0
- package/dist/src/utils/page-data-utils.d.ts +370 -0
- package/dist/src/utils/player-data-utils.d.ts +11 -0
- package/dist/src/utils/types.d.ts +114 -0
- package/dist/src/wireframe/common/box.d.ts +1 -0
- package/dist/src/wireframe/common/dashed-line.d.ts +1 -0
- package/dist/src/wireframe/common/line.d.ts +1 -0
- package/dist/src/wireframe/common/pixi-ext.d.ts +11 -0
- package/dist/src/wireframe/common/pixi.d.ts +18 -0
- package/dist/src/wireframe/index.d.ts +4 -0
- package/package.json +41 -23
- package/dist/index.cjs +0 -14
- package/dist/index.d.cts +0 -4891
- package/dist/index.d.ts +0 -4891
- package/dist/index.global.js +0 -333
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { Application } from '@pixi/app';
|
|
2
|
+
import { ControlGizmo, GestureCursorResult, GestureHandlerInteractType, ItemCreateType, SelectorGizmo, SpriteTextInitParam, TransformGizmo, type Gizmo } from '../gizmo';
|
|
3
|
+
import type { PageDataUtils } from '../../utils/page-data-utils';
|
|
4
|
+
import { PreferenceGizmo } from '../gizmo/preference-gizmo';
|
|
5
|
+
import { PictureCutGizmo } from '../gizmo/picture-cut-gizmo';
|
|
6
|
+
import { Box2, Vector2 } from '../../math';
|
|
7
|
+
import { EventEmitter } from '../../shared';
|
|
8
|
+
import { SDKEvents } from '../../sdk';
|
|
9
|
+
import { TextGizmo } from '../gizmo/text-gizmo';
|
|
10
|
+
import { MaskGizmo } from '../gizmo/mask-gizmo';
|
|
11
|
+
import { LoadingGizmo, LoadingGizmoTip } from '../gizmo/loading-gizmo';
|
|
12
|
+
import { MaskGizmoConfig } from '../../config';
|
|
13
|
+
import { PictureExpandGizmo } from '../gizmo/picture-expand-gizmo';
|
|
14
|
+
import { SpriteTextEditGizmo } from '../gizmo/sprite-text-edit-gizmo';
|
|
15
|
+
import { IconGizmo } from '../gizmo/icon-gizmo';
|
|
16
|
+
import { ItemCreateGizmo } from '../gizmo/item-create-gizmo';
|
|
17
|
+
export declare class GestureHandler {
|
|
18
|
+
wireframeApplication: Application;
|
|
19
|
+
gizmos: Gizmo[];
|
|
20
|
+
activeGizmo?: Gizmo;
|
|
21
|
+
selectorGizmo?: SelectorGizmo;
|
|
22
|
+
transformGizmo?: TransformGizmo;
|
|
23
|
+
controlGizmo?: ControlGizmo;
|
|
24
|
+
preferenceGizmo?: PreferenceGizmo;
|
|
25
|
+
pictureCutGizmo?: PictureCutGizmo;
|
|
26
|
+
pictureExpandGizmo?: PictureExpandGizmo;
|
|
27
|
+
textGizmo?: TextGizmo;
|
|
28
|
+
maskGizmo?: MaskGizmo;
|
|
29
|
+
loadingGizmo?: LoadingGizmo;
|
|
30
|
+
spriteTextEditGizmo?: SpriteTextEditGizmo;
|
|
31
|
+
iconGizmo?: IconGizmo;
|
|
32
|
+
itemCreateGizmo?: ItemCreateGizmo;
|
|
33
|
+
private _ignoreInteraction;
|
|
34
|
+
clickButtons: number;
|
|
35
|
+
container: HTMLElement;
|
|
36
|
+
private _emitter?;
|
|
37
|
+
/**
|
|
38
|
+
* @description Current time when mouse down is first trigger.
|
|
39
|
+
*/
|
|
40
|
+
private clickTime;
|
|
41
|
+
/**
|
|
42
|
+
* @description Is first click.
|
|
43
|
+
*/
|
|
44
|
+
private firstClick;
|
|
45
|
+
/**
|
|
46
|
+
* @description The maximum span duration a double click interact. - 500ms 操作是 windows 默认的双击时间间隔
|
|
47
|
+
*/
|
|
48
|
+
private readonly dblclickTimeSpan;
|
|
49
|
+
/**
|
|
50
|
+
* @description 是否按下空格键
|
|
51
|
+
*/
|
|
52
|
+
spaceEmit: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* @description 辅助面板交互状态
|
|
55
|
+
*/
|
|
56
|
+
interactType: GestureHandlerInteractType;
|
|
57
|
+
constructor(container: HTMLElement);
|
|
58
|
+
set ignoreInteraction(state: boolean);
|
|
59
|
+
get ignoreInteraction(): boolean;
|
|
60
|
+
resize(): void;
|
|
61
|
+
refresh(): void;
|
|
62
|
+
render(): void;
|
|
63
|
+
init(pageDataUtils: PageDataUtils, emitter: EventEmitter<SDKEvents>): Promise<void>;
|
|
64
|
+
initEvents(): void;
|
|
65
|
+
registerViewEvent(): void;
|
|
66
|
+
/**
|
|
67
|
+
* 鼠标按下事件
|
|
68
|
+
* @param event 鼠标事件
|
|
69
|
+
*/
|
|
70
|
+
onMouseDown(event: MouseEvent): void;
|
|
71
|
+
/**
|
|
72
|
+
* 鼠标移动事件
|
|
73
|
+
* @param event 鼠标事件
|
|
74
|
+
*/
|
|
75
|
+
onMouseMove(event: MouseEvent): void;
|
|
76
|
+
/**
|
|
77
|
+
* 鼠标滚轮事件
|
|
78
|
+
* @param event 鼠标事件
|
|
79
|
+
*/
|
|
80
|
+
onWheel(event: WheelEvent): void;
|
|
81
|
+
/**
|
|
82
|
+
* 鼠标松开事件
|
|
83
|
+
* @param event 鼠标事件
|
|
84
|
+
*/
|
|
85
|
+
onMouseUp(event: MouseEvent): void;
|
|
86
|
+
onKeyDown(keyCode: KeyboardEvent): void;
|
|
87
|
+
onKeyUp(keyCode: KeyboardEvent): void;
|
|
88
|
+
dispose(): void;
|
|
89
|
+
setCursor(result?: GestureCursorResult): void;
|
|
90
|
+
openPictureCutGizmo(): void;
|
|
91
|
+
closePictureCutGizmo(): void;
|
|
92
|
+
setInteractType(type: GestureHandlerInteractType): void;
|
|
93
|
+
getCutInfo(): {
|
|
94
|
+
cutBox: Box2;
|
|
95
|
+
itemBox: Box2;
|
|
96
|
+
} | undefined;
|
|
97
|
+
setCutBox(min: Vector2, max: Vector2): Box2 | undefined;
|
|
98
|
+
openPictureExpandGizmo(): void;
|
|
99
|
+
closePictureExpandGizmo(): void;
|
|
100
|
+
getExpandInfo(): {
|
|
101
|
+
expandBox: Box2;
|
|
102
|
+
itemBox: Box2;
|
|
103
|
+
} | undefined;
|
|
104
|
+
setExpandBox(min: Vector2, max: Vector2): Box2 | undefined;
|
|
105
|
+
openMaskGizmo(brushSize: number): void;
|
|
106
|
+
clearMaskGizmo(): void;
|
|
107
|
+
closeMaskGizmo(): void;
|
|
108
|
+
setMaskGizmoConfig(config: Partial<MaskGizmoConfig>): void;
|
|
109
|
+
getMask(): string | null | undefined;
|
|
110
|
+
setMaskGizmoMode(mode: 'paint' | 'erase'): void;
|
|
111
|
+
openLoadingGizmo(id: string, options?: {
|
|
112
|
+
loadingBox?: Box2;
|
|
113
|
+
clearSelected?: boolean;
|
|
114
|
+
tip?: LoadingGizmoTip;
|
|
115
|
+
}): void;
|
|
116
|
+
updateLoadingGizmo(id: string, options: {
|
|
117
|
+
tip?: LoadingGizmoTip;
|
|
118
|
+
}): void;
|
|
119
|
+
closeLoadingGizmo(id: string): void;
|
|
120
|
+
setPictureCutGizmoLockScale(state: boolean): void;
|
|
121
|
+
setPictureExpandGizmoLockScale(state: boolean): void;
|
|
122
|
+
setTransformGizmoLockScale(state: boolean): void;
|
|
123
|
+
maskGizmoUndo(): boolean;
|
|
124
|
+
maskGizmoRedo(): boolean;
|
|
125
|
+
get maskGizmoCanUndo(): boolean;
|
|
126
|
+
get maskGizmoCanRedo(): boolean;
|
|
127
|
+
clearMaskGizmoUndoRedo(): void;
|
|
128
|
+
pictureCutGizmoUndo(): boolean;
|
|
129
|
+
pictureCutGizmoRedo(): boolean;
|
|
130
|
+
get pictureCutGizmoCanUndo(): boolean;
|
|
131
|
+
get pictureCutGizmoCanRedo(): boolean;
|
|
132
|
+
clearPictureCutGizmoUndoRedo(): void;
|
|
133
|
+
openSpriteTextGizmo(initParam: SpriteTextInitParam[]): void;
|
|
134
|
+
closeSpriteTextEditGizmo(): void;
|
|
135
|
+
setSpriteTextSelectedIndex(id: string, index: number): void;
|
|
136
|
+
setSpriteTextSelectedText(id: string, index: number, text: string): void;
|
|
137
|
+
setSpriteTextChangedState(id: string, index: number, hasChanged: boolean): void;
|
|
138
|
+
setSpriteTextEditState(id: string, index: number, isEditing: boolean): void;
|
|
139
|
+
openItemCreateGizmo(type: ItemCreateType): void;
|
|
140
|
+
closeItemCreateGizmo(): void;
|
|
141
|
+
openTextGizmo(textItemId?: string, mode?: 'select' | 'focus'): void;
|
|
142
|
+
closeTextGizmo(): void;
|
|
143
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { CardHTMLDocumentContent, CardHTMLDOMRenderer, CardHTMLRenderCleanup } from '../types';
|
|
2
|
+
export declare function renderDocumentContent(overlay: HTMLElement, content: CardHTMLDocumentContent): CardHTMLRenderCleanup;
|
|
3
|
+
export declare function renderDOMContentInIframe(overlay: HTMLElement, render: CardHTMLDOMRenderer): CardHTMLRenderCleanup;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type DocumentFileUrlFactory = (rawPath: string, fromPath: string) => string;
|
|
2
|
+
export declare function normalizeDocumentFiles(files: Record<string, string>): Map<string, string>;
|
|
3
|
+
export declare function createDocumentFileUrlFactory(files: Map<string, string>): DocumentFileUrlFactory;
|
|
4
|
+
export declare function transformDocumentFile(path: string, source: string, createFileUrl: DocumentFileUrlFactory, resolving?: Set<string>): string;
|
|
5
|
+
export declare function transformHTMLDocument(path: string, source: string, createFileUrl: DocumentFileUrlFactory): string;
|
|
6
|
+
export declare function transformCSSDocument(path: string, source: string, createFileUrl: DocumentFileUrlFactory): string;
|
|
7
|
+
export declare function transformJSDocument(path: string, source: string, createFileUrl: DocumentFileUrlFactory): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { HTMLOverlayManager } from './manager';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Box2 } from '../math';
|
|
2
|
+
import type { EventEmitter } from '../shared';
|
|
3
|
+
import type { SDKEvents } from '../sdk';
|
|
4
|
+
import { type SDKItem } from '../sdk-item';
|
|
5
|
+
type HTMLOverlayManagerOptions = {
|
|
6
|
+
container: HTMLElement;
|
|
7
|
+
emitter: EventEmitter<SDKEvents>;
|
|
8
|
+
getItems: () => SDKItem[];
|
|
9
|
+
getViewBoxById: (id: string) => Box2;
|
|
10
|
+
getZoom: () => number;
|
|
11
|
+
setZoom: (zoom: number) => void;
|
|
12
|
+
viewportFit: (box: Box2) => void;
|
|
13
|
+
};
|
|
14
|
+
export declare class HTMLOverlayManager {
|
|
15
|
+
private options;
|
|
16
|
+
private state;
|
|
17
|
+
constructor(options: HTMLOverlayManagerOptions);
|
|
18
|
+
attach(): void;
|
|
19
|
+
dispose(): void;
|
|
20
|
+
scheduleRender(): void;
|
|
21
|
+
private initEvents;
|
|
22
|
+
private initDOMEvents;
|
|
23
|
+
private handleContainerDoubleClick;
|
|
24
|
+
private handleContainerMouseDown;
|
|
25
|
+
private handleViewportTransform;
|
|
26
|
+
private render;
|
|
27
|
+
private renderFrameOverlays;
|
|
28
|
+
private getOrCreateFrameOverlay;
|
|
29
|
+
private getOrCreateOverlay;
|
|
30
|
+
private getHTMLCardIdByEvent;
|
|
31
|
+
private getLayerPoint;
|
|
32
|
+
private getOrCreateContentOverlay;
|
|
33
|
+
private createContentScaleOverlay;
|
|
34
|
+
private syncContentScale;
|
|
35
|
+
private syncContentInteraction;
|
|
36
|
+
private enterEditing;
|
|
37
|
+
private exitEditing;
|
|
38
|
+
private isEventInsideOverlay;
|
|
39
|
+
private renderOverlayContent;
|
|
40
|
+
private cleanupOverlayContent;
|
|
41
|
+
private removeOverlay;
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function normalizePath(path: string): string;
|
|
2
|
+
export declare function dirname(path: string): string;
|
|
3
|
+
export declare function resolvePath(path: string, fromPath: string): string;
|
|
4
|
+
export declare function splitResourcePath(path: string): {
|
|
5
|
+
path: string;
|
|
6
|
+
suffix: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function shouldRewriteResource(url: string): boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type { SDKOptions, SDKInputParam, PageData, PageProperty, ViewProperty, ActiveData, ViewParam, BaseItemProperty, SpriteItemProperty, TextItemProperty, VideoItemProperty, GeneratorItemProperty, FrameItemProperty, FrameLayoutMode, SpriteCreateInfo, TextCreateInfo, GroupCreateInfo, VideoCreateInfo, GeneratorCreateInfo, EffectsCreateInfo, FrameCreateInfo, CardCreateInfo, CardItemProperty, CardItemTransformInfo, ItemCreateInfo, } from './types';
|
|
2
|
+
export type { CardTypeConfig, CardConfig } from './config';
|
|
3
|
+
export type { SDKItem } from './sdk-item';
|
|
4
|
+
export { BaseItem, SpriteItem, TextItem, VideoItem, GroupItem, GeneratorItem, EffectsItem, FrameItem, CardItem, createSDKItem, isBaseItem, isSpriteItem, isTextItem, isVideoItem, isGroupItem, isGeneratorItem, isEffectsItem, isFrameItem, isCardItem, SDKItemType, } from './sdk-item';
|
|
5
|
+
export type { SDKItemOptions, SpriteItemOptions, TextItemOptions, VideoItemOptions, GroupItemOptions, GeneratorItemOptions, EffectsItemOptions, FrameItemOptions, CardItemOptions, } from './sdk-item';
|
|
6
|
+
export { ItemOrderAction } from './types';
|
|
7
|
+
export type { SetItemPropertyParam, SetSingleItemSinglePropertyParam, SetSingleItemMultiplePropertiesParam, BaseItemPropertyKey, BaseItemPropertyValueMap, ItemPropertyMap, } from './types';
|
|
8
|
+
export type { CreateOperation, DeleteOperation, UpdateOperation, Operation } from './service/UndoRedo';
|
|
9
|
+
export type { SDKEvents } from './sdk';
|
|
10
|
+
export type { GizmoType } from './gesture-handler/gizmo';
|
|
11
|
+
export { SDK } from './sdk';
|
|
12
|
+
export { Box2, Vector2 } from './math';
|
|
13
|
+
export { spec, generateGUID } from './shared';
|
|
14
|
+
export * from './utils';
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { Vector2 } from './vector2';
|
|
2
|
+
/**
|
|
3
|
+
* @class 二维包围盒
|
|
4
|
+
*/
|
|
5
|
+
export declare class Box2 {
|
|
6
|
+
/**
|
|
7
|
+
* @member {Vector2[]} corners 二维包围盒角点
|
|
8
|
+
*/
|
|
9
|
+
corners: Vector2[];
|
|
10
|
+
min: Vector2;
|
|
11
|
+
max: Vector2;
|
|
12
|
+
/**
|
|
13
|
+
* 构造函数,传入值为空时表示空包围盒
|
|
14
|
+
* @param {Vector2} [min=new Vector2(Infinity, Infinity)] 最小点
|
|
15
|
+
* @param {Vector2} [max=new Vector2(-Infinity, -Infinity)] 最大点
|
|
16
|
+
*/
|
|
17
|
+
constructor(min?: Vector2, max?: Vector2);
|
|
18
|
+
/**
|
|
19
|
+
* 通过最大最小点设置二维包围盒
|
|
20
|
+
* @param {Vector2} min 最小点
|
|
21
|
+
* @param {Vector2} max 最大点
|
|
22
|
+
* @returns {Box2} 二维包围盒
|
|
23
|
+
*/
|
|
24
|
+
set(min: Vector2, max: Vector2): this;
|
|
25
|
+
/**
|
|
26
|
+
* 通过角点设置二维包围盒
|
|
27
|
+
* @param {Vector2[]} vecArray 二维空间点数组
|
|
28
|
+
* @returns {Box2} 二维包围盒
|
|
29
|
+
*/
|
|
30
|
+
setFromVec2Array(vecArray: Vector2[]): this;
|
|
31
|
+
setFromCorners(corners: Vector2[]): this;
|
|
32
|
+
/**
|
|
33
|
+
* 通过屏幕坐标点设置二维包围盒 - 点为屏幕坐标点,x正方向为右,y正方向为向上
|
|
34
|
+
* @param vecArray 屏幕坐标点
|
|
35
|
+
*/
|
|
36
|
+
setFromVec2ArrayWithOutCorners(vecArray: Vector2[]): this;
|
|
37
|
+
/**
|
|
38
|
+
* 通过中心与大小设置二维包围盒
|
|
39
|
+
* @param {Vector2} center 二维中心点
|
|
40
|
+
* @param {Vector2} size 二维大小
|
|
41
|
+
* @returns {Box2} 二维包围盒
|
|
42
|
+
*/
|
|
43
|
+
setFromCenterAndSize(center: Vector2, size: Vector2): this;
|
|
44
|
+
/**
|
|
45
|
+
* 克隆二维包围盒
|
|
46
|
+
* @returns {Box2} 克隆结果
|
|
47
|
+
*/
|
|
48
|
+
clone(): Box2;
|
|
49
|
+
/**
|
|
50
|
+
* 复制二维包围盒
|
|
51
|
+
* @param {Box2} box 二维包围盒
|
|
52
|
+
* @returns {Box2} 复制结果
|
|
53
|
+
*/
|
|
54
|
+
copyFrom(box: Box2): this;
|
|
55
|
+
/**
|
|
56
|
+
* 二维包围盒置空
|
|
57
|
+
* @returns {Box2} 置空结果
|
|
58
|
+
*/
|
|
59
|
+
makeEmpty(): this;
|
|
60
|
+
/**
|
|
61
|
+
* 二维包围盒判空
|
|
62
|
+
* @returns {boolean} 判空结果
|
|
63
|
+
*/
|
|
64
|
+
isEmpty(): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* 获取二维包围盒角点
|
|
67
|
+
* @returns {Vector2[]} 二维包围盒角点
|
|
68
|
+
*/
|
|
69
|
+
getCorners(): Vector2[];
|
|
70
|
+
/**
|
|
71
|
+
* 获取二维包围盒中心点
|
|
72
|
+
* @param {Vector2} [target=new Vector2()] 目标点(用以存放二维包围盒中心点)
|
|
73
|
+
* @returns {Vector2} 二维包围盒中心点
|
|
74
|
+
*/
|
|
75
|
+
getCenter(target?: Vector2): Vector2;
|
|
76
|
+
/**
|
|
77
|
+
* 获取二维包围盒大小
|
|
78
|
+
* @param {Vector2} [target=new Vector2()] 目标向量(用以存放二维包围盒大小)
|
|
79
|
+
* @returns {Vector2} 二维包围盒大小
|
|
80
|
+
*/
|
|
81
|
+
getSize(target?: Vector2): Vector2;
|
|
82
|
+
/**
|
|
83
|
+
* 通过二维空间点扩展二维包围盒
|
|
84
|
+
* @param {Vector2} point 二维空间点
|
|
85
|
+
* @returns {Box2} 扩展包围盒
|
|
86
|
+
*/
|
|
87
|
+
expandByPoint(point: Vector2): this;
|
|
88
|
+
/**
|
|
89
|
+
* 通过向量扩展二维包围盒
|
|
90
|
+
* @param {Vector2} vector 二维向量
|
|
91
|
+
* @returns {Box2} 扩展结果
|
|
92
|
+
*/
|
|
93
|
+
expandByVector(vector: Vector2): this;
|
|
94
|
+
/**
|
|
95
|
+
* 通过大小扩展二维包围盒
|
|
96
|
+
* @param {number} scalar 扩展大小
|
|
97
|
+
* @returns {Box2} 扩展结果
|
|
98
|
+
*/
|
|
99
|
+
expandByScalar(scalar: number): this;
|
|
100
|
+
/**
|
|
101
|
+
* 判断二维包围盒是否包含二维空间点
|
|
102
|
+
* @param {Vector2} point 二维空间点
|
|
103
|
+
* @param {boolean} [isOrthogonal=true] 包围盒正交判断(默认为true)
|
|
104
|
+
* @returns {boolean} 点包含判断结果
|
|
105
|
+
*/
|
|
106
|
+
containsPoint(point: Vector2, isOrthogonal?: boolean): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* 判断二维包围盒包含关系(if this contains other)
|
|
109
|
+
* @param {Box2} box 其它包围盒
|
|
110
|
+
* @returns {boolean} 二维包围盒包含判断结果
|
|
111
|
+
*/
|
|
112
|
+
containsBox(box: Box2): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* 获取点以包围盒左上角顶点为原点的相对位置
|
|
115
|
+
* @param {Vector2} point 指定二维空间点
|
|
116
|
+
* @param {Vector2} [target=new Vector2()] 目标空间点
|
|
117
|
+
* @returns {Vector2} 计算结果空间点
|
|
118
|
+
*/
|
|
119
|
+
getParameter(point: Vector2, target?: Vector2): Vector2;
|
|
120
|
+
/**
|
|
121
|
+
* 求点与二维包围盒的最近点
|
|
122
|
+
* @param {Vector2} point 二维空间点
|
|
123
|
+
* @param {Vector2} [target=new Vector2()] 结果点
|
|
124
|
+
* @returns {Vector2} 二维空间点
|
|
125
|
+
*/
|
|
126
|
+
clampPoint(point: Vector2, target?: Vector2): Vector2;
|
|
127
|
+
/**
|
|
128
|
+
* 求点到二维包围盒的距离
|
|
129
|
+
* @param {Vector2} point 二维空间点
|
|
130
|
+
* @returns {number} 距离
|
|
131
|
+
*/
|
|
132
|
+
distanceToPoint(point: Vector2): number;
|
|
133
|
+
/**
|
|
134
|
+
* 二维包围盒求交集
|
|
135
|
+
* @param {Box2} box 二维包围盒
|
|
136
|
+
* @returns {Box2} 求交结果
|
|
137
|
+
*/
|
|
138
|
+
intersect(box: Box2): this;
|
|
139
|
+
/**
|
|
140
|
+
* 二维包围盒求并集
|
|
141
|
+
* @param {Box2} box 二维包围盒
|
|
142
|
+
* @returns {Box2} 求并结果
|
|
143
|
+
*/
|
|
144
|
+
union(target: Box2 | Vector2): this;
|
|
145
|
+
/**
|
|
146
|
+
* 二维包围盒位移
|
|
147
|
+
* @param {Vector2} offset 位移向量
|
|
148
|
+
* @returns {Box2} 位移结果
|
|
149
|
+
*/
|
|
150
|
+
translate(offset: Vector2): this;
|
|
151
|
+
scale(scalar: number | Vector2, anchor?: Vector2): this;
|
|
152
|
+
/**
|
|
153
|
+
* 二维包围盒判等
|
|
154
|
+
* @param {Box2} box 二维包围盒
|
|
155
|
+
* @returns {boolean} 判等结果
|
|
156
|
+
*/
|
|
157
|
+
equals(box: Box2): boolean;
|
|
158
|
+
/**
|
|
159
|
+
* 判断二维包围盒相交关系(if this intersect other)
|
|
160
|
+
* @param {Box2} box 二维包围盒
|
|
161
|
+
* @param {boolean} [isOrthogonal=true] 正交判断(当前包围盒)
|
|
162
|
+
* @returns {boolean} 相交判断结果
|
|
163
|
+
*/
|
|
164
|
+
intersectsBox(box: Box2, isOrthogonal?: boolean): boolean;
|
|
165
|
+
rotate(angle: number, center?: Vector2): this;
|
|
166
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { Box2 } from './box2';
|
|
2
|
+
import { Vector2 } from './vector2';
|
|
3
|
+
export declare class Circle {
|
|
4
|
+
center: Vector2;
|
|
5
|
+
radius: number;
|
|
6
|
+
constructor(center?: Vector2, radius?: number);
|
|
7
|
+
/**
|
|
8
|
+
* 通过中心点与大小设置圆
|
|
9
|
+
* @param {Vector2} center 圆心
|
|
10
|
+
* @param {number} radius 半径
|
|
11
|
+
* @returns {Circle}
|
|
12
|
+
*/
|
|
13
|
+
set(center: Vector2, radius: number): this;
|
|
14
|
+
/**
|
|
15
|
+
* 克隆圆
|
|
16
|
+
* @returns {Circle} 克隆结果
|
|
17
|
+
*/
|
|
18
|
+
clone(): Circle;
|
|
19
|
+
/**
|
|
20
|
+
* 复制圆
|
|
21
|
+
* @param {Circle} circle 复制对象
|
|
22
|
+
* @returns {Circle} 复制结果
|
|
23
|
+
*/
|
|
24
|
+
copy(circle: Circle): this;
|
|
25
|
+
/**
|
|
26
|
+
* 圆置空
|
|
27
|
+
* @returns {Circle} 置空结果
|
|
28
|
+
*/
|
|
29
|
+
makeEmpty(): this;
|
|
30
|
+
/**
|
|
31
|
+
* 圆判空
|
|
32
|
+
* @returns {boolean} 判空结果
|
|
33
|
+
*/
|
|
34
|
+
isEmpty(): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* 获取圆心
|
|
37
|
+
* @param {Vector2} [target=new Vector2()] 目标结果对象
|
|
38
|
+
* @returns {Vector2} 圆心
|
|
39
|
+
*/
|
|
40
|
+
getCenter(target?: Vector2): Vector2;
|
|
41
|
+
/**
|
|
42
|
+
* 获取半径
|
|
43
|
+
* @returns {number} 半径
|
|
44
|
+
*/
|
|
45
|
+
getRadius(): number;
|
|
46
|
+
/**
|
|
47
|
+
* 通过二维空间点扩展圆
|
|
48
|
+
* @param {Vector2} point 二维空间点
|
|
49
|
+
* @returns {Circle} 扩展结果
|
|
50
|
+
*/
|
|
51
|
+
expandByPoint(point: Vector2): this;
|
|
52
|
+
/**
|
|
53
|
+
* 通过大小扩展圆
|
|
54
|
+
* @param {number} scalar 扩展大小
|
|
55
|
+
* @returns {Circle} 扩展结果
|
|
56
|
+
*/
|
|
57
|
+
expandByScalar(scalar: number): this;
|
|
58
|
+
/**
|
|
59
|
+
* 判断圆是否包含二维空间点
|
|
60
|
+
* @param {Vector2} point 二维空间点
|
|
61
|
+
* @returns {boolean} 包含判断结果
|
|
62
|
+
*/
|
|
63
|
+
containsPoint(point: Vector2): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* 判断圆是否包含二维包围盒
|
|
66
|
+
* @param {Box2} box 二维包围盒
|
|
67
|
+
* @returns {boolean} 包含判断结果
|
|
68
|
+
*/
|
|
69
|
+
containsBox(box: Box2): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* 判断圆与二维包围盒的相交关系
|
|
72
|
+
* @param {Box2} box 二维包围盒
|
|
73
|
+
* @returns {boolean} 相交判断结果
|
|
74
|
+
*/
|
|
75
|
+
intersectsBox(box: Box2): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* 求点与圆的最短距离
|
|
78
|
+
* @param {Vector2} point 二维空间点
|
|
79
|
+
* @returns {number} 距离
|
|
80
|
+
*/
|
|
81
|
+
distanceToPoint(point: Vector2): number;
|
|
82
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { math } from '../shared';
|
|
2
|
+
import { Matrix4 } from './matrix4';
|
|
3
|
+
import { Vector3 } from './vector3';
|
|
4
|
+
export declare class Euler extends math.Euler {
|
|
5
|
+
constructor(x?: number, y?: number, z?: number, order?: math.EulerOrder);
|
|
6
|
+
getInvertMatrixByEuler(): Matrix4;
|
|
7
|
+
/**
|
|
8
|
+
* 欧拉角保存于三维向量(应用于计算)
|
|
9
|
+
* @param {Vector3} [optionalResult] 目标保存对象
|
|
10
|
+
* @returns {Vector3} 保存结果
|
|
11
|
+
*/
|
|
12
|
+
toDegreeVector3(optionalResult?: Vector3): Vector3;
|
|
13
|
+
/**
|
|
14
|
+
* 由角度三维向量构建欧拉角
|
|
15
|
+
* @param {Vector3} v 角度三维向量
|
|
16
|
+
* @param {EulerOrder} [order] 欧拉角顺序,默认为ZYX
|
|
17
|
+
* @returns {Euler} 欧拉角
|
|
18
|
+
*/
|
|
19
|
+
setFromDegreeVector3(degree: Vector3, order?: math.EulerOrder): this;
|
|
20
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './box2';
|
|
2
|
+
export * from './circle';
|
|
3
|
+
export * from './euler';
|
|
4
|
+
export * from './line2';
|
|
5
|
+
export * from './line3';
|
|
6
|
+
export * from './matrix4';
|
|
7
|
+
export * from './plane';
|
|
8
|
+
export * from './quaternion';
|
|
9
|
+
export * from './ray-caster';
|
|
10
|
+
export * from './ray';
|
|
11
|
+
export * from './utils';
|
|
12
|
+
export * from './vector2';
|
|
13
|
+
export * from './vector3';
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Vector2 } from './vector2';
|
|
2
|
+
/**
|
|
3
|
+
* @class 二维线段
|
|
4
|
+
*/
|
|
5
|
+
export declare class Line2 {
|
|
6
|
+
start: Vector2;
|
|
7
|
+
end: Vector2;
|
|
8
|
+
constructor(start?: Vector2, end?: Vector2);
|
|
9
|
+
/**
|
|
10
|
+
* 设置二维线段
|
|
11
|
+
* @param {Vector2} start 线段起点
|
|
12
|
+
* @param {Vector2} end 线段终点
|
|
13
|
+
* @returns {Line2} 二维线段
|
|
14
|
+
*/
|
|
15
|
+
set(start: Vector2, end: Vector2): this;
|
|
16
|
+
/**
|
|
17
|
+
* 复制二维线段
|
|
18
|
+
* @param {Line2} line 复制对象
|
|
19
|
+
* @returns {Line2} 复制结果
|
|
20
|
+
*/
|
|
21
|
+
copyFrom(line: Line2): this;
|
|
22
|
+
/**
|
|
23
|
+
* 二维线段求方向
|
|
24
|
+
* @returns {Vector2} 二维线段方向
|
|
25
|
+
*/
|
|
26
|
+
direction(): Vector2;
|
|
27
|
+
/**
|
|
28
|
+
* 二维线段求中点
|
|
29
|
+
* @param {Vector2} [target=new Vector2()] 目标保存对象
|
|
30
|
+
* @returns {Vector2} 二维线段中点
|
|
31
|
+
*/
|
|
32
|
+
getCenter(target?: Vector2): Vector2;
|
|
33
|
+
/**
|
|
34
|
+
* 二维线段向量值
|
|
35
|
+
* @param {Vector2} [target=new Vector2()] 目标保存对象
|
|
36
|
+
* @returns {Vector2} 二维线段向量值
|
|
37
|
+
*/
|
|
38
|
+
delta(target?: Vector2): Vector2;
|
|
39
|
+
/**
|
|
40
|
+
* 二维线段欧式距离平方(应用于计算)
|
|
41
|
+
* @returns {number} 计算结果
|
|
42
|
+
*/
|
|
43
|
+
distanceSq(): number;
|
|
44
|
+
/**
|
|
45
|
+
* 二维线段欧式距离
|
|
46
|
+
* @returns {number} 计算结果
|
|
47
|
+
*/
|
|
48
|
+
distance(): number;
|
|
49
|
+
/**
|
|
50
|
+
* 求二维线段比例点
|
|
51
|
+
* @param {number} t 比例值
|
|
52
|
+
* @param {Vector2} target 目标保存对象
|
|
53
|
+
* @returns {Vector2} 比例点结果
|
|
54
|
+
*/
|
|
55
|
+
at(t: number, target?: Vector2): Vector2;
|
|
56
|
+
/**
|
|
57
|
+
* 求点与线段的最短距离
|
|
58
|
+
* @param {Vector2} point 二维空间点
|
|
59
|
+
* @param {boolean} clampToLine 是否限制于线段内
|
|
60
|
+
* @returns {number} 距离结果
|
|
61
|
+
*/
|
|
62
|
+
closestPointToPointParameter(point: Vector2, clampToLine: boolean): number;
|
|
63
|
+
/**
|
|
64
|
+
* 求点与线段的最近交点
|
|
65
|
+
* @param {Vector2} point 二维空间点
|
|
66
|
+
* @param {boolean} clampToLine 是否限制于线段内
|
|
67
|
+
* @param {Vector2} target 目标保存对象
|
|
68
|
+
* @returns {Vector2} 最近交点
|
|
69
|
+
*/
|
|
70
|
+
closestPointToPoint(point: Vector2, clampToLine: boolean, target?: Vector2): Vector2;
|
|
71
|
+
/**
|
|
72
|
+
* 二维线段判等
|
|
73
|
+
* @param {Line2} line 二维线段
|
|
74
|
+
* @returns {boolean} 判等结果
|
|
75
|
+
*/
|
|
76
|
+
equals(line: Line2): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* 克隆二维线段
|
|
79
|
+
* @returns {Line2} 克隆结果
|
|
80
|
+
*/
|
|
81
|
+
clone(): Line2;
|
|
82
|
+
/**
|
|
83
|
+
* 二维线段求长度
|
|
84
|
+
* @returns {number} 长度
|
|
85
|
+
*/
|
|
86
|
+
length(): number;
|
|
87
|
+
/**
|
|
88
|
+
* 二维线段判断相交
|
|
89
|
+
* @param {Line2} other 二维线段
|
|
90
|
+
* @returns {boolean} 相交判断结果
|
|
91
|
+
*/
|
|
92
|
+
crossWithLine(other: Line2): boolean;
|
|
93
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Vector3 } from './vector3';
|
|
2
|
+
/**
|
|
3
|
+
* @class 三维线段
|
|
4
|
+
*/
|
|
5
|
+
export declare class Line3 {
|
|
6
|
+
start: Vector3;
|
|
7
|
+
end: Vector3;
|
|
8
|
+
/**
|
|
9
|
+
* 构造函数
|
|
10
|
+
* @param {Vector3} [start=new Vector3()] 线段起点,默认值为(0, 0, 0)
|
|
11
|
+
* @param {Vector3} [end=new Vector3()] 线段终点,默认值为(0, 0, 0)
|
|
12
|
+
*/
|
|
13
|
+
constructor(start?: Vector3, end?: Vector3);
|
|
14
|
+
closestPointToPointParameter(point: Vector3, clampToLine?: boolean): number;
|
|
15
|
+
closestPointToPoint(point: Vector3, clampToLine?: boolean): Vector3;
|
|
16
|
+
delta(): Vector3;
|
|
17
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { math } from '../shared';
|
|
2
|
+
import type { Euler } from './euler';
|
|
3
|
+
import type { Quaternion } from './quaternion';
|
|
4
|
+
import { Vector3 } from './vector3';
|
|
5
|
+
export declare class Matrix4 extends math.Matrix4 {
|
|
6
|
+
/**
|
|
7
|
+
* 通过数组创建矩阵
|
|
8
|
+
* @param array - 数组
|
|
9
|
+
* @param [offset=0] - 起始偏移值
|
|
10
|
+
* @returns 矩阵
|
|
11
|
+
*/
|
|
12
|
+
static fromArray(array: math.Matrix4DataType, offset?: number): Matrix4;
|
|
13
|
+
clone(): Matrix4;
|
|
14
|
+
compose(translation: Vector3, rotation: Quaternion, scale: Vector3, anchor?: math.Vector3): this;
|
|
15
|
+
/**
|
|
16
|
+
* 导出四维矩阵[三维空间变换矩阵]旋转部分
|
|
17
|
+
* @param {Matrix4} m 四维矩阵
|
|
18
|
+
* @returns {Matrix4} 导出结果
|
|
19
|
+
*/
|
|
20
|
+
extractRotation(m: Matrix4): this;
|
|
21
|
+
/**
|
|
22
|
+
* 由欧拉角设置四维矩阵
|
|
23
|
+
* @param {Euler} euler 欧拉角
|
|
24
|
+
* @returns {Matrix4} 四维矩阵
|
|
25
|
+
*/
|
|
26
|
+
makeRotationFromEuler(euler: Euler): this;
|
|
27
|
+
setPosition(position: Vector3): this;
|
|
28
|
+
}
|