vis-core 0.28.31 → 0.28.33

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.
@@ -1,13 +1,20 @@
1
1
  import Editor from "..";
2
+ import * as THREE from 'three';
2
3
  import { Command } from './Command';
4
+ import { SetObjectMaterial } from './SetObjectMaterial';
3
5
  declare class AddMaterial extends Command {
4
6
  materialType: string | Record<string, any>;
5
7
  flag: boolean;
6
8
  addObjectUuid: string | undefined;
7
- constructor(editor: Editor, materialType: string | Record<string, any>);
9
+ fixMaterialType: Record<string, any> | null;
10
+ object?: THREE.Mesh<any, THREE.Material | THREE.Material[]>;
11
+ materialSlot?: number;
12
+ setMaterialCommand?: SetObjectMaterial;
13
+ constructor(editor: Editor, materialType: string | Record<string, any>, object?: THREE.Mesh, slot?: number);
8
14
  execute(): Promise<void>;
9
15
  undo(): Promise<void>;
10
16
  toJSON(): any;
11
17
  fromJSON(json: any): void;
18
+ fixJSON(): void;
12
19
  }
13
20
  export { AddMaterial };
@@ -11,7 +11,7 @@ export class SetMaterialMap extends Command {
11
11
  playVideo(map: any): void;
12
12
  fromJSON(json: any): void;
13
13
  }
14
- export function parseTexture(json: any): any;
14
+ export function parseTexture(json: any): THREE.Texture | null;
15
15
  export function serializeMap(map: any): any;
16
16
  import { Command } from './Command';
17
17
  import * as THREE from 'three';
@@ -1,13 +1,14 @@
1
- import { Command } from './Command';
2
1
  import Editor, { THREE } from "..";
2
+ import { Command } from './Command';
3
3
  declare class SetObjectMaterial extends Command {
4
4
  object: THREE.Mesh;
5
- oldValue: string;
6
5
  newValue: string;
7
6
  materialSlot: number;
7
+ oldMaterial: THREE.Material;
8
8
  constructor(editor: Editor, object: THREE.Mesh, materialSlot: number, newType: string);
9
9
  execute(): Promise<void>;
10
10
  undo(): Promise<void>;
11
+ playVideo(material: THREE.Material): void;
11
12
  toJSON(): any;
12
13
  fromJSON(json: any): void;
13
14
  }
