Selection
选中物体需要记录 “类型” 和 “ID” 两个属性
▸ clear(type: ): any
清空一个类型的所有选中元素
如果有元素被取消选中,会发送 selection:unselect 广播消息
请求参数
hover
▸ hover(type: string
, uuid?: string
): any
悬停触碰了某个元素
会发出 selection:hover 的广播消息
请求参数
Name | Type | Description |
---|---|---|
type | string | 选中的类型 |
uuid? | string | 元素的 uuid |
Editor.Selection.hover('asset', '7bf9df40-4bc9-4e25-8cb0-9a500f949102');
选中一个或者一组元素
当没有选中的元素变成选中状态时,会发出 selection:select 的广播消息
请求参数
unselect
▸ unselect(type: string
, uuid:string
| string[]
): any
取消一个或者一组元素的选中状态
当元素被取消选中的时候,会发送 selection:unslect 广播消息
请求参数
Name | Type | Description |
---|---|---|
type | string | 选中的类型 |
uuid | string</td><td>string[] | 元素的 uuid |
▸ getSelected(type: string
): string[]
获取一个类型选中的所有元素数组
返回结果
string[]
getLastSelected
▸ getLastSelected(type: string
): string
获取某个类型内,最后选中的元素
请求参数
Name | Type | Description |
---|---|---|
type | string | 选中的类型 |
返回结果
string
const elem = Editor.Selection.getLastSelected('asset'); // "b0a4abb1-db32-49c3-9e09-a45b922a2024"
▸ getLastSelectedType(): string
获取最后选中的元素的类型
string