diff --git a/extensions/reviewed/MousePointerLock.json b/extensions/reviewed/MousePointerLock.json index 3664e8f38..614c0b5af 100644 --- a/extensions/reviewed/MousePointerLock.json +++ b/extensions/reviewed/MousePointerLock.json @@ -5,22 +5,23 @@ "fullName": "Mouse Pointer Lock", "gdevelopVersion": ">=5.5.222", "helpPath": "", - "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPHBvbHlsaW5lIGNsYXNzPSJzdDAiIHBvaW50cz0iMTksMTkgMjQsMTkgMjQsMjQgIi8+DQo8cG9seWxpbmUgY2xhc3M9InN0MCIgcG9pbnRzPSI2LDIzIDExLDIzIDExLDE4ICIvPg0KPHBhdGggY2xhc3M9InN0MCIgZD0iTTI0LDE5LjRjLTAuNywwLjgtMS40LDE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3LjcxTDEyLjgyLDExSDIwTTEzLDEuMDdDMTYuOTQsMS41NiAyMCw0LjkyIDIwLDlIMTNWMS4wN1oiIC8+PC9zdmc+", "name": "MousePointerLock", - "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Virtual Reality/Virtual Reality_360_rotate_vr_movement.svg", + "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/bf57ae5af72c737a3f82500fbf783ee148def4528a340e49a5293f56656f76b4_mouse-off.svg", "shortDescription": "This behavior removes the limit on the distance the mouse can move and hides the cursor.", - "version": "0.3.0", + "version": "1.0.0", "description": [ "This behavior removes the limit on the distance the mouse can move and hides the cursor.", "", - "For example, a user can rotate or continue to manipulate an object by moving the mouse endlessly ([open the project online](https://editor.gdevelop.io/?project=example://mouse-pointer-lock)).", + "For example, a user can rotate or continue to manipulate an object by moving the mouse endlessly.", "Without the pointer lock, the rotation or operation will stop the moment the pointer reaches the edge of the browser or screen.", "", "Game players don't have to worry about leaving the gameplay area or accidentally clicking on another application that moves the mouse focus away from the game.", "", "Locking the pointer locks `CursorX()` and `CursorY()` expressions.", "Use `MovementX()` and `MovementY()` instead.", - "" + "", + "(The escape key unlocking the mouse cursor for 1/2 seconds is hard-coded into the engine)." ], "origin": { "identifier": "MousePointerLock", @@ -34,7 +35,8 @@ ], "authorIds": [ "Zu55H5hcb9YmZTltIVOTAFDJQyB2", - "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" + "IWykYNRvhCZBN3vEgKEbBPOR3Oc2", + "Ot5P8FVsBmZDuNuLovuFxtsnCFj1" ], "dependencies": [], "globalVariables": [], @@ -78,7 +80,6 @@ " * @type {gdjs.RuntimeGame}", " */", " game;", - "", " /**", " * @param {gdjs.RuntimeGame} game", " */", @@ -99,8 +100,23 @@ " this.retried = true;", " }", " });", + "", + " document.addEventListener(\"pointerlockchange\", () => {", + " if (!document.pointerLockElement) {", + " this.onPointerLockExit();", + " }", + " });", " }", "", + " onPointerLockExit() {", + " this.resetMovement();", + " const inputManager = this.game.getInputManager();", + " if (!inputManager) return;", + " if (inputManager._pressedKeys) {", + " inputManager._pressedKeys.clear();", + " }", + "}", + "", " requestPointerLock() {", " const canvas = this.game.getRenderer().getCanvas();", " if (canvas.requestPointerLock && !document.pointerLockElement) {", @@ -124,9 +140,7 @@ " this.movementY = 0;", " }", "};", - "", - "gdjs._MousePointerLockExtension = { handler: new PointerLockHandler(runtimeScene.getGame()) };", - "" + "gdjs._MousePointerLockExtension = { handler: new PointerLockHandler(runtimeScene.getGame()) };" ], "parameterObjects": "", "useStrict": true, @@ -1467,7 +1481,32 @@ "name": "ShouldLock" } ], - "sharedPropertyDescriptors": [] + "propertiesFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "propertyName": "Object3D" + }, + { + "propertyName": "HorizontalSpeed" + }, + { + "propertyName": "VerticalSpeed" + }, + { + "propertyName": "VerticalAngleMin" + }, + { + "propertyName": "VerticalAngleMax" + }, + { + "propertyName": "OffsetZ" + }, + { + "propertyName": "ShouldLock" + } + ] + } } ], "eventsBasedObjects": []