@@ -1,4 +1,4 @@
1
- import Editor from "./";
1
+ import type Editor from "./";
2
2
  declare class History {
3
3
  editor: Editor;
4
4
  undos: any[];
@@ -7,16 +7,71 @@ declare class History {
7
7
  idCounter: number;
8
8
  historyDisabled: boolean;
9
9
  constructor(editor: Editor);
10
+ /**
11
+ * 检查两个命令是否可以合并
12
+ */
13
+ private canMergeCommands;
10
14
  execute(cmd: any, optionalName?: string): Promise<void>;
11
15
  undo(): any;
12
16
  redo(): any;
17
+ /**
18
+ * 处理图片数据,将ArrayBuffer转换为Base64字符串并建立引用映射
19
+ */
20
+ private processImageData;
21
+ /**
22
+ * 处理包含图片的命令
23
+ */
24
+ private processCommandWithImages;
13
25
  toJSON(): {
14
26
  u: any[];
15
27
  i: string[];
16
28
  };
29
+ /**
30
+ * 处理图片引用,将引用字符串还原为实际URL或数据
31
+ */
32
+ private processImageReference;
33
+ /**
34
+ * 还原包含图片的命令数据
35
+ */
36
+ private restoreCommandImages;
37
+ /**
38
+ * 验证和规范化命令类型
39
+ */
40
+ private normalizeCommandType;
41
+ /**
42
+ * 创建命令实例
43
+ */
44
+ private createCommand;
17
45
  fromJSON(json: any): void;
18
- processUndos(maxFrameTime?: number): Promise<unknown>;
46
+ /**
47
+ * 批量处理撤销操作,支持分帧执行以避免阻塞UI
48
+ */
49
+ processUndos(maxFrameTime?: number): Promise<string>;
50
+ /**
51
+ * 执行单个撤销命令
52
+ */
19
53
  private executeUndo;
54
+ /**
55
+ * 清空所有历史记录
56
+ */
20
57
  clear(): void;
58
+ /**
59
+ * 获取历史记录状态信息
60
+ */
61
+ getState(): {
62
+ undoCount: number;
63
+ redoCount: number;
64
+ canUndo: boolean;
65
+ canRedo: boolean;
66
+ isDisabled: boolean;
67
+ };
68
+ /**
69
+ * 启用/禁用历史记录功能
70
+ */
71
+ setEnabled(enabled: boolean): void;
72
+ /**
73
+ * 获取最后执行的命令
74
+ */
75
+ getLastCommand(): any;
21
76
  }
22
77
  export default History;
@@ -1,4 +1,5 @@
1
1
  import '@/styles/vis.css';
2
+ import "../utils/fixVideoTexture";
2
3
  import { EventEmitter } from 'events';
3
4
  import type Base from "../vis/base";
4
5
  import type Pencil from 'gl-draw';
@@ -47,9 +48,9 @@ export default class Editor {
47
48
  options: Options;
48
49
  constructor(options: Options);
49
50
  getObjectMaterial(object?: THREE.Mesh | null, slot?: number): THREE.Material | THREE.Material[] | undefined;
50
- getMListFixBaseObjectByObject(object: THREE.Mesh, slot: number): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>, THREE.Material | THREE.Material[], THREE.Object3DEventMap> | null;
51
- materialObjectByUuid(uuid: string): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>, THREE.Material | THREE.Material[], THREE.Object3DEventMap> | undefined;
52
- uuidByMaterialObject(object: THREE.Object3D): string | undefined;
51
+ getMListFixBaseObjectByObject(object: THREE.Mesh, slot: number): any;
52
+ materialObjectByUuid(uuid: string): any;
53
+ uuidByMaterialObject(object: THREE.Object3D): any;
53
54
  setObjectMaterial(object: THREE.Mesh, slot: number, newMaterial: THREE.Material): void;
54
55
  uuidByObject(object: THREE.Object3D): string | undefined;
55
56
  objectByUuid(key: string): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>, THREE.Material | THREE.Material[], THREE.Object3DEventMap> | undefined;
@@ -57,18 +58,13 @@ export default class Editor {
57
58
  baseObjectByUuid(key: `arc${string}`): Arc;
58
59
  baseObjectByUuid(key: `sprite${string}`): Sprite;
59
60
  baseObjectByUuid(key: string): BaseObject;
60
- findSelectItem(selectOption: SelectedMeta[], key: any, val: any): SelectedMeta | undefined;
61
+ private _selectOptionMaps;
62
+ findSelectItem(key: any, val: any): SelectedMeta | undefined;
61
63
  selectOption: SelectedMeta[];
62
64
  changeSelectOption(): void;
63
- findMListSelectItem(key: any, val: any): {
64
- key: string;
65
- name: string;
66
- type: string;
67
- use: number;
68
- object: THREE.Mesh;
69
- material: THREE.Material;
70
- baseObject: IBaseObject;
71
- } | undefined;
65
+ private _buildCacheMapsRecursively;
66
+ private _mListOptionsMaps;
67
+ findMListSelectItem(key: any, val: any): any;
72
68
  mListOptions: {
73
69
  key: string;
74
70
  name: string;
@@ -1,5 +1,6 @@
1
1
  import Editor from "./";
2
2
  import Base from "../vis/base";
3
+ import * as THREE from 'three';
3
4
  interface Options {
4
5
  visFactories?: Base;
5
6
  }
@@ -25,7 +26,7 @@ export default class {
25
26
  private copyMListMaterialKey;
26
27
  copyMListMaterial(key?: string): Promise<void>;
27
28
  pasteMListMaterial(): Promise<void>;
28
- addMListMaterial(type?: string): Promise<void>;
29
+ addMListMaterial(material?: string | Record<string, any>, object3d?: THREE.Mesh, slot?: number): void;
29
30
  removeMListMaterial(key: string): Promise<void>;
30
31
  setExtendsOptions(name: string, value: any): void;
31
32
  toJSON(): {
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import '@/styles/vis.css';
2
2
  import './fix';
3
- export * as THREE from 'three';
4
3
  export * as TWEEN from '@tweenjs/tween.js';
5
- export * as animationUtils from './utils/animation';
6
4
  export * from "./vis/index";
5
+ export * as THREE from 'three';
7
6
  export * from './getVisConfig';
7
+ export * as animationUtils from './utils/animation';
8
8
  export declare const access: {
9
9
  token: string;
10
10
  };
11
- export declare const VERSION = "0.28.31";
11
+ export declare const VERSION = "0.28.33";