diff --git a/docs/guide/controls/pointer-lock-controls.md b/docs/guide/controls/pointer-lock-controls.md
index 102ac5a3..354cb64e 100644
--- a/docs/guide/controls/pointer-lock-controls.md
+++ b/docs/guide/controls/pointer-lock-controls.md
@@ -50,19 +50,13 @@ Additional we can detect if the controls has been active or not in a reactive wa
```vue{3}
-
+ isActive(state)" />
diff --git a/playground/src/pages/FirstPersonControlsDemo.vue b/playground/src/pages/FirstPersonControlsDemo.vue
index e7ca8f8b..6467dd39 100644
--- a/playground/src/pages/FirstPersonControlsDemo.vue
+++ b/playground/src/pages/FirstPersonControlsDemo.vue
@@ -17,17 +17,14 @@ const gl = {
shadowMapType: BasicShadowMap,
toneMapping: NoToneMapping,
}
-const isLock = ref(false)
-watchEffect(() => {
- console.log('jaime ~ isLock:', isLock.value)
-})
+const isActive = (state: boolean) => console.log(state)
-
+ isActive(state)" />
diff --git a/src/core/controls/PointerLockControls.vue b/src/core/controls/PointerLockControls.vue
index f4e79e9d..cada8fcd 100644
--- a/src/core/controls/PointerLockControls.vue
+++ b/src/core/controls/PointerLockControls.vue
@@ -53,10 +53,10 @@ let triggerSelector: HTMLElement | undefined
extend({ PointerLockControls })
-const emit = defineEmits(['update:modelValue'])
+const emit = defineEmits(['isLock'])
-const isLockEvent = (event: boolean) => {
- emit('update:modelValue', event)
+const isLockEmitter = (event: boolean) => {
+ emit('isLock', event)
}
watch(controls, value => {
@@ -69,14 +69,14 @@ watch(controls, value => {
triggerSelector = selector ? selector : state.renderer?.domElement
useEventListener(triggerSelector, 'click', () => {
controls.value?.lock()
- controls.value?.addEventListener('lock', () => isLockEvent(true))
- controls.value?.addEventListener('unlock', () => isLockEvent(false))
+ controls.value?.addEventListener('lock', () => isLockEmitter(true))
+ controls.value?.addEventListener('unlock', () => isLockEmitter(false))
})
})
onUnmounted(() => {
- controls.value?.removeEventListener('lock', () => isLockEvent(true))
- controls.value?.removeEventListener('unlock', () => isLockEvent(false))
+ controls.value?.removeEventListener('lock', () => isLockEmitter(true))
+ controls.value?.removeEventListener('unlock', () => isLockEmitter(false))
})
defineExpose({ value: controls })