Commit graph

810 commits

Author SHA1 Message Date
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
404
3a3f479196 fix: The window touchcancel event is not removed 2021-11-08 16:13:59 +08:00
Richard Davey
68550dbddb Update Key.js 2021-11-02 22:54:17 +00:00
Richard Davey
3e1d77ad8f The KeyboardPlugin.removeKey method has a new optional parameter removeCapture. This will remove any keyboard capture events for the given Key. Fix #5693 2021-11-01 18:13:51 +00:00
Richard Davey
c391ad6c87 Check if still input enabled 2021-10-26 18:24:06 +01:00
natureofcode
81e3c06676 Hotfix broken drag 2021-09-17 23:00:29 +05:00
natureofcode
89ff86202b Fix #5828 2021-09-17 12:19:39 +05:00
Sylvain Pollet-Villard
dca5346573 types: JSDoc for Phaser.Input.Gamepad.Configs 2021-07-08 23:53:58 +02:00
Richard Davey
f802ac5d8c The Input.Pointer.event property can now be a WheelEvent as well. 2021-05-03 18:15:20 +01:00
samme
9e4d693481
Docs: fix type for KeyboardPlugin#manager 2021-04-02 10:31:49 -07:00
Richard Davey
29d38b3283 Updated docs 2021-03-24 16:36:22 +00:00
Ben Randall
e0f26f6b9d Remove and destry all Keys in Scene.Shutdown() 2021-03-17 20:01:24 -07:00
Richard Davey
616566c35a Renamed sortGameObjects to sortDropZones and then repurposed the old method for the new render list sorting technique. 2021-01-07 12:32:00 +00:00
cjw6k
19c2874166
Added prevType to constructor. 2020-12-28 17:37:54 -04:00
cjw6k
8771c81649
Check event.type in duplicate event bailout
Fixes #5471.
2020-12-27 17:24:14 -04:00
Richard Davey
417f7684c3 More integer to number changes 2020-11-23 10:32:00 +00:00