@realsee/dnalogel
Version:
81 lines (80 loc) • 2.69 kB
TypeScript
import type { EventHandlerConfig, FiveDomEventMap } from '../../../shared-utils/five/FiveDomEvents';
import { IObject3D } from '../../../shared-utils/three/IObject3D';
import type { BaseEditor } from './Editor';
import type { RequiredDeep } from 'type-fest';
import type { ImportDataToExportData } from '../../typings/utils.type';
import type * as THREE from 'three';
export interface BaseImportData {
/**
* @description: 唯一标识
*/
id?: string;
/**
* @description: 物体类型
*/
type: string;
}
export interface BaseExportData extends RequiredDeep<BaseImportData> {
}
export interface BaseObjectConfig {
/**
* @description: 是否可以编辑
* @default true
*/
canEdit: boolean;
/**
* @description: 是否以一种半透明的方式显示遮挡的部分
* @default true
*/
occlusionVisibility: boolean;
}
/**
* @description: 基础对象
*/
export declare abstract class BaseObject<ImportData extends BaseImportData = BaseImportData, ExportData extends BaseExportData = ImportDataToExportData<ImportData>, // 有性能问题,先注释掉
Config extends BaseObjectConfig = BaseObjectConfig> extends IObject3D {
name: string;
readonly isSculptObject = true;
draggable: boolean;
/**
* @description 是否被选中
*/
selected: boolean;
/**
* @description 配置
*/
config: Config;
editor: BaseEditor;
abstract type: string;
/**
* @description 物体导出数据
*/
abstract get data(): ExportData;
protected get baseData(): {
id: string;
type: string;
};
protected get pointSelector(): import("../../../shared-utils/three/PointSelector").PointSelector;
constructor(data?: Partial<ImportData>, config?: Partial<Config>);
on: <T extends keyof FiveDomEventMap>(event: T, callback: FiveDomEventMap[T], config?: EventHandlerConfig) => void;
off: (event?: keyof FiveDomEventMap, callback?: (e: import("../../../shared-utils/five/FiveDomEvents").FiveDomEvent) => any, ...args: any[]) => void;
/**
* @description 停止创建当前物体,等同于`esc`
*/
stopCreating(): void;
/**
* @description 从场景中删除当前物体
*/
delete(): void;
/**
* @description 高亮当前物体
*/
highlight(): void;
/**
* @description 取消高亮当前物体
*/
unhighlight(): void;
protected applyObjectMatrixWorld<P extends THREE.Vector3 | THREE.Vector3[]>(point: P): P;
protected applyObjectQuaternion<P extends THREE.Vector3 | THREE.Vector3[]>(point: P): P;
abstract create(...args: any): Promise<void>;
}