Sculpt
功能说明
Sculpt
(/ skʌlpt /
vt. 雕刻;n. 雕塑)是一个基于 @realsee/five
的 3D 编辑器,用于在 Five 场景中绘制和编辑 3D 物体。
效果展示
快速开始
初始化
通过 five plugins 方式初始化
import { const SculptPlugin: (five: Five) => Sculpt
SculptPlugin, SculptData } from '@realsee/dnalogel'
import { class Five
如视 VR Web展示器
Five, type FivePlugin<Parameters = void, Returns = void> = Parameters extends void ? (five: Five) => Returns : (five: Five, parameters: Parameters) => Returns
Five 插件
[[include:plugins.md]]
FivePlugin } from '@realsee/five'
const const fivePlugins: [((five: Five) => any) | ((five: Five, parameters: any) => any), string, any][]
fivePlugins: [type FivePlugin<Parameters = void, Returns = void> = Parameters extends void ? (five: Five) => Returns : (five: Five, parameters: Parameters) => Returns
Five 插件
[[include:plugins.md]]
FivePlugin<any, any>, string, any][] = [
[const SculptPlugin: (five: Five) => Sculpt
SculptPlugin, 'sculpt', {}]
]
// 加载five插件
const const five: Five
five = new new Five(initArgs?: FiveInitArgs | undefined): Five
如视 VR Web展示器
Five({
FiveInitArgs.plugins?: (((five: Five) => void) | [Plugin: ((five: Five) => any) | ((five: Five, parameters: any) => any), instanceName: string | null] | [Plugin: ((five: Five) => any) | ((five: Five, parameters: any) => any), instanceName: string | null, parameters: any] | [Plugin: (five: Five) => any, instanceName: string | null])[] | undefined
插件定义
plugins: const fivePlugins: [((five: Five) => any) | ((five: Five, parameters: any) => any), string, any][]
fivePlugins
})
也可以自己初始化
import { class Sculpt
Sculpt } from '@realsee/dnalogel'
const const sculpt: Sculpt
sculpt = new new Sculpt(five: Five, theme?: Partial<{
point: Partial<PointStyle>;
line: Partial<LineMeshStyle>;
polyline: Partial<LineMeshStyle>;
... 5 more ...;
box: Partial<...>;
}> | undefined): Sculpt
Sculpt(const five: Five
five) // five 为 Five 实例
加载数据
在 sculpt 场景中添加物体有两种方式,一种是已有数据的情况下,通过 sculpt.load(data)
方法加载。
列表项数据结构:data
const const data: {
items: ({
id: string;
type: string;
point: number[];
points?: undefined;
} | {
id: string;
type: string;
points: number[][];
point?: undefined;
})[];
}
data = {
items: ({
id: string;
type: string;
point: number[];
} | {
id: string;
type: string;
points: number[][];
})[]
items: [
{
id: string
id: '1',
type: string
type: 'Point',
point: number[]
point: [0, 0, 0]
},
{
id: string
id: '2',
type: string
type: 'Polyline',
points: number[][]
points: [[0, 0, 0], [1, 1, 1]]
}
]
}
// 在场景中绘制一个点和一条线
const sculpt: Sculpt
sculpt.Sculpt.load(data: Data, config?: Partial<BaseObjectConfig> | undefined): void
load(const data: {
items: ({
id: string;
type: string;
point: number[];
points?: undefined;
} | {
id: string;
type: string;
points: number[][];
point?: undefined;
})[];
}
data)
创建物体
在 sculpt 场景中添加物体的另一种方式是通过 sculpt.createXXXX()
方法创建。
-
绘制一个 Box
const sculpt: Sculpt
sculpt.Sculpt.createBox(params?: Partial<OpacityStyle & ColorStyle & OcclusionStyle & LineColorStyle & LineOpacityStyle & LineWidthStyle & CreateLimitConfig & DrawMethodConfig> | undefined): Promise<...>
createBox()
-
绘制一个绿色边框的红色 Box
const sculpt: Sculpt
sculpt.Sculpt.createBox(params?: Partial<OpacityStyle & ColorStyle & OcclusionStyle & LineColorStyle & LineOpacityStyle & LineWidthStyle & CreateLimitConfig & DrawMethodConfig> | undefined): Promise<...>
createBox({ color?: Color | undefined
color: 0xff0000, opacity?: number | undefined
opacity: 0.8, lineColor?: Color | undefined
lineColor: 0x00ff00, lineWidth?: number | undefined
lineWidth: 2 })
-
绘制一条红色的线段
const sculpt: Sculpt
sculpt.Sculpt.createLine(params?: Partial<LineColorStyle & LineOpacityStyle & LineWidthStyle & {
dashed?: boolean | undefined;
} & OcclusionStyle & Partial<...> & Partial<...> & CreateLimitConfig> | undefined): Promise<...>
createLine({ lineColor?: Color | undefined
lineColor: 0xff0000 })
-
绘制一条带有距离的线段
const sculpt: Sculpt
sculpt.Sculpt.createLine(params?: Partial<LineColorStyle & LineOpacityStyle & LineWidthStyle & {
dashed?: boolean | undefined;
} & OcclusionStyle & Partial<...> & Partial<...> & CreateLimitConfig> | undefined): Promise<...>
createLine({ lengthEnable?: boolean | undefined
lengthEnable: true })
-
绘制一条带有tip的线段
const sculpt: Sculpt
sculpt.Sculpt.createLine(params?: Partial<LineColorStyle & LineOpacityStyle & LineWidthStyle & {
dashed?: boolean | undefined;
} & OcclusionStyle & Partial<...> & Partial<...> & CreateLimitConfig> | undefined): Promise<...>
createLine({ tip?: string | undefined
tip: '线段' })
-
绘制一条线段,要求锁定水平面绘制
const sculpt: Sculpt
sculpt.Sculpt.createLine(params?: Partial<LineColorStyle & LineOpacityStyle & LineWidthStyle & {
dashed?: boolean | undefined;
} & OcclusionStyle & Partial<...> & Partial<...> & CreateLimitConfig> | undefined): Promise<...>
createLine({ limit?: "xoz" | "y" | "none" | undefined
limit: 'xoz' })
-
绘制一个矩形,要求锁定垂直面绘制,绘制方式为对角线绘制
const sculpt: Sculpt
sculpt.Sculpt.createRectangle(config?: Partial<OpacityStyle & ColorStyle & OcclusionStyle & LineColorStyle & LineOpacityStyle & LineWidthStyle & CreateLimitConfig & DrawMethodConfig> | undefined): Promise<...>
createRectangle({ limit?: "xoz" | "y" | "none" | undefined
limit: 'y', drawMethod?: "vertex" | "diagonal" | undefined
drawMethod: 'diagonal' })
-
更自由的绘制及编辑
import { import Util
Util } from '@realsee/dnalogel'
const { const PointSelector: typeof Util.PointSelector
PointSelector } = import Util
Util
const { const BoxMesh: typeof Util.sculpt.BoxMesh
BoxMesh, const BoxMeshEditor: typeof Util.sculpt.BoxMeshEditor
BoxMeshEditor, const createBox: (boxMesh: Util.sculpt.BoxMesh, pointSelector: Util.PointSelector, config?: Partial<CreateLimitConfig & DrawMethodConfig> | undefined) => Promise<void>
createBox } = import Util
Util.import sculpt
sculpt
// 创建 boxMesh
const const boxMesh: Util.sculpt.BoxMesh
boxMesh = new const BoxMesh: new (params?: Partial<PrismData & OpacityStyle & ColorStyle & OcclusionStyle & LineColorStyle & LineOpacityStyle & LineWidthStyle> | undefined) => Util.sculpt.BoxMesh
BoxMesh({ lineColor?: Color | undefined
lineColor: 0xff0000 })
const five: Five
five.Five.scene: Scene
内部使用的 THREE.Scene
scene.Scene.add(...objects: AddableObject[]): Scene
Adds object as child of this object.
add(const boxMesh: Util.sculpt.BoxMesh
boxMesh)
// 按需初始化编辑器
const const editor: Util.sculpt.BoxMeshEditor
editor = new const BoxMeshEditor: new (boxMesh: Util.sculpt.BoxMesh) => Util.sculpt.BoxMeshEditor
BoxMeshEditor(const boxMesh: Util.sculpt.BoxMesh
boxMesh)
// 创建选择器
const const pointSelector: Util.PointSelector
pointSelector = new const PointSelector: new (five: Five, config?: Partial<Config> | undefined) => Util.PointSelector
PointSelector(const five: Five
five)
const createBox: (boxMesh: Util.sculpt.BoxMesh, pointSelector: Util.PointSelector, config?: Partial<CreateLimitConfig & DrawMethodConfig> | undefined) => Promise<...>
createBox(const boxMesh: Util.sculpt.BoxMesh
boxMesh, const pointSelector: Util.PointSelector
pointSelector).Promise<void>.then<void, never>(onfulfilled?: ((value: void) => void | PromiseLike<void>) | null | undefined, onrejected?: ((reason: any) => PromiseLike<never>) | null | undefined): Promise<...>
Attaches callbacks for the resolution and/or rejection of the Promise.
then(() => {
var console: Console
console.Console.log(...data: any[]): void
log('绘制完成')
// 按需启用编辑功能
const editor: Util.sculpt.BoxMeshEditor
editor.BaseEditorWithObjectHelper<BoxMesh>.enable(): void
enable()
})
开启编辑功能
默认编辑功能默认开启,可以通过加载数据时传参的方式关闭默认行为:
const sculpt: Sculpt
sculpt.Sculpt.load(data: Data, config?: Partial<BaseObjectConfig> | undefined): void
load(const data: {
items: ({
id: string;
type: string;
point: number[];
points?: undefined;
} | {
id: string;
type: string;
points: number[][];
point?: undefined;
})[];
}
data, { defaultAction?: boolean | undefined
defaultAction: false })
点击开始编辑
const sculpt: Sculpt
sculpt.Subscribe<Event>.on<"click">(name: "click", callback: (e: MouseEvent, item: BuiltInItem) => false | void, once?: boolean | undefined): () => void
注册事件
on('click', (e: MouseEvent
e, item: BuiltInItem
item) => {
// 点击选中(有一个高亮效果)
item: BuiltInItem
item.BaseObject<ImportData extends BaseImportData = BaseImportData, ExportData extends BaseExportData = { [KeyType in keyof ({ [Key in keyof PickIndexSignature<ReplaceDeep<ReplaceDeep<ImportData, Vector3, number[]>, Color, null>> as Key extends never ? never : Key]: PickIndexSignature<...>[Key]; } & PickIndexSignature<...> & { [Key in keyof OmitIndexSignature<...> as Key extends "id" ? never : Key]: OmitIndexSignature<...>[Key]; } & OmitIndexSignature<...>)]: ({ [Key in keyof PickIndexSignature<ReplaceDeep<ReplaceDeep<ImportData, Vector3, number[]>, Color, null>> as Key extends never ? never : Key]: PickIndexSignature<...>[Key]; } & ... 2 more ... & OmitIndexSignature<...>)[KeyType]; }, Config extends BaseObjectConfig = BaseObjectConfig>.select(params?: {
only?: boolean | undefined;
} | undefined): void
select({ only?: boolean | undefined
only: true })
// 点击后开启编辑功能
item: BuiltInItem
item.editor: PolylineEditor | PointEditor | PolygonEditor | PrismMeshEditor | RectangleMeshEditor | CircleMeshEditor | CylinderMeshEditor | BoxMeshEditor | LineEditor
editor.function enable(): void
enable()
// 物体移动/旋转/缩放时触发
item: BuiltInItem
item.editor: PolylineEditor | PointEditor | PolygonEditor | PrismMeshEditor | RectangleMeshEditor | CircleMeshEditor | CylinderMeshEditor | BoxMeshEditor | LineEditor
editor.BaseEditor<OriginObject extends Object3D = Object3D>.hooks: Subscribe<{
objectUpdate: () => void;
}>
hooks.Subscribe<{ objectUpdate: () => void; }>.on<"objectUpdate">(name: "objectUpdate", callback: () => void, once?: boolean | undefined): () => void
注册事件
on('objectUpdate', () => {
var console: Console
console.Console.log(...data: any[]): void
log('new Data: ', item: BuiltInItem
item.data: {
points: [number, number, number][];
style: {
lineColor: number;
lineWidth: number;
dashed: boolean;
};
id: string;
type: string;
} | {
point: [number, number, number];
style: {
color: number;
size: number;
};
id: string;
type: string;
} | {
points: [number, number, number][];
style: {
color: number;
lineColor: number;
lineWidth: number;
};
id: string;
type: string;
} | {
readonly points: [number, number, number][];
readonly heightPoint: [number, number, number];
readonly style: {
readonly color: number;
readonly lineWidth: number;
readonly lineColor: number;
};
readonly id: string;
readonly type: string;
} | {
points: [number, number, number][];
style: {
color: number;
opacity: number;
lineWidth: number;
lineColor: number;
};
id: string;
type: string;
} | {
center: [number, number, number];
normal: [number, number, number];
radius: number;
style: {
color: number;
};
id: string;
type: string;
} | {
bottomCenter: [number, number, number];
topCenter: [number, number, number];
radius: number;
style: {
color: number;
};
id: string;
type: string;
} | {
points: [number, number, number][];
heightPoint: [number, number, number];
style: {
color: number;
opacity: number;
lineWidth: number;
lineColor: number;
};
id: string;
type: string;
} ...
data)
})
})
点击展示删除按钮
const sculpt: Sculpt
sculpt.Subscribe<Event>.on<"click">(name: "click", callback: (e: MouseEvent, item: BuiltInItem) => false | void, once?: boolean | undefined): () => void
注册事件
on('click', (e: MouseEvent
e, item: BuiltInItem
item) => {
const const x: number
x = e: MouseEvent
e instanceof var TouchEvent: {
new (type: string, eventInitDict?: TouchEventInit | undefined): TouchEvent;
prototype: TouchEvent;
}
An event sent when the state of contacts with a touch-sensitive surface changes. This surface can be a touch screen or trackpad, for example. The event can describe one or more points of contact with the screen and includes support for detecting movement, addition and removal of contact points, and so forth.
TouchEvent ? e: MouseEvent & TouchEvent
e.TouchEvent.touches: TouchList
touches[0].Touch.clientX: number
clientX : e: MouseEvent
e.MouseEvent.clientX: number
clientX
const const y: number
y = e: MouseEvent
e instanceof var TouchEvent: {
new (type: string, eventInitDict?: TouchEventInit | undefined): TouchEvent;
prototype: TouchEvent;
}
An event sent when the state of contacts with a touch-sensitive surface changes. This surface can be a touch screen or trackpad, for example. The event can describe one or more points of contact with the screen and includes support for detecting movement, addition and removal of contact points, and so forth.
TouchEvent ? e: MouseEvent & TouchEvent
e.TouchEvent.touches: TouchList
touches[0].Touch.clientY: number
clientY : e: MouseEvent
e.MouseEvent.clientY: number
clientY
item: BuiltInItem
item.BaseObject<ImportData extends BaseImportData = BaseImportData, ExportData extends BaseExportData = { [KeyType in keyof ({ [Key in keyof PickIndexSignature<ReplaceDeep<ReplaceDeep<ImportData, Vector3, number[]>, Color, null>> as Key extends never ? never : Key]: PickIndexSignature<...>[Key]; } & PickIndexSignature<...> & { [Key in keyof OmitIndexSignature<...> as Key extends "id" ? never : Key]: OmitIndexSignature<...>[Key]; } & OmitIndexSignature<...>)]: ({ [Key in keyof PickIndexSignature<ReplaceDeep<ReplaceDeep<ImportData, Vector3, number[]>, Color, null>> as Key extends never ? never : Key]: PickIndexSignature<...>[Key]; } & ... 2 more ... & OmitIndexSignature<...>)[KeyType]; }, Config extends BaseObjectConfig = BaseObjectConfig>.showDeleteButton(clientX: number, clientY: number): void
showDeleteButton(const x: number
x, const y: number
y)
})
Sculpt API
名词解释
Item
物体的实例,sculpt中的每个物体都是一个Item
。API
目前支持的 Item 种类:ItemType
sculpt.data
const const data: {
items: ({
points: [number, number, number][];
style: {
lineColor: number;
lineWidth: number;
dashed: boolean;
};
id: string;
type: string;
} | {
point: [number, number, number];
style: {
color: number;
size: number;
};
id: string;
type: string;
} | {
points: [number, number, number][];
style: {
color: number;
lineColor: number;
lineWidth: number;
};
id: string;
type: string;
} | {
readonly points: [number, number, number][];
readonly heightPoint: [number, number, number];
readonly style: {
readonly color: number;
readonly lineWidth: number;
readonly lineColor: number;
};
readonly id: string;
readonly type: string;
} | {
center: [number, number, number];
normal: [number, number, number];
radius: number;
style: {
color: number;
};
id: string;
type: string;
} | {
bottomCenter: [number, number, number];
topCenter: [number, number, number];
radius: number;
style: {
color: number;
};
id: string;
type: string;
})[];
}
data = const sculpt: Sculpt
sculpt.Sculpt.data: {
items: ({
points: [number, number, number][];
style: {
lineColor: number;
lineWidth: number;
dashed: boolean;
};
id: string;
type: string;
} | {
point: [number, number, number];
style: {
color: number;
size: number;
};
id: string;
type: string;
} | {
points: [number, number, number][];
style: {
color: number;
lineColor: number;
lineWidth: number;
};
id: string;
type: string;
} | {
readonly points: [number, number, number][];
readonly heightPoint: [number, number, number];
readonly style: {
readonly color: number;
readonly lineWidth: number;
readonly lineColor: number;
};
readonly id: string;
readonly type: string;
} | {
center: [number, number, number];
normal: [number, number, number];
radius: number;
style: {
color: number;
};
id: string;
type: string;
} | {
bottomCenter: [number, number, number];
topCenter: [number, number, number];
radius: number;
style: {
color: number;
};
id: string;
type: string;
})[];
}
data
获取当前场景的全量Item
数据。
sculpt.items
返回值:Item[]
获取当前场景的所有Item
实例。
sculpt.load(data)
加载数据,将数据渲染到场景中。
sculpt.createXXXX()
开始在屏幕上绘制一个物体,通过鼠标的点击,拖拽,键盘快捷键(esc)等操作来完成绘制。
支持的 function:
const sculpt: Sculpt
sculpt.Sculpt.createPoint(params?: Partial<PointStyle> | undefined): Promise<any>
createPoint() // 绘制点
const sculpt: Sculpt
sculpt.Sculpt.createline(params?: Partial<LineColorStyle & LineOpacityStyle & LineWidthStyle & {
dashed?: boolean | undefined;
} & OcclusionStyle & Partial<...> & Partial<...> & CreateLimitConfig> | undefined): Promise<...>
createline() // 绘制线段
const sculpt: Sculpt
sculpt.Sculpt.createPolyline(params?: Partial<LineColorStyle & LineOpacityStyle & LineWidthStyle & {
dashed?: boolean | undefined;
} & OcclusionStyle & Partial<...> & Partial<...> & CreateLimitConfig> | undefined): Promise<...>
createPolyline() // 绘制折线
const sculpt: Sculpt
sculpt.Sculpt.createPolygon(params?: Partial<OpacityStyle & ColorStyle & OcclusionStyle & {
lengthEnable: boolean;
} & CreateLimitConfig> | undefined): Promise<...>
createPolygon() // 绘制多边形
const sculpt: Sculpt
sculpt.Sculpt.createRectangle(config?: Partial<OpacityStyle & ColorStyle & OcclusionStyle & LineColorStyle & LineOpacityStyle & LineWidthStyle & CreateLimitConfig & DrawMethodConfig> | undefined): Promise<...>
createRectangle() // 绘制矩形
const sculpt: Sculpt
sculpt.Sculpt.createCircle(params?: Partial<CircleWithEdgeMeshStyle> | undefined): Promise<any>
createCircle() // 绘制圆
const sculpt: Sculpt
sculpt.Sculpt.createPrism(params?: Partial<PrismStyle> | undefined): Promise<any>
createPrism() // 绘制多棱柱
const sculpt: Sculpt
sculpt.Sculpt.createBox(params?: Partial<OpacityStyle & ColorStyle & OcclusionStyle & LineColorStyle & LineOpacityStyle & LineWidthStyle & CreateLimitConfig & DrawMethodConfig> | undefined): Promise<...>
createBox() // 绘制Box/立方体
const sculpt: Sculpt
sculpt.Sculpt.createCylinder(params?: Partial<CircleStyle> | undefined): Promise<any>
createCylinder() // 绘制圆柱体
sculpt.getItemById(id)
通过id
获取Item
实例。
const const item: BuiltInItem
item = const sculpt: Sculpt
sculpt.Sculpt.getItemById(id: string): BuiltInItem
getItemById('1')
sculpt.clear()
清空场景中的所有物体。
const sculpt: Sculpt
sculpt.Sculpt.clear(): void
clear()
Item API
item.type
返回值: ItemType
返回当前Item
的类型。
item.data
返回当前Item
的数据。
item.setData()
设置当前Item
的数据。参数数据结构:data
item.create()
const item: BuiltInItem
item.function create(arg0?: (Partial<LineColorStyle & LineOpacityStyle & LineWidthStyle & {
dashed?: boolean | undefined;
} & OcclusionStyle & Partial<...> & Partial<...> & CreateLimitConfig> & ... 5 more ... & Partial<...>) | undefined): Promise<...>
create()
开始通过鼠标,键盘等操作绘制Item
item.stopCreating()
const item: BuiltInItem
item.BaseObject<ImportData extends BaseImportData = BaseImportData, ExportData extends BaseExportData = { [KeyType in keyof ({ [Key in keyof PickIndexSignature<ReplaceDeep<ReplaceDeep<ImportData, Vector3, number[]>, Color, null>> as Key extends never ? never : Key]: PickIndexSignature<...>[Key]; } & PickIndexSignature<...> & { [Key in keyof OmitIndexSignature<...> as Key extends "id" ? never : Key]: OmitIndexSignature<...>[Key]; } & OmitIndexSignature<...>)]: ({ [Key in keyof PickIndexSignature<ReplaceDeep<ReplaceDeep<ImportData, Vector3, number[]>, Color, null>> as Key extends never ? never : Key]: PickIndexSignature<...>[Key]; } & ... 2 more ... & OmitIndexSignature<...>)[KeyType]; }, Config extends BaseObjectConfig = BaseObjectConfig>.stopCreating(): void
stopCreating()
退出创建当前Item,等同于esc
快捷键,如果当前Item未完成绘制,会删除当前Item。
item.delete()
const item: BuiltInItem
item.BaseObject<ImportData extends BaseImportData = BaseImportData, ExportData extends BaseExportData = { [KeyType in keyof ({ [Key in keyof PickIndexSignature<ReplaceDeep<ReplaceDeep<ImportData, Vector3, number[]>, Color, null>> as Key extends never ? never : Key]: PickIndexSignature<...>[Key]; } & PickIndexSignature<...> & { [Key in keyof OmitIndexSignature<...> as Key extends "id" ? never : Key]: OmitIndexSignature<...>[Key]; } & OmitIndexSignature<...>)]: ({ [Key in keyof PickIndexSignature<ReplaceDeep<ReplaceDeep<ImportData, Vector3, number[]>, Color, null>> as Key extends never ? never : Key]: PickIndexSignature<...>[Key]; } & ... 2 more ... & OmitIndexSignature<...>)[KeyType]; }, Config extends BaseObjectConfig = BaseObjectConfig>.delete(): void
delete()
删除当前Item
item.on(event)
const item: BuiltInItem
item.BaseObject<ImportData extends BaseImportData = BaseImportData, ExportData extends BaseExportData = { [KeyType in keyof ({ [Key in keyof PickIndexSignature<ReplaceDeep<ReplaceDeep<ImportData, Vector3, number[]>, Color, null>> as Key extends never ? never : Key]: PickIndexSignature<...>[Key]; } & PickIndexSignature<...> & { [Key in keyof OmitIndexSignature<...> as Key extends "id" ? never : Key]: OmitIndexSignature<...>[Key]; } & OmitIndexSignature<...>)]: ({ [Key in keyof PickIndexSignature<ReplaceDeep<ReplaceDeep<ImportData, Vector3, number[]>, Color, null>> as Key extends never ? never : Key]: PickIndexSignature<...>[Key]; } & ... 2 more ... & OmitIndexSignature<...>)[KeyType]; }, Config extends BaseObjectConfig = BaseObjectConfig>.on: <keyof FiveDomEventMap>(event: keyof FiveDomEventMap, callback: ((event: FiveDomEvent) => boolean | void) | ((event: FiveDomEvent) => void) | ... 6 more ... | ((event: FiveDomEvent) => void), config?: EventHandlerConfig | undefined) => void
on('- click
- dblclick
- mousedown
- mouseup
- hover
- unHover
- dragstart
- drag
- dragend
')
interface FiveDomEvent {
FiveDomEvent.type: keyof FiveDomEventMap
type: type EventName = keyof FiveDomEventMap
EventName
FiveDomEvent.target: THREE.Object3D
target: import THREE
THREE.class Object3D
Base class for scene graph objects
Object3D
FiveDomEvent.origDomEvent?: Event | undefined
origDomEvent?: Event
FiveDomEvent.raycaster: THREE.Raycaster
raycaster: import THREE
THREE.class Raycaster
Raycaster
FiveDomEvent.intersects?: THREE.Intersection[] | undefined
intersects?: import THREE
THREE.Intersection[]
FiveDomEvent.stopPropagation: () => void
stopPropagation: () => void
}
interface FiveDomEventMap {
/**
* @description 点击事件
* @return {PreventFiveEvent} 返回 false 可以不阻止 five 的 tap 事件; default: true
*/
FiveDomEventMap.click: (event: FiveDomEvent) => PreventFiveEvent | void
click: (event: FiveDomEvent
event: FiveDomEvent) => type PreventFiveEvent = boolean
PreventFiveEvent | void
/**
* @description 双击事件
*/
FiveDomEventMap.dblclick: (event: FiveDomEvent) => void
dblclick: (event: FiveDomEvent
event: FiveDomEvent) => void
/**
* @description 鼠标按下事件
*/
FiveDomEventMap.mousedown: (event: FiveDomEvent) => void
mousedown: (event: FiveDomEvent
event: FiveDomEvent) => void
/**
* @description 鼠标抬起事件
*/
FiveDomEventMap.mouseup: (event: FiveDomEvent) => void
mouseup: (event: FiveDomEvent
event: FiveDomEvent) => void
/**
* @description 鼠标移入事件
*/
FiveDomEventMap.hover: (event: FiveDomEvent) => void
hover: (event: FiveDomEvent
event: FiveDomEvent) => void
/**
* @description 鼠标移出事件
*/
FiveDomEventMap.unHover: (event: FiveDomEvent) => void
unHover: (event: FiveDomEvent
event: FiveDomEvent) => void
/**
* @description: 拖动开始
*/
FiveDomEventMap.dragstart: (event: FiveDomEvent) => void
dragstart: (event: FiveDomEvent
event: FiveDomEvent) => void
/**
* @description: 拖动中
*/
FiveDomEventMap.drag: (event: FiveDomEvent) => void
drag: (event: FiveDomEvent
event: FiveDomEvent) => void
/**
* @description: 拖动结束
*/
FiveDomEventMap.dragend: (event: FiveDomEvent) => void
dragend: (event: FiveDomEvent
event: FiveDomEvent) => void
}
Reference
ItemType
type type ItemType = "Point" | "Polyline" | "Polygon" | "Rectangle" | "Circle" | "Prism" | "Box"
ItemType =
| 'Point' // 点
| 'Polyline' // 线段/折线
| 'Polygon' // 多边形
| 'Rectangle' // 矩形
| 'Circle' // 圆
| 'Prism' // box
| 'Box' // Box/立方box | 'Cylinder' // 圆柱体
data
将鼠标hover到相应data上查看类型。
import { SculptData } from "@realsee/dnalogel"
/**
* point: 三维空间点坐标
*/
type type PointData = {
type: LiteralString<"Point">;
style?: {
color?: Color | undefined;
size?: number | undefined;
occlusionVisibility?: boolean | undefined;
occlusionMode?: "translucence" | "depthTest" | undefined;
tip?: string | undefined;
} | undefined;
id?: string | undefined;
point: Vector3 | number[] | {
x?: number | undefined;
y?: number | undefined;
z?: number | undefined;
};
}
point: 三维空间点坐标
PointData = SculptData.type SculptData.PointData = {
type: LiteralString<"Point">;
style?: {
color?: Color | undefined;
size?: number | undefined;
occlusionVisibility?: boolean | undefined;
occlusionMode?: "translucence" | "depthTest" | undefined;
tip?: string | undefined;
} | undefined;
id?: string | undefined;
point: Vector3 | number[] | {
x?: number | undefined;
y?: number | undefined;
z?: number | undefined;
};
}
PointData
/**
* points: 折线的点坐标集合
*/
type type PolylineData = {
type: LiteralString<"Polyline">;
style?: {
lineColor?: Color | undefined;
lineOpacity?: number | undefined;
lineWidth?: number | undefined;
dashed?: boolean | undefined;
occlusionVisibility?: boolean | undefined;
occlusionMode?: "translucence" | "depthTest" | undefined;
lengthEnable?: boolean | undefined;
tip?: string | undefined;
} | undefined;
id?: string | undefined;
points: AnyPosition[];
}
points: 折线的点坐标集合
PolylineData = SculptData.type SculptData.PolylineData = {
type: LiteralString<"Polyline">;
style?: {
lineColor?: Color | undefined;
lineOpacity?: number | undefined;
lineWidth?: number | undefined;
dashed?: boolean | undefined;
occlusionVisibility?: boolean | undefined;
occlusionMode?: "translucence" | "depthTest" | undefined;
lengthEnable?: boolean | undefined;
tip?: string | undefined;
} | undefined;
id?: string | undefined;
points: AnyPosition[];
}
PolylineData
/**
* points: 多边形的顶点坐标集合
*/
type type PolygonData = {
type: LiteralString<"Polygon">;
style?: {
opacity?: number | undefined;
color?: Color | undefined;
occlusionVisibility?: boolean | undefined;
occlusionMode?: "translucence" | "depthTest" | undefined;
lineColor?: Color | undefined;
lineOpacity?: number | undefined;
lineWidth?: number | undefined;
} | undefined;
id?: string | undefined;
points: AnyPosition[];
}
points: 多边形的顶点坐标集合
PolygonData = SculptData.type SculptData.PolygonData = {
type: LiteralString<"Polygon">;
style?: {
opacity?: number | undefined;
color?: Color | undefined;
occlusionVisibility?: boolean | undefined;
occlusionMode?: "translucence" | "depthTest" | undefined;
lineColor?: Color | undefined;
lineOpacity?: number | undefined;
lineWidth?: number | undefined;
} | undefined;
id?: string | undefined;
points: AnyPosition[];
}
PolygonData
/**
* points: 矩形的四个顶点坐标集合
*/
type type RectangleData = {
type: LiteralString<"Rectangle">;
style?: {
opacity?: number | undefined;
color?: Color | undefined;
occlusionVisibility?: boolean | undefined;
occlusionMode?: "translucence" | "depthTest" | undefined;
lineColor?: Color | undefined;
lineOpacity?: number | undefined;
lineWidth?: number | undefined;
} | undefined;
id?: string | undefined;
points: AnyPosition[];
}
points: 矩形的四个顶点坐标集合
RectangleData = SculptData.type SculptData.RectangleData = {
type: LiteralString<"Rectangle">;
style?: {
opacity?: number | undefined;
color?: Color | undefined;
occlusionVisibility?: boolean | undefined;
occlusionMode?: "translucence" | "depthTest" | undefined;
lineColor?: Color | undefined;
lineOpacity?: number | undefined;
lineWidth?: number | undefined;
} | undefined;
id?: string | undefined;
points: AnyPosition[];
}
RectangleData
/**
* center: 圆心坐标
* normal: 圆的法向量
* radius: 圆的半径
*/
type type CircleData = {
type: LiteralString<"Circle">;
style?: {
opacity?: number | undefined;
color?: Color | undefined;
occlusionVisibility?: boolean | undefined;
occlusionMode?: "translucence" | "depthTest" | undefined;
lineColor?: Color | undefined;
lineOpacity?: number | undefined;
lineWidth?: number | undefined;
} | undefined;
id?: string | undefined;
center: Vector3 | number[] | {
x?: number | undefined;
y?: number | undefined;
z?: number | undefined;
};
normal: Vector3 | number[] | {
x?: number | undefined;
y?: number | undefined;
z?: number | undefined;
};
radius: number;
}
center: 圆心坐标
normal: 圆的法向量
radius: 圆的半径
CircleData = SculptData.type SculptData.CircleData = {
type: LiteralString<"Circle">;
style?: {
opacity?: number | undefined;
color?: Color | undefined;
occlusionVisibility?: boolean | undefined;
occlusionMode?: "translucence" | "depthTest" | undefined;
lineColor?: Color | undefined;
lineOpacity?: number | undefined;
lineWidth?: number | undefined;
} | undefined;
id?: string | undefined;
center: Vector3 | number[] | {
x?: number | undefined;
y?: number | undefined;
z?: number | undefined;
};
normal: Vector3 | number[] | {
x?: number | undefined;
y?: number | undefined;
z?: number | undefined;
};
radius: number;
}
CircleData
/**
* points: 多棱柱的底面顶点坐标集合
* heightPoint: 多棱柱的底面的第一个点对应的上表面的点的坐标
*/
type type PrismData = {
type: LiteralString<"Prism">;
style?: {
opacity?: number | undefined;
color?: Color | undefined;
occlusionVisibility?: boolean | undefined;
occlusionMode?: "translucence" | "depthTest" | undefined;
lineColor?: Color | undefined;
lineOpacity?: number | undefined;
lineWidth?: number | undefined;
} | undefined;
id?: string | undefined;
heightPoint: Vector3 | number[] | {
x?: number | undefined;
y?: number | undefined;
z?: number | undefined;
};
points: AnyPosition[];
}
points: 多棱柱的底面顶点坐标集合
heightPoint: 多棱柱的底面的第一个点对应的上表面的点的坐标
PrismData = SculptData.type SculptData.PrismData = {
type: LiteralString<"Prism">;
style?: {
opacity?: number | undefined;
color?: Color | undefined;
occlusionVisibility?: boolean | undefined;
occlusionMode?: "translucence" | "depthTest" | undefined;
lineColor?: Color | undefined;
lineOpacity?: number | undefined;
lineWidth?: number | undefined;
} | undefined;
id?: string | undefined;
heightPoint: Vector3 | number[] | {
x?: number | undefined;
y?: number | undefined;
z?: number | undefined;
};
points: AnyPosition[];
}
PrismData
/**
* points: box 的底面顶点坐标集合
* heightPoint: box 的底面的第一个点对应的上表面的点的坐标
*/
type type BoxData = {
type: LiteralString<"Box">;
style?: {
opacity?: number | undefined;
color?: Color | undefined;
occlusionVisibility?: boolean | undefined;
occlusionMode?: "translucence" | "depthTest" | undefined;
lineColor?: Color | undefined;
lineOpacity?: number | undefined;
lineWidth?: number | undefined;
} | undefined;
id?: string | undefined;
points: AnyPosition[];
heightPoint: Vector3 | number[] | {
x?: number | undefined;
y?: number | undefined;
z?: number | undefined;
};
}
points: box 的底面顶点坐标集合
heightPoint: box 的底面的第一个点对应的上表面的点的坐标
BoxData = SculptData.type SculptData.BoxData = {
type: LiteralString<"Box">;
style?: {
opacity?: number | undefined;
color?: Color | undefined;
occlusionVisibility?: boolean | undefined;
occlusionMode?: "translucence" | "depthTest" | undefined;
lineColor?: Color | undefined;
lineOpacity?: number | undefined;
lineWidth?: number | undefined;
} | undefined;
id?: string | undefined;
points: AnyPosition[];
heightPoint: Vector3 | number[] | {
x?: number | undefined;
y?: number | undefined;
z?: number | undefined;
};
}
BoxData
/**
* bottomCenter: 圆柱体底面中心点坐标
* topCenter: 圆柱体顶面中心点坐标
* radius: 圆柱体半径
*/
type type CylinderData = {
type: LiteralString<"Cylinder">;
style?: {
opacity?: number | undefined;
color?: Color | undefined;
occlusionVisibility?: boolean | undefined;
occlusionMode?: "translucence" | "depthTest" | undefined;
} | undefined;
id?: string | undefined;
bottomCenter: Vector3 | number[] | {
x?: number | undefined;
y?: number | undefined;
z?: number | undefined;
};
topCenter: Vector3 | number[] | {
x?: number | undefined;
y?: number | undefined;
z?: number | undefined;
};
radius: number;
}
bottomCenter: 圆柱体底面中心点坐标
topCenter: 圆柱体顶面中心点坐标
radius: 圆柱体半径
CylinderData = SculptData.type SculptData.CylinderData = {
type: LiteralString<"Cylinder">;
style?: {
opacity?: number | undefined;
color?: Color | undefined;
occlusionVisibility?: boolean | undefined;
occlusionMode?: "translucence" | "depthTest" | undefined;
} | undefined;
id?: string | undefined;
bottomCenter: Vector3 | number[] | {
x?: number | undefined;
y?: number | undefined;
z?: number | undefined;
};
topCenter: Vector3 | number[] | {
x?: number | undefined;
y?: number | undefined;
z?: number | undefined;
};
radius: number;
}
CylinderData