Skip to content

Commit

Permalink
[Reviewed] [Mouse pointer lock] Fix an error when used with Safari on…
Browse files Browse the repository at this point in the history
… iOS (#1149)

- Avoid errors when running the "Request Pointer Lock" and "Exit pointer lock" actions in Safari on iOS.
- Thanks @PANDAKO-GitHub
  • Loading branch information
PANDAKO-GitHub authored Jan 27, 2024
1 parent c1f7a41 commit 2611877
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions extensions/reviewed/MousePointerLock.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"name": "MousePointerLock",
"previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Virtual Reality/Virtual Reality_360_rotate_vr_movement.svg",
"shortDescription": "This behavior removes the limit on the distance the mouse can move and hides the cursor.",
"version": "0.1.5",
"version": "0.1.6",
"description": [
"This behavior removes the limit on the distance the mouse can move and hides the cursor.",
"",
Expand Down Expand Up @@ -133,7 +133,9 @@
"type": "BuiltinCommonInstructions::JsCode",
"inlineCode": [
"const canvas = runtimeScene.getGame().getRenderer().getCanvas();\r",
"canvas.requestPointerLock({ unadjustedMovement: true });"
"if (canvas.requestPointerLock) {\r",
" canvas.requestPointerLock({ unadjustedMovement: true });\r",
"}"
],
"parameterObjects": "",
"useStrict": true,
Expand All @@ -152,7 +154,11 @@
"events": [
{
"type": "BuiltinCommonInstructions::JsCode",
"inlineCode": "document.exitPointerLock();",
"inlineCode": [
"if (document.exitPointerLock) {\r",
" document.exitPointerLock();\r",
"}"
],
"parameterObjects": "",
"useStrict": true,
"eventsSheetExpanded": false
Expand Down

0 comments on commit 2611877

Please sign in to comment.