Skip to content

Commit

Permalink
fix: Camera movement when duplicating entities with hotkey
Browse files Browse the repository at this point in the history
  • Loading branch information
cyaiox committed Jan 31, 2024
1 parent b64684c commit 4d53180
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/@dcl/inspector/src/components/Renderer/Renderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,14 @@ const Renderer: React.FC = () => {

const duplicateSelectedEntities = useCallback(() => {
if (!sdk) return
const camera = sdk.scene.activeCamera!
camera.detachControl()
const selectedEntitites = sdk.sceneContext.operations.getSelectedEntities()
selectedEntitites.forEach((entity) => sdk.sceneContext.operations.duplicateEntity(entity))
void sdk.sceneContext.operations.dispatch()
setTimeout(() => {
camera.attachControl(canvasRef.current, true)
}, 100)
}, [sdk])

const copySelectedEntities = useCallback(() => {
Expand Down

0 comments on commit 4d53180

Please sign in to comment.