Commit graph

758 commits

Author SHA1 Message Date
Hua
3b47221d25 Fix input-event bug in nested container 2019-11-06 15:51:01 +08:00
Seth Berrier
174dcfdada Fixes for drawing of hitboxes in input.debug
- Offset hitboxes now draw properly when debug enabled for all shapes
- Addresses issue #4722
2019-10-28 09:43:25 -05:00
Seth Berrier
7b711bd11b Fixes for malfunctioning Drag Threshold properties
- According to issue #4667 drag thresholds have been broken since 3.18
- Changed processDragMove event to check thresholds if set
- Fixed use of '||' when it should be '&&' for skipping threshold checks
- Adding missing 'time' parameter when calling threshold check function
2019-10-25 14:03:43 -05:00
Richard Davey
c60530eedd Removed commented-out code 2019-10-11 18:35:27 +01:00
Richard Davey
be15a59093 Your guess is as good as mine \o/~? 2019-10-11 18:19:25 +01:00
Richard Davey
c1044379f3 TouchManager.disableContextMenu is a new method that will try to disable the context menu on touch devices, if the Game Config disableContextMenu is set. Previously, it only tried to do it for the Mouse Manager, but now does it for touch as well. Fix #4778 2019-10-11 13:42:33 +01:00
Richard Davey
4e8ab3dcae MouseManager.target can now be defined as either a string or by passing an HTMLElement directly. Fix #4353 2019-10-02 13:39:42 +01:00
Richard Davey
4be4ba4823
Merge pull request #4707 from MatthewAlner/Bug#4706-ignored-attempt-to-cancel-a-touchstart
Bug#4706 add `event.cancelable` check
2019-09-26 12:09:06 +01:00
Richard Davey
d875a59958 InteractiveObject.alwaysEnabled is a new boolean that allows an interactive Game Object to always receive input events, even if it's invisible or won't render. 2019-09-24 12:36:28 +01:00
Richard Davey
9f8e9d2afc InputPlugin.processDragMove has been updated so that the resulting dragX and dragY values, sent to the event handler, now compensate for the scale of the Game Objects parent container, if inside of one. This means dragging a child of a scale Container will now still drag at 'full' speed. 2019-09-16 15:47:18 +01:00
Matthew Alner
4b42bc426b Bug#4706 add event.cancelable check 2019-08-11 12:46:28 +01:00
Richard Davey
f872b1ece9 Updated docs 2019-08-07 12:20:17 +01:00
Richard Davey
5dd75b64fc Pointer.updateWorldPoint is a new method that takes a Camera and then updates the Pointers worldX and worldY values based on the cameras transform 2019-08-07 12:10:50 +01:00
Richard Davey
08c09b539d Added enableDebug and removeDebug from the Input Plugin, allowing you to create debug shapes to test where input hit areas are. 2019-07-19 15:16:10 +01:00
Richard Davey
aceecf0b95 InputManager.resetCursor will now check if the canvas element still exists before resetting the cursor on it. Fix #4662 2019-07-19 14:32:07 +01:00
Richard Davey
131bf336ee Update Pointers every frame, if not already updated. 2019-07-08 14:59:19 +01:00
Richard Davey
84522136d0 We can now use the locked property and don't need to add to the movement values every frame. Fix #4611 2019-07-08 14:59:06 +01:00
Richard Davey
af37728e31 Added onPointerLockChange handler. 2019-07-08 13:29:50 +01:00
Richard Davey
254f3843e5 Added locked property. 2019-07-08 13:29:39 +01:00
Richard Davey
c7e2fbb31c Calling input.mouse.requestPointerLock() will no longer throw an error about being unable to push to the Input Manager events queue. #4611 2019-07-08 13:27:46 +01:00
Richard Davey
14a6864f21 If you called Scene.destroy within a Game Object pointerdown or pointerup handler, it would cause the error "Cannot read property 'game' of null" if the event wasn't cancelled in your handler. It now checks if the manager is still there before accessing its property. Fix #4436 2019-06-27 01:13:27 +01:00
Richard Davey
839e298c4e Pointer.getDuration would return a negative / static value on desktop, or NaN on mobile, because the base time wasn't being pulled in from the Input Manager properly. Fix #4612 2019-06-24 10:58:44 +01:00
Rex
16a038674f Set customHitArea to false if shape is not defined
In setHitArea method, use setHitAreaFromTexture if shape is undefined. Suppose that it is not a case of `customHitArea`
2019-06-22 09:37:49 +08:00
Richard Davey
6004237d37 Get the correct time value 2019-06-20 09:58:59 +01:00
Richard Davey
8837cb3fd1 JSDocs fix 2019-06-20 09:58:48 +01:00
Richard Davey
8fe4b37a94 JSDoc fix 2019-06-19 15:52:08 +01:00
Richard Davey
1676f22360 Automatically handle the drag values in rotated containers 2019-06-19 10:41:48 +01:00
Richard Davey
4a91b1e560 Added dragStartXGlobal and dragStartYGlobal properties 2019-06-19 10:41:26 +01:00
Richard Davey
0791ae10d2 Added button property and methods for leftButtonReleased, rightButtonReleased and so on. 2019-06-12 11:19:00 +01:00
Richard Davey
9327351e86 Added deltaX, Y, Z and wheel method. 2019-06-05 15:31:25 +01:00
Richard Davey
98be6adfda Native support for wheel events 2019-06-05 15:31:13 +01:00
Richard Davey
62cb5c68a8 Added 3 new Wheel input events 2019-06-05 15:30:54 +01:00
Richard Davey
700c9daaa1 New input const (and changed order to be numeric order) 2019-06-05 15:30:42 +01:00
Richard Davey
af3efc9e2f Added more docs to make #4575 clearer 2019-06-05 14:08:01 +01:00
Richard Davey
4ed0f90bf7 Merged touch handler methods into one 2019-06-04 18:54:35 +01:00
Richard Davey
befbc788a3 Added new TouchCancelWindow handler 2019-06-04 18:54:00 +01:00
Richard Davey
15654be545 update motion automatically 2019-06-04 18:53:48 +01:00
Richard Davey
7f2feea4ae All the touch handlers now store the full TouchEvent, not just the Touch List entry 2019-06-04 15:46:16 +01:00
Richard Davey
bf48c53103 Added new over and out handlers for touch events 2019-06-04 15:43:02 +01:00
Richard Davey
9b93ad9985 Removed changed pointers IIFE and un-needed method methods 2019-06-04 15:40:05 +01:00
Richard Davey
78d15b0b0f Fixed arguments 2019-05-28 21:41:04 +01:00
Richard Davey
3c52a3b27a Pass the pointers array in directly, no need to iterate them all every time 2019-05-28 21:31:54 +01:00
Richard Davey
d87cb43a7f Removed touch limit on over/out 2019-05-28 17:26:31 +01:00
Richard Davey
e12002bf74 Use a switch instead 2019-05-28 17:21:40 +01:00
Richard Davey
520e2e621f Catch poll zero 2019-05-28 17:08:30 +01:00
Richard Davey
95f69bbd9e Split the drag method up into different parts, removed un-used properties and tided up the loop 2019-05-28 16:58:52 +01:00
Richard Davey
7142319f24 Removed un-used methods and properties 2019-05-28 16:58:31 +01:00
Richard Davey
094541d968 Removed dirty and just properties as no longer required, also removed reset method 2019-05-28 16:57:08 +01:00
Richard Davey
961e858cbf Working through making the Input system DOM responsive and not reliant on the game step 2019-05-24 19:30:13 +01:00
Richard Davey
9a2b8b966d Use getFrame 2019-05-24 15:28:38 +01:00
Richard Davey
7073f39a19 Removed all of the DOM Callbacks, input queue and legacy input handling. Renamed methods from 'queue' to 'on' and tidied up internal content 2019-05-23 17:19:30 +01:00
Richard Davey
1d1c4e6543 Removed all input queue elements 2019-05-23 17:19:03 +01:00
Richard Davey
186887c920 Added lastAction property and self-invoke the reset method 2019-05-23 17:18:49 +01:00
Richard Davey
81c1ced2c1 Event Managers now have clearer handlers that check enabled directly 2019-05-23 17:18:16 +01:00
Richard Davey
c91ed91ce3 License link update 2019-05-10 16:15:04 +01:00
Richard Davey
1dca2c2c8a Scenes Types 2019-05-09 12:37:37 +01:00
Richard Davey
53ac066d25 More Input Types 2019-05-09 12:03:36 +01:00
Richard Davey
290389c4ae Input Types 2019-05-09 12:02:03 +01:00
Richard Davey
95eb4fc03d Setting pixelPerfect when input enabling a Container would cause it to crash, because Container's don't have a texture to check. It will now throw a run-time warning and skip the Container for input. You should use a custom input callback instead. Fix #4492 2019-04-26 10:56:06 +01:00
Richard Davey
64532d8d7b InputPlugin.clear has a new argument skipQueue which is used to avoid clearing a Game Object twice. This, combined with the fix for 4463 means you will no longer get a Cannot read property 'dragState' error if you destroy a Game Object enabled for drag where another draggable object exists. Fix #4228 2019-04-24 13:38:40 +01:00
Richard Davey
00dbf8b03e Destroying a Game object during its pointerup event handler on a touch device will no longer cause Uncaught TypeError: Cannot read property 'localX' of undefined. All InputPlugin process handlers now check to see if the Game Object has been destroyed at any stage and abort if it has. Fix #4463 2019-04-24 12:54:56 +01:00
Richard Davey
507bb6a215 Added customHitArea boolean property 2019-04-24 11:21:52 +01:00
Richard Davey
2ef6ad3e51 Fixed jsdoc 2019-04-24 10:54:02 +01:00
Richard Davey
181be88ba9 Updated to use game clock time values. 2019-04-24 10:48:03 +01:00
Richard Davey
6b5383a007 Key now needs a reference to the plugin that created it. Also added getDuration method. 2019-04-24 10:47:51 +01:00
Richard Davey
d7917789eb Added destroy argument to removeKey and cleared plugin reference. 2019-04-24 10:47:22 +01:00
Richard Davey
fd4f45673b Pointer.getDuration would only return zero until the pointer was released, or moved (basically any action that generated a DOM event). It now returns the duration regardless of the DOM events. Fix #4444 2019-04-24 10:08:56 +01:00
Richard Davey
31c0b4f2ff Update now always runs but only once per frame 2019-04-24 10:04:13 +01:00
Richard Davey
95b18ae6e0 Refined poll rate handling and added pluginUpdate 2019-04-24 10:03:58 +01:00
Richard Davey
43c72e23c6 Fixed issue with input events running twice 2019-04-24 09:34:40 +01:00
Richard Davey
e0255c6f0f Docs fix 2019-04-16 17:08:19 +01:00
Richard Davey
0cfbc7917e The InputPlugin will now dispatch an update event regardless, allowing the Gamepad Plugin to update itself every frame, regardless of DOM events. This allows Gamepads to work correctly again. Fix #4414 2019-04-08 14:39:28 +01:00
Richard Davey
0ee2442597 Bumping to 3.17.0 2019-03-07 12:31:06 +00:00
Richard Davey
341e78ce0d Added touch Window handlers and remove handlers 2019-02-22 02:26:52 +00:00
Richard Davey
c90ae09f9f Added window specific handlers
And game config option:

