Commit graph

66 commits

Author SHA1 Message Date
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
photonstorm
54b71ddc23 Phaser.ArrayList is a new iterative object, similar in principal to a linked list but operating on a single array without modifying the object structure.
Input and Pointer now use the new ArrayList instead of a LinkedList, which resolve list item removable during callback issues.
Input.reset no longer resets every interactive item it knows of, because they are removed during the destroy phase and can now persist between States if needed.
2014-04-25 15:11:54 +01:00
photonstorm
8fc2a465cd New Phaser package, small docs updates and preparing P2.World for new bounds code and v0.5.0 migration. 2014-04-08 03:31:13 +01:00
Kimmo Salmela
a23c6ee6fd Added positionUp to Pointer 2014-03-31 20:36:51 +03:00
Christian Wesselhoeft
ebad4c1d38 Fix jshint issues in src/input 2014-03-25 14:56:05 -07:00
Christian Wesselhoeft
61f18b675c Trim trailing whitespace. 2014-03-25 14:56:04 -07:00
photonstorm
11fdd62436 World.destroy incorrectly clashed with the Group.destroy method it over-rode, renamed to World.shutdown and updated StateManager accordingly.
World.shutdown now removes all children iteratively, calling destroy on each one, ultimately performing a soft reset of the World.
Objects with a scale.x or y of 0 are no longer considered valid for input (fix #602)
InputHandler will set the browser pointer back to default if destroyed while over (fix #602)
Group.destroy has a new parameter: `soft`. A soft destruction won't remove the Group from its parent or null game references. Default is `false`.
InputHandler.validForInput is a new method that checks if the handler and its owner should be considered for Pointer input handling or not.
Group.replace will now return the old child, the one that was replaced in the Group.
2014-03-19 00:54:49 +00:00
photonstorm
664d5b3e2c Fixed issue where Image, Sprite, etc wouldn't call preUpdate or postUpdate of its children.
Fixed issue where renderOrderID wasn't being assigned correctly, causing the Input Handler to be unable to select the "top" item on a display list (would all default to zero)
Fixed issue where Stage would assign renderOrderIDs in reverse, should be in sequence.
Fixed issue where objects where checking World for the currentRenderOrderID by mistake instead of Stage.
Basically, input handling works a lot better now for Groups and nested objects :)
2014-02-28 19:45:15 +00:00
photonstorm
b255fea85f Time.advancedTiming is a new boolean property. If true Time.fps, fpsMin, fpsMax, frames, msMin and msMax will be calculated, otherwise they remain at their defaults. 2014-02-25 04:05:28 +00:00
photonstorm
415342d986 Vastly improved visibility API support + pageshow/pagehide + focus/blur. Working across Chrome, IE, Firefox, iOS, Android (also fixes #161) 2014-02-25 02:59:24 +00:00
photonstorm
0786e86ee5 Stage.scale has been moved to Game.scale. The same game scaling properties exist as before, but now accessed via Game.scale instead.
Stage.aspectRatio has been moved to StageScaleMode.sourceAspectRatio (so now game.scale.sourceAspectRatio)
Stage.scaleMode has been moved to StageScaleMode.scaleMode (so now game.scale.scaleMode)
Stage.fullScreenScaleMode has been moved to StageScaleMode.fullScreenScaleMode (so now game.scale.fullScreenScaleMode)
Stage.canvas has been removed. It was only ever an alias for Game.canvas anyway, so access it via that instead.
2014-02-13 12:50:10 +00:00
photonstorm
62aa0fc570 Remove some debug info. 2014-02-12 08:24:47 +00:00
photonstorm
ab5c07dfe8 Updated to Pixi 1.5 final.
InputHandler.pixelPerfectOver - performs a pixel perfect check to see if any pointer is over the current object (warning: very expensive!)
InputHandler.pixelPerfectClick - performs a pixel perfect check but only when the pointer touches/clicks on the current object.
2014-02-12 01:25:36 +00:00
photonstorm
ae74cb02dd Fixes #382 Error when using InputHandler#onInputUp & sprite destroys itself during the event. 2014-02-10 02:14:59 +00:00
photonstorm
0896c2fac7 Updating copyright year and README. 2014-02-05 16:54:59 +00:00
photonstorm
128c7143d5 Lots more physics tests and updates.
PLEASE DO NOT upgrade to this release if you need your game working and it uses any of the physics functions, as they're nearly all broken here.
Just pushing up so I can share it with someone.
2014-01-20 20:14:34 +00:00
photonstorm
ce4cf531d4 Added class constructors, fixed Stripshader, added relative Tween example and updated Tween source. 2013-12-30 16:54:00 +00:00
photonstorm
dd7ae12271 ArcadePhysics.overlap and collide now recognise TileSprites in the collision checks. 2013-12-17 16:48:03 +00:00
photonstorm
13a2cc2feb Updating all files to adhere to the JSHint settings and fixing lots of documentation errors on the way. 2013-11-25 03:13:04 +00:00
Richard Davey
6a24d6116b Lots of renderTexture updates and examples added 2013-11-13 06:49:24 +00:00
photonstorm
2e576fa9a7 Input Handler updates, orientation screen and World visibility 2013-11-04 20:44:32 +00:00
photonstorm
3c164b466c * Updated: event.preventDefault() has been added to all Mouse event handlers.
* Updated: Sprite.deltaX/Y removed due to non-use. prevX/Y values moved to Sprite._cache.prevX/Y.
* Updated: Due to missing extends parameter the Sprite prototype was picking up functions from classes it never meant to (Button, TilemapLayer), now fully isolated.
2013-11-01 02:07:21 +00:00