diff --git a/packages/playground/src/tests/in-iframe/index.tsx b/packages/playground/src/tests/in-iframe/index.tsx
deleted file mode 100644
index dbfb621..0000000
--- a/packages/playground/src/tests/in-iframe/index.tsx
+++ /dev/null
@@ -1,11 +0,0 @@
-import React from 'react'
-import ReactDOM from 'react-dom'
-
-ReactDOM.render(
- ,
- document.getElementById('root'),
-)
diff --git a/theatre/studio/src/uiComponents/useDrag.ts b/theatre/studio/src/uiComponents/useDrag.ts
index 9ec3426..ad7ad53 100644
--- a/theatre/studio/src/uiComponents/useDrag.ts
+++ b/theatre/studio/src/uiComponents/useDrag.ts
@@ -151,24 +151,6 @@ type IUseDragStateDetection_Detected = {
dragEventCount: number
}
-// pointer lock may not have been accepted, because we might be in an iframe which disallows pointer locking
-let isPointerLockAllowed = !isSafari
-function requestPointerLockSafely(target: Element): Promise {
- if (!isPointerLockAllowed) return Promise.resolve(false)
- try {
- // Checking introduced with https://linear.app/theatre/issue/P-199/dont-use-pointer-lock-when-in-an-iframe
- return Promise.resolve(target.requestPointerLock())
- .then(() => true)
- .catch(() => {
- isPointerLockAllowed = false
- return false
- })
- } catch (_err) {
- isPointerLockAllowed = false
- return Promise.resolve(false)
- }
-}
-
export default function useDrag(
target: HTMLElement | SVGElement | undefined | null,
opts: UseDragOpts,
@@ -180,7 +162,7 @@ export default function useDrag(
* Safari has a gross behavior with locking the pointer changes the height of the webpage
* See {@link UseDragOpts.shouldPointerLock} for more context.
*/
- const isPointerLockUsed = opts.shouldPointerLock && isPointerLockAllowed
+ const isPointerLockUsed = opts.shouldPointerLock && !isSafari
const stateRef = useRef({
domDragStarted: false,
@@ -224,7 +206,7 @@ export default function useDrag(
DRAG_DETECTION_DISTANCE_THRESHOLD
) {
if (isPointerLockUsed) {
- requestPointerLockSafely(target)
+ target.requestPointerLock()
}
stateStarted.detection = {
@@ -266,9 +248,7 @@ export default function useDrag(
if (!stateRef.current.domDragStarted) return
const dragHappened = stateRef.current.detection.detected
stateRef.current = {domDragStarted: false}
- if (isPointerLockUsed && document.pointerLockElement === target) {
- document.exitPointerLock()
- }
+ if (opts.shouldPointerLock && !isSafari) document.exitPointerLock()
callbacksRef.current.onDragEnd(dragHappened)
// ensure that the window is focused after a successful drag