Skip to content

Commit 994f665

Browse files
committed
update left/right click button behaviour on renderer
1 parent a58a334 commit 994f665

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { IEngine, LastWriteWinElementSetComponentDefinition } from '@dcl/ecs'
2+
3+
import { EditorComponentNames, EditorComponentsTypes } from '../../../../sdk/components'
4+
import { GizmoType } from '../../../../utils/gizmo'
5+
6+
export function selectSceneEntity(engine: IEngine) {
7+
const Selection = engine.getComponentOrNull(
8+
EditorComponentNames.Selection
9+
) as LastWriteWinElementSetComponentDefinition<EditorComponentsTypes['Selection']> | null
10+
11+
if (Selection) {
12+
for (const [entity] of engine.getEntitiesWith(Selection)) {
13+
Selection.deleteFrom(entity)
14+
}
15+
16+
function system() {
17+
engine.removeSystem(system)
18+
Selection!.createOrReplace(engine.RootEntity, { gizmo: GizmoType.FREE })
19+
}
20+
21+
engine.addSystem(system)
22+
}
23+
}

0 commit comments

Comments
 (0)