Commit graph

825 commits

Author SHA1 Message Date
Zeke Chan
ef6a9331b6 Update Pointer.js
These methods will now return `true` when multiple mouse buttons are being pressed:
- leftButtonReleased
- rightButtonReleased
- middleButtonReleased
- backButtonReleased
- forwardButtonReleased
2024-06-11 17:25:02 +08:00
Robert Kowalski
e337b6e4d1 The default for inputActivePointers works for this condition now 2024-04-22 09:30:00 -04:00
Robert Kowalski
ec98b33757 Consistently check length for each pointer event Fix #6783 2024-04-21 23:57:18 -04:00
Richard Davey
6943c9bbca Reverted a change made in TouchManager that would prevent clicks from outside the game window from being registered. Fix #6747 2024-02-27 15:36:34 +00:00
Richard Davey
229f9232f4 Modified onMouseUpWindow and onMouseDownWindow in the MouseManager so they now check for sourceCapabilities.firesTouchEvents and if found, abort registering the event. This new browser event property is designed to prevent you accidentally registering a Mouse Event when a Touch Event has just occurred (see https://developer.mozilla.org/en-US/docs/Web/API/InputDeviceCapabilities/firesTouchEvents) #6747 2024-02-27 15:36:23 +00:00
Richard Davey
1f8276ac76 Updated copyright year, company and author 2024-02-19 17:12:24 +00:00
Robert Kowalski
a7f00773ff Properly detect mesh like gameObjects when supplying an input configuration 2024-02-18 08:01:22 -05:00
Robert Kowalski
480cccb19e Add hitAreaCallback workaround back to Input.InputPlugin#setHitArea 2024-02-12 10:03:54 -05:00
Robert Kowalski
b762b28575 Use built in HasAny to check for Mesh Game Objects 2024-02-07 21:05:31 -05:00
Robert Kowalski
827d6320e7 Remove old Mesh based Game Object detection for input and check if interactive config is empty 2024-02-07 15:52:17 -05:00
Robert Kowalski
798082c6c6 Mesh based Game Objects can use an input configuration Fixes #6510 2024-02-06 23:44:02 -05:00
Robert Kowalski
d35e69ce25 Move resetCursor so it does not lose input Fix #6387 2024-02-05 18:38:42 -05:00
Robert Kowalski
39b35580c9 Keep temp hit test when disabling interactivity Fix #6601 2024-02-02 17:56:45 -05:00
Richard Davey
ceb92cb366 If you enable a Game Object for Input Debugging, the debug shape will no longer be rendered if the Game Object itself is not visible. Fix #6364 2024-02-01 17:25:52 +00:00
Robert Kowalski
86b8364dd2 preventDefault in onTouchEndWindow when DOM elements are over input 2024-02-01 11:18:54 -05:00
Richard Davey
8287d44a04
Merge pull request #6679 from somechris/touch-move-coordinates-on-scrolled-down-page
Fix `InputManager.onTouchMove` to work on scrolled-down pages
2024-01-12 17:48:05 +00:00
samme
7b648c64d2 Docs: add dropped arg in DRAG_END 2023-12-04 14:57:45 -08:00
Christian Aistleitner
66901b32d3 Fix InputManager.onTouchMove to work on scrolled-down pages
`document.elementFromPoint` expects plain viewport coordinates [1],
while we used `page[XY]`, which are viewport coordinates with added
scroll offsets [2].

So on pages where no scrolling had yet occurred,
`InputManager.onTouchMove` worked as expected. But as soon as one
scrolled down/right on the page, the element detection was off by the
scroll offset.

We switch from `page[XY]` to `client[XY]` which are plain viewport
coordinates [3] and thereby make element detection work also on pages
that have been scrolled around.

[1] https://drafts.csswg.org/cssom-view/#dom-document-elementfrompoint
[2] https://w3c.github.io/touch-events/#dom-touch-pagex
[3] https://w3c.github.io/touch-events/#dom-touch-clientx
2023-11-24 14:12:20 +01:00
John Hyde
e9808895ae
Update InputConfiguration.js: Clarify alphaTolerance
This change adds documentation to make it clear that alphaTolerance is a value between 0 and 255, rather than 0 and 1.
2023-08-30 13:07:33 -07:00
Richard Davey
468bf7821d Updated copyright year 2023-01-02 17:36:27 +00:00
Richard Davey
e1c33cc9e9 When a Game Object had Input Debug Enabled the debug image would be incorrectly offset if the Game Object was attached to was scaled and the hit area shape was smaller, or offset, from the Game Object. Fix #4905 #6317 2022-12-12 17:12:58 +00:00
Richard Davey
538b7ecff3 Revert to correct list. Fix #6306 2022-12-09 18:04:04 +00:00
Richard Davey
c53dc4a5a1 Removed alwaysEnabled property entirely. #5507 #6306 2022-12-09 18:03:41 +00:00
Richard Davey
436a42cfb4 The InputPlugin.sortGameObjects method was using the Camera Render List to determine the Game Object display list. This would exclude non-rendering objects, such as Game Objects with alpha set to zero, even if their Input alwaysEnable flag was set. This method now uses the Display List instead, which gives correct results for invisible 'always enabled' objects. Fix #5507 2022-11-21 23:26:44 +00:00
Richard Davey
154e262ae8 No point doing this twice 2022-11-21 22:46:01 +00:00
Richard Davey
778b3e7f52 Allow key presses during pre-create stage 2022-11-08 23:32:58 +00:00
Richard Davey
987e769b6b Scenes.Systems.canInput is a new internal method that determines if a Scene can receive Input events, or not. This is now used by the InputPlugin instead of the previous isActive test. This allows a Scene to emit and handle input events even when it is running init or preload. Previously, it could only do this after create had finished running. Fix #6123 2022-11-08 23:21:33 +00:00
Richard Davey
e618e149e8 Update InputPlugin.js 2022-10-28 18:43:40 +01:00
Richard Davey
94942d6633 Update InputPlugin.js 2022-10-28 17:57:43 +01:00
Richard Davey
ae378e3820 Added resetPointers method 2022-10-28 17:56:57 +01:00
Richard Davey
d909af6b62 Added Pointer.reset 2022-10-28 17:50:26 +01:00
Richard Davey
3e65947cb2 When calling InputPlugin.clear it will now call removeDebug on the Game Object, making sure it clears up any Input Debug Graphics left in the Scene. Fix #6137 2022-10-14 13:32:59 +01:00
Richard Davey
023343c789 All events have a type of string. Fix #6136 2022-09-21 22:01:03 +01:00
Richard Davey
4fd0fa2ab2 Update KeyboardPlugin.js 2022-05-27 18:54:41 +01:00
Richard Davey
033d4eeb32
Merge pull request #6084 from spayton/master
Allow input debug hit area colour to be adjusted after enabling.
2022-05-09 17:13:37 +01:00
Richard Davey
6d9aceb727 The Key.reset method no longer resets the Key.enabled or Key.preventDefault booleans back to true again, but only resets the state of the Key. Fix #6098 2022-05-06 15:12:27 +01:00
stu
c0e63d6a3a Allow input debug hit area colour to be adjusted after enabling. 2022-04-21 19:03:27 +01:00
Richard Davey
c49674dff8 Updated docs 2022-04-14 15:35:33 +01:00
Lukas Hass
b7a4b77a6a
Disable context menu on input target instead of document.body
Fixes #6064
2022-04-02 23:57:15 +02:00
Richard Davey
59fbcc5ca3 Updated copyright year 2022-02-28 14:29:51 +00:00
Richard Davey
982ab23aba Update InputPlugin.js 2021-12-01 18:30:02 +00:00
Richard Davey
11ae9f1b35 Make use of the disable method to avoid duplication of code 2021-12-01 18:10:04 +00:00
Richard Davey
a9538c0145 Updated function to use internal vars and fixed jsdoc. Also don't return if input false, as object may still be in arrays anyway #5839 2021-12-01 17:59:46 +00:00
Richard Davey
385800ec2f
Merge pull request #5839 from natureofcode/fix/issue-5828
Fix #5828, improve GameObject#disableInteractive() and InputPlugin#disable()
2021-12-01 17:46:34 +00:00
Richard Davey
322a6131f8 Added clarifications to the documentation re: out handling. Close #5796 2021-12-01 17:41:46 +00:00
Richard Davey
e1718f9fbe The InputPlugin.sortGameObjects will now assign a value of 0 to any game object not in the render list, but still viable for input, such as an invisible object with alwaysEnabled set to true. This fixes an issue where non-render list objects would be skipped. Fix #5507 2021-12-01 17:03:01 +00:00
Richard Davey
91f72f7700 The InputManager.onTouchMove method will now check if the changed touch is over the canvas, or not, via the DOM elementFromPoint function. This means if the touch leaves the canvas, it will now trigger the GAME_OUT and GAME_OVER events, where-as before this would only happen for a Mouse. If the touch isn't over the canvas, no Pointer touch move happens, just like with the mouse. Fix #5592 2021-12-01 16:36:06 +00:00
Richard Davey
d36c8177b5 Update InputManager.js 2021-12-01 13:15:27 +00:00
Richard Davey
c0d2d1d35e Removed over and out events as no browser supports them. Tidied up the rest. Added isTop property. 2021-11-30 22:38:26 +00:00
Richard Davey
1273145a6b When the Pointer moves out of the canvas and is released it would trigger Uncaught TypeError: Cannot read properties of undefined (reading 'renderList') if multiple children existed in the pointer-out array. Fix #5867 2021-11-30 20:29:16 +00:00