Impact:
- *none for touch devices*
- *low* / 'expected behavior' for mouse devices
Adds a PointerMode enumeration value for better simple input
discrimination in the future.
The added Button#justReleasedPreventsOver controls if a just-release event
on a pointer prevents it from being able to trigger an over event.
The default value is PointerMode.CONTACT which means this 'release guard'
applies only to touch inputs.
It should fix#2062 as Mouse (PointerMode.CURSOR) input is not caught in the default.
Also expands Button#forceOut to accept a PointerMode value such that it
can be controlled per-input mode.
This is a configurable partial revert of a possibly rogue commit in 2.1.3
and the behavior persists through 2.4.3.
- Impact: none; documentation and local variable names only
- Incorrect documentation that claimed to take a Pointer when they really
took a Pointer ID is fixed
- Also updates parameter names for consistenct/clarity
Event listeners added with true passed in as the useCapture flag are only removed when true is also passed into the removeEventListener call. Adding this flag to the stop method where appropriate fixes a memory leak in IE where events on window are never removed.
See https://msdn.microsoft.com/en-us/library/ff975250(v=vs.85).aspx
* MSPointer now has an `onPointerUpGlobal` handler for when the pointer is released outside of the canvas, but still within the browser window. This means that in IE11 a Sprites `onInputUp` event will now trigger even when outside the canvas (thanks @bvargish #2000)
* MSPointer now has handles for the pointer being over and outside of the canvas element, which sets the Pointer.withinGame booleans accordingly. It also triggers the Mouse.mouseOutCallback and Mouse.mouseOverCallback callbacks respectively.
* The MSPointer event listeners have been renamed to all lower-case, i.e. 'pointerDown' is now 'pointerdown'.
GameObject.input.dragStartPoint now stores the coordinates the object was at when the drag started. This value is populated when the drag starts. It can be used to return an object to its pre-drag position, for example if it was dropped in an invalid place in-game.
MSPointer.event now stores the most recent pointer event.
MSPointer.pointerDownCallback, pointerMoveCallback and pointerUpCallback all allow you to set your own event based callbacks.
There are a bunch of signals added for Sprites; more when input is
enabled. However, very few of these signals are ever actually used. While
the previous performance update related to Signals addressed the size of
each Signal object, this update is to reduce the number of Signal objects
as used by the Events type.
As a comparison the "Particle: Random Sprite" demo creates 3200+ Signals;
with this change there less than 70 signals created when running the same
demo. (Each Event creates at 8 signals by default, and there is an Event
for each of the 400 particles.) While this is an idealized scenario, a
huge amount (of albeit small) object reduction should be expected.
It does this by creating a signal proxy property getter and a signal
dispatch proxy. When the event property (eg. `onEvent`) is accessed a new
Signal object is created (and cached in `_onEvent`) as required. This
ensures that no user code has to perform an existance-check on the event
property first: it just continues to use the signal property as normal.
When the Phaser game code needs to dispatch the event it uses
`event.onEvent$dispath(..)` instead of `event.onEvent.dispatch(..)`. This
special auto-generated method automatically takes care of checking for if
the Signal has been created and only dispatches the event if this is the
case. (If the game code used the `onEvent` property itself the event
deferal approach would be defeated.)
This approach is designed to require minimal changes, not negatively
affect performance, and reduce the number of Signal objects and
corresponding Signal/Event resource usage.
The only known user-code change is that code can add to signal (eg.
onInput) events even when input is not enabled - this will allow some
previously invalid code run without throwing an exception.
- Updated `readOnly` doclet to `readonly`
- `array` refined to `type[]`, where such information was immediately
determinable.
- Updated {Any}/{*} to {any}; {...*} is standard exception
- Udated {Object} to {object}
Keyboard.justReleased has bee renamed to Keyboard.upDuration which is a much clearer name for what the method actually does.
Keyboard.downDuration, Keyboard.upDuration and Keyboard.isDown now all return `null` if the Key wasn't found in the local keys array.
Calling justPressed or justReleased on Phaser.Keyboard throws an exception. Changed to reflect new method names in Phaser.Key
I imagine you'd want these methods renamed as well, but it appears to be called by a few other classes and I didn't want a huge pull-request.
Key.justReleased has bee renamed to Key.upDuration which is a much clearer name for what the method actually does. See Key.justUp for a nice clean alternative.
Key.justDown allows you to test if a Key has just been pressed down or not. You can only call justDown once per key press. It will only return `true` once, until the Key is released and pressed down again. This allows you to use it in situations where you want to check if this key is down without using a Signal, such as in a core game loop (thanks @pjbaron #1321)
Key.justUp allows you to test if a Key has just been released or not. You can only call justUp once per key press. It will only return `true` once, until the Key is pressed down and released again. This allows you to use it in situations where you want to check if this key is up without using a Signal, such as in a core game loop (thanks @pjbaron #1321)
- Renamed ArrayList to ArraySet
- Added ArrayList is a deprecated proxy for compatibility
- Updated internal code to use ArraySet
- ArraySet can be constructed with an array; if the caller is willing to
accept some responsibility this can remove the O(n^2) behavior of
repeatedly calling `add`.
- Updated Group.filter to take advantage of this
- ArraySet.total is read-only proxy for for list.length
- Fixes ArraySet.setAll where it would only set properties with truthy
values
- Updated documentation
- Added support for the Wheel Event, which is the DOM3 spec.
- Wheel Scroll Event (old non-FF) and DOM Mouse Wheel (old FF) are
supported via a non-exported reused wrapper object, WheelEventProxy.
The proxy methods are generated one-time dynamically; future changes
to the Mouse class (such as requiring an opt-in for mouse scroll events)
could bypass secondary stub generation.
- FIX: Only ONE of the mouse wheel events is listened too, newest standard first.
This fixes a bug in FF where it would use the default DOMMouseWheel.
- `pointerN` are aliases to backed `pointers[N-1]` array.
This simplifies (and increases the efficiency of) looping through all the pointers when applicable; also eliminates pointer-existance checks
Removes various hard-coded limits (added MAX_POINTERS); changed `maxPointers` default
- Removed some special-casing from cases where it did not matter
- Removed `=== false/true`, `==` usage for consistency, changed missing value check to `typeof`, etc.
- Updated documentation for specificty; added `@public\@protected`
- `@deprecated` currentPointers due to odd set pattern; `totalCurrentPointers` is more appropriate.
- This is needed to support Fullscreen on IE11 because IE only trusts 'click' events for this operation; click trampolines as a general solution, although they are only required in some "special" cases.
- Fix incorrect passing of "was clicked" to processInteractiveObjects
- Button would not return to Over/Out state because of strict too check to catch `undefined`
- Removed [undocumented] property usage from processInteractiveObjects and slight reformatting
- Update Button state frames/sounds to remove duplication
- Updated documentation in Button for consistency
- Added `enabled` getter; this resets the key (soft) and then disables they key
- Added `_enabled` property and updated internal usage
- Updated document for `reset`.