Richard Davey
1932515f56
Fixed a really nasty bug in Chrome OS X where a ctrl + click (i.e. simulated right-click) on a trackpad would lock up the Pointer leftButton, causing future clicks to fail. This is now handled by way of a mouseout listener on the window object, sadly the only way to force a mouseup in Chrome (thanks @KyleU #2286 )
2016-02-17 01:26:35 +00:00
Richard Davey
c1d0ec0f34
Local vars to reduce file size.
2015-09-29 16:06:44 +01:00
photonstorm
2633f8ce6d
InputHandler.validForInput now checks if the game object has input.enabled
set to false
and doesn't validate it for input if that's the case.
2015-09-22 15:20:23 +01:00
Paul
31e5202eff
Fixes #2062 and forward-support for pointer modes
...
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.
2015-09-22 01:12:43 -07:00
photonstorm
99fbf35236
* Pointer.withinGame is no longer automatically set to 'false' in the Pointer.stop method - it will check if the Pointer actually is within the stage bounds and only set withinGame
to false if it's outside the bounds.
...
* 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'.
2015-08-20 12:47:50 +01:00
photonstorm
a4321e56e3
* Pointer.isDown was reset before the Input.onUp event, meaning you couldn't get the Pointer.duration from within the event.
...
* Pointer.isDown was reset before the Input tap calculations, meaning onTap wouldn't dispatch (thanks @stovenator #1953 )
2015-07-30 14:08:26 +01:00
photonstorm
962066102c
Pointer fixes for Linux FireFox ( #1932 #1944 )
2015-07-28 14:18:36 +01:00
photonstorm
fd6c29e451
Pointer.move would accidentally reset the isDown
status of the Pointer on touch devices, which broke things like Sprite input events when built to native apps or run locally ( #1932 #1943 )
2015-07-27 13:34:06 +01:00
Richard Davey
aeda044143
Safari on OSX wouldn't recognise button presses on trackpads (thanks JakeCake)
2015-07-23 20:54:59 +01:00
photonstorm
cf74eaa396
MSPointer now checks the pointerType
property of the DOM event and if it matches 'mouse' it will update Input.mousePointer
, rather than Input.pointer1
(or whatever the next free Pointer was).
2015-07-20 14:01:21 +01:00
photonstorm
c2812a7b5c
jshint fixes and renamed float to padFloat.
2015-07-17 14:11:11 +01:00
photonstorm
5d0788b47d
Consolidated all Pointer buttons into the new DeviceButton class.
2015-07-17 13:52:09 +01:00
photonstorm
32ea5bee03
Fixes #1916 - but am now working on the DeviceButton class to tidy it all up.
2015-07-17 12:24:08 +01:00
Richard Davey
41d702b485
Pointer.isUp and isDown are now set in the updateButtons method based on the state of ANY button on the device, jsdocs also updated to reflect this ( #1902 )
2015-07-12 11:56:25 +01:00
Richard Davey
b0a8d3d78c
Mouse.button and MSPointer.button properties removed and jsdocs expanded to explain the correct path to now take ( #1903 )
2015-07-12 11:47:20 +01:00
Richard Davey
03e2f1a2b5
On trackpads Pointer.updateButtons now checks for the ctrlKey being pressed and sets rightButton to true as a result.
2015-07-09 19:26:00 +01:00
photonstorm
157df30696
Pointer button handling has been given an overhaul. It has the following new boolean properties: leftButton
, rightButton
, middleButton
, backButton
, forwardButton
and eraserButton
. So you can now easily check which buttons are active and build right or middle click support into your games. The Pointer object normalises these properties for you, regardless if they came from a MouseEvent or PointerEvent (thanks @youssefdetovernickr for the idea #1848 )
2015-07-07 16:53:56 +01:00
photonstorm
102c74e121
Deprecated the following:
...
* Camera.screenView
* ScaleManager.maxIterations
* ScaleManager.enterPortrait (see onOrientationChange)
* ScaleManager.enterLandscape (see onOrientationChange)
* ScaleManager.enterFullScreen (see onFullScreenChange)
* ScaleManager.leaveFullScreen (see onFullScreenChange)
* ScaleManager.fullScreenFailed (see onFullScreenError)
* ScaleManager.checkResize
* ScaleManager.checkOrientation
* ScaleManager.setScreenSize (see updateLayout)
* ScaleManager.setSize (see reflowCanvas)
* ScaleManager.checkOrientationState (see reflowCanvas)
* ScaleManager.orientation (see screenOrientation)
* Gamepad.disabled (see enabled)
* Input.currentPointers (see totalActivePointers)
* Input.disabled (see enabled)
* Keyboard.disabled (see enabled)
* Mouse.disabled (see enabled)
* Mouse.mouseMoveCallback (see Input.addMoveCallback)
* MSPointer.disabled (see enabled)
* Touch.disabled (see enabled)
* Cache.getUrl (see getURL)
* Math.truncate (see Math.trunc)
* Math.snapToInArray (see Phaser.ArrayUtils.findClosest)
* Math.interpolateFloat (see Math.linear)
* Math.normalizeLatitude (use Phaser.Math.clamp(lat, -90, 90))
* Math.normalizeLongitude (use Phaser.Math.wrap(lng, -180, 180))
* Math.chanceRoll (use Phaser.Utils.chanceRoll)
* Math.numberArray (use Phaser.ArrayUtils.numberArray)
* Math.numberArrayStep (use Phaser.ArrayUtils.numberArrayStep)
* Math.limitValue (use Phaser.Math.clamp)
* Math.randomSign (use Phaser.Utils.randomChoice(-1, 1))
* Math.angleLimit (use Phaser.Math.clamp)
* Math.getRandom (use Phaser.ArrayUtils.getRandomItem)
* Math.removeRandom (use Phaser.ArrayUtils.removeRandomItem)
* Math.floor (use Math.trunc)
* Math.ceil (use Phaser.Math.roundAwayFromZero)
* Math.shift (use Phaser.ArrayUtils.rotate)
* Math.shuffleArray (use Phaser.ArrayUtils.shuffle)
* Math.distanceRounded (do the rounding locally)
* Canvas.getOffset (see Phaser.DOM.getOffset)
* Canvas.getAspectRatio (see Phaser.DOM.getAspectRatio)
* TilemapLayer.tileColor (use TilemapLayer.debugSettings.missingImageFill)
* Phaser.ArrayList alias removed, now use Phaser.ArraySet
* Utils.transposeArray (see Phaser.ArrayUtils.transposeMatrix)
* Utils.rotateArray (see Phaser.ArrayUtils.rotateMatrix)
* Utils.shuffle (see Phaser.ArrayUtils.shuffle)
2015-06-17 03:14:31 +01:00
photonstorm
b645b277aa
jsdoc fix.
2015-04-27 16:22:36 +01:00
photonstorm
a69e53f901
Copyright date change.
2015-02-25 03:36:23 +00:00
photonstorm
8483eac6aa
Removing all use of _cache from all Game Objects.
2015-02-16 17:22:51 +00:00
photonstorm
aa2df803b7
Pointer.stop would call event.preventDefault
if Pointer._stateReset
was true
, which is always true
after a State has changed and before Pointer.start has been called. However this broken interacting with DOM elements in the case where the State changes and you immediately try to use the DOM element without first having clicked on the Phaser game. An additional guard was added so preventDefault
will now only be called if both _stateReste
and Pointer.withinGame
are true (thanks @satan6 #1509 )
2015-02-11 16:03:24 +00:00
photonstorm
0a86a7ef51
Time.now can no longer be relied upon to contain a timestamp value. If the browser supports requestAnimationFrame then Time.now
will contain the high resolution timer value that rAf generates. Otherwise it will contain the value of Date.now. If you require the actual time value (in milliseconds) then please use Time.time
instead. Note that all Phaser sub-systems that used to rely on Time.now
have been updated, so if you have any code that extends these please be sure to check it.
2014-11-08 20:01:10 +00:00
Richard Davey
f4237b3130
Merge pull request #1272 from pnstickne/wip-1246b
...
Button - bug fixes, issue #1246 (try number two)
2014-11-04 23:51:46 +00:00
Paul
2f460aaf8a
Browser incompatibility fix - MAX_SAFE_INTEGER
...
- Number.MAX_SAFE_INTEGER is only defined in ES6 and not currently cross-browser
2014-11-01 09:50:28 -07:00
Paul
31061775d7
Pointe - removed extra whitespace
2014-11-01 01:25:01 -07:00
Paul
14002ca02d
Pointer - minor documentation update for click trampolines
2014-11-01 01:11:26 -07:00
Paul
3005419435
Click Trampolines - support to trampoline pointer events into 'click' events
...
- 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.
2014-11-01 01:04:17 -07:00
Paul
5d04c62b33
Button - bug fixes, issue #1246
...
- 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
2014-10-28 23:26:35 -07:00
photonstorm
20551f9129
Lots of jsdocs fixes ready for the new doc generator.
2014-09-16 17:35:08 +01:00
photonstorm
5fb8c7eb85
ScaleManager window.resize handler would constantly dispatch enterPortrait and enterLandscape events on window resizing, regardless if it actually entered that orientation or not.
...
Stage.offset has been moved to ScaleManager.offset
Stage.bounds has been removed, you can access it via Stage.getBounds.
Stage.checkOffsetInterval has been moved to ScaleManager.trackParentInterval
ScaleManager.hasResized signal has been removed. Use ScaleManager.setResizeCallback instead.
2014-09-01 01:02:48 +01:00
photonstorm
004deff508
Note: This commit will break all input, don't pull it down until I finish this work off later today please!
...
Moved the DOM offset from Stage to ScaleManager (a more logical location for it) and updated Pointer to use that.
Moved the Pointer offset check to look at the ScaleManager.
Used getBoundingClientRect(), will see if that works better than Phaser.Canvas.getOffset.
2014-08-31 12:17:07 +01:00
photonstorm
9055fc7e01
The Pointer move callbacks are now sent an extra parameter: fromClick
allowing your callbacks to distinguish between the Pointer just moving, or moving as a result of being pressed down (thanks @iforce2d #1055 )
2014-08-29 14:19:47 +01:00
photonstorm
dd9e7e6297
Pointer.dirty is a new boolean that is set by the InputHandler. It tells the Pointer to re-check all interactive objects it may be over on the next update, regardless if it has moved position or not. This helps solve issues where you may have a Button that on click generates a pop-up window that now obscures the Button (thanks @jflowers45 #882 )
2014-08-29 00:47:49 +01:00
photonstorm
ec687868de
Input.setMoveCallback has been removed due to deprecation.
...
BitmapData.refreshBuffer has been removed and replaced with BitmapData.update.
BitmapData.drawSprite has been removed due to deprecation. Use BitmapData.draw instead.
Pointer.moveCallback has been removed due to deprecation.
SinglePad.addButton has been removed due to deprecation.
P2.Body.loadData has been removed due to deprecation.
P2.World.defaultFriction and defaultRestitution have been removed due to deprecation.
Canvas.create noCocoon parameter has been removed due to deprecation.
Color.getColorInfo, RGBtoHexstring, RGBtoWebstring and colorToHexstring has been removed due to deprecation.
2014-08-28 03:40:59 +01:00
photonstorm
33c52eaf09
BitmapData alpha option added.
...
Pointer return type added.
pixi manifest updated to remove need for geom classes.
2014-08-27 21:26:29 +01:00
photonstorm
538425193a
World.wrap when using the bounds of the object wouldn't adjust the bounds correctly, meaning wrapping outside the camera failed (thanks @jackrugile #1020 )
2014-07-15 14:22:24 +01:00
photonstorm
f78a527ad5
Prevented objects with pixel perfect checks from over-riding other higher priority ID items ( #983 )
...
Rebuilt the way items are polled for Pointer events (drag, click, move). Now faster and more efficient, especially when some items in the stack require pixel perfect checks.
2014-07-15 11:20:57 +01:00
photonstorm
2293b64c94
Removing debug / console.log output.
2014-07-09 05:49:13 +01:00
photonstorm
7b876d5fc4
ScaleManager.bounds is a Rectangle object that holds the exact size of the game canvas, taking DOM offset and game scale into account.
...
Pointer.withinGame is now accurate based on game scale and updated as the Pointer moves.
Stage.bounds is now updated if the game canvas offset changes position. Note that it gives the un-scaled game dimensions.
2014-05-19 18:49:59 +01:00
photonstorm
c9656e48de
Group.hasProperty fixed to not use hasOwnProperty, but a series of in
checks (thanks @mgiuffrida for the idea, #829 )
2014-05-19 13:11:58 +01:00
Wouter Commandeur
ce34da80c6
Only update movement when mouse is locked
2014-05-17 12:01:40 +02:00
Wouter Commandeur
e041eea968
whitespace adjustments
2014-05-17 11:32:11 +02:00
Wouter Commandeur
449c7ebfb0
Add mouse movement to pointer. This should be used with pointerLock.
2014-05-17 11:27:31 +02:00
photonstorm
5d8a11ae29
Input.addMoveCallback allows you to bind as many callbacks as you like to the DOM move events (Input.setMoveCallback is now flagged as deprecated)
...
Input.deleteMoveCallback will remove a previously set movement event callback.
2014-05-14 03:01:24 +01:00
photonstorm
b90bcc442c
If an object was drag enabled with bringToTop, the onDragStop event wouldn't fire until the mouse was next moved (thanks @alpera, fix #813 )
2014-05-14 02:42:55 +01:00
photonstorm
2b40c8a7c7
Pointer.type and Pointer.exists properties added.
...
QuadTree.retrieve can now accept either a Sprite with a physics body or a Phaser.Rectangle as its parameter.
ArcadePhysics.getObjectsUnderPointer will return all children from a Group that overlap with the given Pointer.
2014-05-06 02:45:10 +01:00
photonstorm
ad7e2aff1f
Input.getPointerFromId will return a pointer with a matching pointerId value, if any. pointerId is a value set by the browser in the DOM event.
2014-05-02 12:21:57 +01:00
photonstorm
842abb82d3
Pointer.pointerId added which is set by the DOM event (if present in the browser). Note that browsers can and do recycle pointer IDs.
2014-05-02 12:14:05 +01:00
photonstorm
4466b3cd5d
Input.getPointerFromIdentifier docs update to reflect where the identifier comes from. Pointer properties now set to give it fixed defaults (thanks @JirkaDellOro, #793 )
2014-05-01 23:35:40 +01:00