```
    input: {
        windowEvents: false
    },
```
2019-02-22 02:11:13 +00:00
Richard Davey
0db663d901 More typedefs 2019-02-13 15:38:50 +00:00
Richard Davey
3938675d9f Input typedefs 2019-02-13 14:17:36 +00:00
Richard Davey
c8439393fb Much better keycode jsdoc handling. 2019-02-12 12:51:43 +00:00
Richard Davey
dc73993fe2 Added jsdoc version numbers 2019-02-12 12:22:25 +00:00
Richard Davey
ccaae460a4 Added jsdoc version numbers to each event 2019-02-12 11:37:58 +00:00
Richard Davey
3104246386
Merge pull request #4347 from rgk/patch-5
On mobile, have pointerup and pointerout get triggered together.
2019-02-10 21:17:24 +00:00
Richard Davey
f3f65d1437 Refactored the game over and out handling to work with the non-legacy input system. Fix #4344 2019-02-10 17:10:13 +00:00
Robert Kowalski
6105c1a9b2
Emit pointerout always after pointerup on touch.
Now pointerout will always emit after pointerup.
2019-02-08 09:33:25 -05:00
Richard Davey
6cd17618b1 Moved time to getter and fixed checkDown. 2019-02-08 13:32:54 +00:00
Richard Davey
7f91956c09 Added time property and preStep. 2019-02-08 13:32:44 +00:00
Richard Davey
916a13cf9d resetKeys doc update. Fix #4345 2019-02-07 00:31:10 +00:00
Robert Kowalski
b94f655405
Only needs to be cleared once.
No need for the duplicate clearing of this, and quick fix.
2019-02-06 11:38:50 -05:00
Robert Kowalski
8cd8b6f98e
Stops pointerover from being triggered if pointerup has been.
In 3.16.1 if you trigger pointerup and then move to another button, the past buttons pointerover event gets triggered. This clears that and stops that from happening by stopping pointerover from being triggered if pointerup has been.
2019-02-06 11:27:22 -05:00
Richard Davey
4cfa29a524 Added flag to help avoid cursor reset issue 2019-02-04 23:29:10 +00:00
Richard Davey
d04232ae54 JSDoc fixes 2019-02-04 11:45:17 +00:00
Richard Davey
348306cafb Lots more jsdoc fixes and new documentation 2019-01-31 14:47:50 +00:00
Richard Davey
3d5d84c01f Stop listener 2019-01-29 23:22:29 +00:00
Richard Davey
1c0acc2342 Needs to listen for the PROCESS event, plus emit keydown_ as well. 2019-01-29 23:21:54 +00:00
Richard Davey
fb0c4af780 Trim the keycodes 2019-01-29 23:21:34 +00:00
Richard Davey
eb78cf90c6 Swapped to using the Scene iteration approach instead of an event, as it fixes the issue with Scene ordering and global priority. Fix #4327 #4321 2019-01-29 01:05:27 +00:00
Richard Davey
aa967cdbc0 Removed process listener. 2019-01-29 01:04:09 +00:00
Richard Davey
6d77884b92 Removed un-needed methods and reset keys on focus loss. Fix #4134 2019-01-24 11:55:34 +00:00
Richard Davey
508df48512 Apply buttons check in move handler too. 2019-01-23 23:17:52 +00:00
Richard Davey
67679f58f6 Return actual booleans from button checks and reset buttons to zero correctly. 2019-01-23 23:00:29 +00:00
Richard Davey
8111d8062e Pointer.up and Pointer.down now use a hasOwnProperty check for the existance of the buttons property on the event, causing it to be set even if equal to zero, which it is when there are no buttons down 2019-01-23 22:34:48 +00:00