2013-10-02 14:05:55 +00:00
<!DOCTYPE html>
< html lang = "en" >
< head >
< meta charset = "utf-8" >
2015-03-23 23:46:30 +00:00
< title > Phaser Source: src/input/InputHandler.js< / title >
2013-10-02 14:05:55 +00:00
<!-- [if lt IE 9]>
< script src = "//html5shiv.googlecode.com/svn/trunk/html5.js" > < / script >
<![endif]-->
2014-11-15 20:01:46 +00:00
< link type = "text/css" rel = "stylesheet" href = "styles/default.css" >
2013-10-02 14:05:55 +00:00
< link type = "text/css" rel = "stylesheet" href = "styles/sunlight.default.css" >
< link type = "text/css" rel = "stylesheet" href = "styles/site.cerulean.css" >
< / head >
< body >
2014-11-25 00:23:44 +00:00
2013-10-02 14:05:55 +00:00
< div class = "container-fluid" >
< div class = "navbar navbar-fixed-top navbar-inverse" >
2014-11-25 00:23:44 +00:00
< div style = "position: absolute; width: 143px; height: 31px; right: 10px; top: 10px; z-index: 1050" > < a href = "http://phaser.io" > < img src = "img/phaser.png" border = "0" / > < / a > < / div >
2013-10-02 14:05:55 +00:00
< div class = "navbar-inner" >
2014-11-25 00:23:44 +00:00
< a class = "brand" href = "index.html" > Phaser API< / a >
2013-10-02 14:05:55 +00:00
< ul class = "nav" >
2014-11-25 00:23:44 +00:00
2013-10-02 14:05:55 +00:00
< li class = "dropdown" >
2013-10-03 01:38:35 +00:00
< a href = "namespaces.list.html" class = "dropdown-toggle" data-toggle = "dropdown" > Namespaces< b
2013-10-02 14:05:55 +00:00
class="caret">< / b > < / a >
< ul class = "dropdown-menu " >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-0" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.html" > Phaser< / a >
2013-10-02 14:05:55 +00:00
< / li >
2014-11-15 20:01:46 +00:00
< li class = "class-depth-0" >
< a href = "PIXI.html" > PIXI< / a >
< / li >
2013-10-02 14:05:55 +00:00
< / ul >
< / li >
< li class = "dropdown" >
< a href = "classes.list.html" class = "dropdown-toggle" data-toggle = "dropdown" > Classes< b
class="caret">< / b > < / a >
< ul class = "dropdown-menu " >
2016-08-26 00:18:47 +00:00
< li class = "class-depth-0" >
< a href = "Event.html" > Event< / a >
< / li >
< li class = "class-depth-0" >
< a href = "EventTarget.html" > EventTarget< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.Animation.html" > Animation< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.AnimationManager.html" > AnimationManager< / a >
2013-10-02 14:05:55 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.AnimationParser.html" > AnimationParser< / a >
2013-10-02 14:05:55 +00:00
< / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.ArraySet.html" > ArraySet< / a >
< / li >
2014-11-15 20:01:46 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.ArrayUtils.html" > ArrayUtils< / a >
< / li >
2014-10-09 15:12:53 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.AudioSprite.html" > AudioSprite< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.BitmapData.html" > BitmapData< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.BitmapText.html" > BitmapText< / a >
< / li >
2016-06-17 00:11:24 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.Bullet.html" > Bullet< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Button.html" > Button< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Cache.html" > Cache< / a >
2013-10-02 14:05:55 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Camera.html" > Camera< / a >
2013-10-02 14:05:55 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Canvas.html" > Canvas< / a >
2013-10-02 14:05:55 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Circle.html" > Circle< / a >
2013-10-02 14:05:55 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Color.html" > Color< / a >
2013-10-03 00:21:08 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-2" >
< a href = "Phaser.Component.Angle.html" > Angle< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.Animation.html" > Animation< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.AutoCull.html" > AutoCull< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.Bounds.html" > Bounds< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.BringToTop.html" > BringToTop< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.Core.html" > Core< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.Crop.html" > Crop< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.Delta.html" > Delta< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.Destroy.html" > Destroy< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.FixedToCamera.html" > FixedToCamera< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.Health.html" > Health< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.InCamera.html" > InCamera< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.InputEnabled.html" > InputEnabled< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.InWorld.html" > InWorld< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.LifeSpan.html" > LifeSpan< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.LoadTexture.html" > LoadTexture< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.Overlap.html" > Overlap< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.PhysicsBody.html" > PhysicsBody< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.Reset.html" > Reset< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.ScaleMinMax.html" > ScaleMinMax< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Component.Smoothed.html" > Smoothed< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.Create.html" > Create< / a >
< / li >
< li class = "class-depth-1" >
< a href = "Phaser.Creature.html" > Creature< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Device.html" > Device< / a >
2013-10-02 14:05:55 +00:00
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.DeviceButton.html" > DeviceButton< / a >
< / li >
2014-11-15 20:01:46 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.DOM.html" > DOM< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Easing.html" > Easing< / a >
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Back.html" > Back< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Bounce.html" > Bounce< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Circular.html" > Circular< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Cubic.html" > Cubic< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Elastic.html" > Elastic< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Exponential.html" > Exponential< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Linear.html" > Linear< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Quadratic.html" > Quadratic< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Quartic.html" > Quartic< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Quintic.html" > Quintic< / a >
< / li >
< li class = "class-depth-2" >
< a href = "Phaser.Easing.Sinusoidal.html" > Sinusoidal< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-18 03:01:51 +00:00
< a href = "Phaser.Ellipse.html" > Ellipse< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Events.html" > Events< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Filter.html" > Filter< / a >
< / li >
2014-09-09 14:36:56 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.FlexGrid.html" > FlexGrid< / a >
< / li >
< li class = "class-depth-1" >
< a href = "Phaser.FlexLayer.html" > FlexLayer< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Frame.html" > Frame< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.FrameData.html" > FrameData< / a >
2013-10-03 00:21:08 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.Game.html" > Game< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-21 15:37:26 +00:00
< a href = "Phaser.GameObjectCreator.html" > GameObjectCreator< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.GameObjectFactory.html" > GameObjectFactory< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-05 06:29:17 +00:00
< a href = "Phaser.Gamepad.html" > Gamepad< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Graphics.html" > Graphics< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.Group.html" > Group< / a >
< / li >
2016-08-26 00:18:47 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.Hermite.html" > Hermite< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-08 07:24:22 +00:00
< a href = "Phaser.Image.html" > Image< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.ImageCollection.html" > ImageCollection< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.Input.html" > Input< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.InputHandler.html" > InputHandler< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.Key.html" > Key< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.Keyboard.html" > Keyboard< / a >
< / li >
2016-08-26 00:18:47 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.KeyCode.html" > KeyCode< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-05 06:29:17 +00:00
< a href = "Phaser.Line.html" > Line< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.LinkedList.html" > LinkedList< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.Loader.html" > Loader< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.LoaderParser.html" > LoaderParser< / a >
2013-10-02 14:05:55 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.Math.html" > Math< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.Matrix.html" > Matrix< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.Mouse.html" > Mouse< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.MSPointer.html" > MSPointer< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 19:18:24 +00:00
< a href = "Phaser.Net.html" > Net< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.Particle.html" > Particle< / a >
< / li >
< li class = "class-depth-1" >
2013-10-02 19:18:24 +00:00
< a href = "Phaser.Particles.html" > Particles< / a >
< / li >
2014-10-09 15:12:53 +00:00
< li class = "class-depth-2" >
< a href = "Phaser.Particles.Arcade.html" > Arcade< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2013-10-02 19:18:24 +00:00
< a href = "Phaser.Particles.Arcade.Emitter.html" > Emitter< / a >
< / li >
2016-08-26 00:18:47 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.Path.html" > Path< / a >
< / li >
< li class = "class-depth-1" >
< a href = "Phaser.PathFollower.html" > PathFollower< / a >
< / li >
< li class = "class-depth-1" >
< a href = "Phaser.PathPoint.html" > PathPoint< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Physics.html" > Physics< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Physics.Arcade.html" > Arcade< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.Arcade.Body.html" > Body< / a >
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-3" >
2015-08-24 14:43:45 +00:00
< a href = "Phaser.Physics.Arcade.TilemapCollision.html" > TilemapCollision< / a >
2015-03-23 23:46:30 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.Ninja.html" > Ninja< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.Ninja.AABB.html" > AABB< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.Ninja.Body.html" > Body< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.Ninja.Circle.html" > Circle< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.Ninja.Tile.html" > Tile< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.html" > P2< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.Body.html" > Body< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.BodyDebug.html" > BodyDebug< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.CollisionGroup.html" > CollisionGroup< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.ContactMaterial.html" > ContactMaterial< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.DistanceConstraint.html" > DistanceConstraint< / a >
< / li >
2014-04-11 12:09:28 +00:00
< li class = "class-depth-3" >
< a href = "Phaser.Physics.P2.FixtureList.html" > FixtureList< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.GearConstraint.html" > GearConstraint< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.InversePointProxy.html" > InversePointProxy< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.LockConstraint.html" > LockConstraint< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.Material.html" > Material< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.PointProxy.html" > PointProxy< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.PrismaticConstraint.html" > PrismaticConstraint< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.RevoluteConstraint.html" > RevoluteConstraint< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-09-09 14:36:56 +00:00
< li class = "class-depth-3" >
< a href = "Phaser.Physics.P2.RotationalSpring.html" > RotationalSpring< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.Spring.html" > Spring< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.Plugin.html" > Plugin< / a >
< / li >
2016-08-26 00:18:47 +00:00
< li class = "class-depth-2" >
< a href = "Phaser.Plugin.PathManager.html" > PathManager< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.PluginManager.html" > PluginManager< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.Point.html" > Point< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.Pointer.html" > Pointer< / a >
< / li >
2015-10-15 11:06:38 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.PointerMode.html" > PointerMode< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-07 06:10:15 +00:00
< a href = "Phaser.Polygon.html" > Polygon< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.QuadTree.html" > QuadTree< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.RandomDataGenerator.html" > RandomDataGenerator< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.Rectangle.html" > Rectangle< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.RenderTexture.html" > RenderTexture< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.RequestAnimationFrame.html" > RequestAnimationFrame< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.RetroFont.html" > RetroFont< / a >
< / li >
2014-09-09 14:36:56 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.Rope.html" > Rope< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.RoundedRectangle.html" > RoundedRectangle< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.ScaleManager.html" > ScaleManager< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.Signal.html" > Signal< / a >
< / li >
2014-04-11 12:09:28 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.SignalBinding.html" > SignalBinding< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-05 06:29:17 +00:00
< a href = "Phaser.SinglePad.html" > SinglePad< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.Sound.html" > Sound< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.SoundManager.html" > SoundManager< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Sprite.html" > Sprite< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-18 03:01:51 +00:00
< a href = "Phaser.SpriteBatch.html" > SpriteBatch< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.Stage.html" > Stage< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.State.html" > State< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.StateManager.html" > StateManager< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Text.html" > Text< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Tile.html" > Tile< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Tilemap.html" > Tilemap< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.TilemapLayer.html" > TilemapLayer< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.TilemapParser.html" > TilemapParser< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Tileset.html" > Tileset< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.TileSprite.html" > TileSprite< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Time.html" > Time< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Timer.html" > Timer< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-05 06:29:17 +00:00
< a href = "Phaser.TimerEvent.html" > TimerEvent< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.Touch.html" > Touch< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Tween.html" > Tween< / a >
< / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.TweenData.html" > TweenData< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.TweenManager.html" > TweenManager< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Utils.html" > Utils< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Utils.Debug.html" > Debug< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2015-07-22 14:31:30 +00:00
< a href = "Phaser.Video.html" > Video< / a >
2013-10-02 14:05:55 +00:00
< / li >
2016-06-17 00:11:24 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.Weapon.html" > Weapon< / a >
< / li >
2014-11-15 20:01:46 +00:00
< li class = "class-depth-1" >
2015-07-22 14:31:30 +00:00
< a href = "Phaser.World.html" > World< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-07-22 14:31:30 +00:00
< a href = "PIXI.AbstractFilter.html" > AbstractFilter< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-07-22 14:31:30 +00:00
< a href = "PIXI.BaseTexture.html" > BaseTexture< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.CanvasBuffer.html" > CanvasBuffer< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.CanvasGraphics.html" > CanvasGraphics< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.CanvasMaskManager.html" > CanvasMaskManager< / a >
< / li >
2015-08-24 14:43:45 +00:00
< li class = "class-depth-1" >
< a href = "PIXI.CanvasPool.html" > CanvasPool< / a >
< / li >
2014-11-15 20:01:46 +00:00
< li class = "class-depth-1" >
< a href = "PIXI.CanvasRenderer.html" > CanvasRenderer< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.CanvasTinter.html" > CanvasTinter< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.ComplexPrimitiveShader.html" > ComplexPrimitiveShader< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.DisplayObjectContainer.html" > DisplayObjectContainer< / a >
< / li >
2016-02-08 17:01:36 +00:00
< li class = "class-depth-1" >
< a href = "PIXI.EarCut.html" > EarCut< / a >
< / li >
2014-11-15 20:01:46 +00:00
< li class = "class-depth-1" >
< a href = "PIXI.Event.html" > Event< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.EventTarget.html" > EventTarget< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.FilterTexture.html" > FilterTexture< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.Graphics.html" > Graphics< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.GraphicsData.html" > GraphicsData< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.PIXI.html" > PIXI< / a >
< / li >
2016-07-01 15:57:13 +00:00
< li class = "class-depth-2" >
< a href = "PIXI.PIXI.DisplayObject.html" > DisplayObject< / a >
< / li >
2014-11-15 20:01:46 +00:00
< li class = "class-depth-1" >
< a href = "PIXI.PixiFastShader.html" > PixiFastShader< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.PixiShader.html" > PixiShader< / a >
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.PrimitiveShader.html" > PrimitiveShader< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.RenderTexture.html" > RenderTexture< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.Rope.html" > Rope< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.Sprite.html" > Sprite< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.SpriteBatch.html" > SpriteBatch< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.Strip.html" > Strip< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.StripShader.html" > StripShader< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.Texture.html" > Texture< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.TilingSprite.html" > TilingSprite< / a >
2014-11-15 20:01:46 +00:00
< / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.WebGLBlendModeManager.html" > WebGLBlendModeManager< / a >
2014-11-25 00:23:44 +00:00
< / li >
2014-11-15 20:01:46 +00:00
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.WebGLFastSpriteBatch.html" > WebGLFastSpriteBatch< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.WebGLFilterManager.html" > WebGLFilterManager< / a >
2014-11-15 20:01:46 +00:00
< / li >
< li class = "class-depth-1" >
2015-03-23 23:46:30 +00:00
< a href = "PIXI.WebGLRenderer.html" > WebGLRenderer< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< / ul >
< / li >
< li class = "dropdown" >
< a href = "global.html" class = "dropdown-toggle" data-toggle = "dropdown" > Global< b
class="caret">< / b > < / a >
< ul class = "dropdown-menu " >
2016-06-03 17:48:34 +00:00
< li class = "class-depth-0" >
< a href = "global.html#ANGLE_DOWN" > ANGLE_DOWN< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#ANGLE_LEFT" > ANGLE_LEFT< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#ANGLE_NORTH_EAST" > ANGLE_NORTH_EAST< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#ANGLE_NORTH_WEST" > ANGLE_NORTH_WEST< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#ANGLE_RIGHT" > ANGLE_RIGHT< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#ANGLE_SOUTH_EAST" > ANGLE_SOUTH_EAST< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#ANGLE_SOUTH_WEST" > ANGLE_SOUTH_WEST< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#ANGLE_UP" > ANGLE_UP< / a >
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#AUTO" > AUTO< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#BITMAPDATA" > BITMAPDATA< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#BITMAPTEXT" > BITMAPTEXT< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
< a href = "global.html#blendModes" > blendModes< / a >
2014-11-15 20:01:46 +00:00
< / li >
2016-06-17 00:11:24 +00:00
< li class = "class-depth-0" >
< a href = "global.html#BOTTOM_CENTER" > BOTTOM_CENTER< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#BOTTOM_LEFT" > BOTTOM_LEFT< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#BOTTOM_RIGHT" > BOTTOM_RIGHT< / a >
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#BUTTON" > BUTTON< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#CANVAS" > CANVAS< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#CANVAS_FILTER" > CANVAS_FILTER< / a >
< / li >
2016-06-17 00:11:24 +00:00
< li class = "class-depth-0" >
< a href = "global.html#CENTER" > CENTER< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-0" >
< a href = "global.html#CIRCLE" > CIRCLE< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#CREATURE" > CREATURE< / a >
< / li >
2016-06-09 16:13:31 +00:00
< li class = "class-depth-0" >
< a href = "global.html#displayList" > displayList< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-0" >
< a href = "global.html#DOWN" > DOWN< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#ELLIPSE" > ELLIPSE< / a >
< / li >
2016-08-26 00:18:47 +00:00
< li class = "class-depth-0" >
< a href = "global.html#emit" > emit< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-0" >
< a href = "global.html#EMITTER" > EMITTER< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#GAMES" > GAMES< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#GRAPHICS" > GRAPHICS< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#GROUP" > GROUP< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#HEADLESS" > HEADLESS< / a >
2014-11-15 20:01:46 +00:00
< / li >
2016-06-09 16:13:31 +00:00
< li class = "class-depth-0" >
< a href = "global.html#HORIZONTAL" > HORIZONTAL< / a >
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#IMAGE" > IMAGE< / a >
2014-11-15 20:01:46 +00:00
< / li >
2016-06-09 16:13:31 +00:00
< li class = "class-depth-0" >
< a href = "global.html#LANDSCAPE" > LANDSCAPE< / a >
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#LEFT" > LEFT< / a >
2014-11-15 20:01:46 +00:00
< / li >
2016-06-17 00:11:24 +00:00
< li class = "class-depth-0" >
< a href = "global.html#LEFT_BOTTOM" > LEFT_BOTTOM< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#LEFT_CENTER" > LEFT_CENTER< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#LEFT_TOP" > LEFT_TOP< / a >
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#LINE" > LINE< / a >
< / li >
2016-08-26 00:18:47 +00:00
< li class = "class-depth-0" >
< a href = "global.html#listeners" > listeners< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-0" >
< a href = "global.html#MATRIX" > MATRIX< / a >
< / li >
2016-08-26 00:18:47 +00:00
< li class = "class-depth-0" >
< a href = "global.html#mixin" > mixin< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-0" >
< a href = "global.html#NONE" > NONE< / a >
< / li >
2016-08-26 00:18:47 +00:00
< li class = "class-depth-0" >
< a href = "global.html#off" > off< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#on" > on< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#once" > once< / a >
< / li >
2016-02-08 17:01:36 +00:00
< li class = "class-depth-0" >
< a href = "global.html#PENDING_ATLAS" > PENDING_ATLAS< / a >
< / li >
2016-08-26 00:18:47 +00:00
< li class = "class-depth-2" >
< a href = "global.html#Phaser.Path#numPointsreturn%257Bnumber%257DThetotalnumberofPathPointsinthisPath." > Phaser.Path#numPoints
return {number} The total number of PathPoints in this Path.< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-0" >
< a href = "global.html#POINT" > POINT< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#POINTER" > POINTER< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#POLYGON" > POLYGON< / a >
< / li >
2016-06-09 16:13:31 +00:00
< li class = "class-depth-0" >
< a href = "global.html#PORTRAIT" > PORTRAIT< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-0" >
< a href = "global.html#RECTANGLE" > RECTANGLE< / a >
< / li >
2016-08-26 00:18:47 +00:00
< li class = "class-depth-0" >
< a href = "global.html#removeAllListeners" > removeAllListeners< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-0" >
< a href = "global.html#RENDERTEXTURE" > RENDERTEXTURE< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#RETROFONT" > RETROFONT< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#RIGHT" > RIGHT< / a >
< / li >
2016-06-17 00:11:24 +00:00
< li class = "class-depth-0" >
< a href = "global.html#RIGHT_BOTTOM" > RIGHT_BOTTOM< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#RIGHT_CENTER" > RIGHT_CENTER< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#RIGHT_TOP" > RIGHT_TOP< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-0" >
< a href = "global.html#ROPE" > ROPE< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#ROUNDEDRECTANGLE" > ROUNDEDRECTANGLE< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
< a href = "global.html#scaleModes" > scaleModes< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#SPRITE" > SPRITE< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#SPRITEBATCH" > SPRITEBATCH< / a >
< / li >
2016-08-26 00:18:47 +00:00
< li class = "class-depth-0" >
< a href = "global.html#stopImmediatePropagation" > stopImmediatePropagation< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#stopPropagation" > stopPropagation< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-0" >
< a href = "global.html#TEXT" > TEXT< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#TILEMAP" > TILEMAP< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#TILEMAPLAYER" > TILEMAPLAYER< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#TILESPRITE" > TILESPRITE< / a >
< / li >
2016-06-17 00:11:24 +00:00
< li class = "class-depth-0" >
< a href = "global.html#TOP_CENTER" > TOP_CENTER< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#TOP_LEFT" > TOP_LEFT< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#TOP_RIGHT" > TOP_RIGHT< / a >
< / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-0" >
< a href = "global.html#UP" > UP< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#VERSION" > VERSION< / a >
2014-11-15 20:01:46 +00:00
< / li >
2016-06-09 16:13:31 +00:00
< li class = "class-depth-0" >
< a href = "global.html#VERTICAL" > VERTICAL< / a >
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#VIDEO" > VIDEO< / a >
2014-11-15 20:01:46 +00:00
< / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-0" >
2015-07-22 14:31:30 +00:00
< a href = "global.html#WEBGL" > WEBGL< / a >
< / li >
< li class = "class-depth-0" >
< a href = "global.html#WEBGL_FILTER" > WEBGL_FILTER< / a >
2014-11-15 20:01:46 +00:00
< / li >
2013-10-02 14:05:55 +00:00
< / ul >
< / li >
2014-11-25 00:23:44 +00:00
2014-11-15 20:01:46 +00:00
< li class = "dropdown" >
2014-11-25 00:23:44 +00:00
< a href = "#" class = "dropdown-toggle" data-toggle = "dropdown" > Core< b class = "caret" > < / b > < / a >
< ul class = "dropdown-menu " >
2014-12-03 10:39:11 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Game.html" > Game< / a > < / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Group.html" > Group< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.World.html" > World< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Loader.html" > Loader< / a > < / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Cache.html" > Cache< / a > < / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Time.html" > Time< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Camera.html" > Camera< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.StateManager.html" > State Manager< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.TweenManager.html" > Tween Manager< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.SoundManager.html" > Sound Manager< / a > < / li >
2015-01-06 06:57:25 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Input.html" > Input Manager< / a > < / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "Phaser.ScaleManager.html" > Scale Manager< / a > < / li >
< / ul >
< / li >
2014-11-15 20:01:46 +00:00
2014-11-25 00:23:44 +00:00
< li class = "dropdown" >
< a href = "#" class = "dropdown-toggle" data-toggle = "dropdown" > Game Objects< b class = "caret" > < / b > < / a >
2014-11-15 20:01:46 +00:00
< ul class = "dropdown-menu " >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "Phaser.GameObjectFactory.html" > Factory (game.add)< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.GameObjectCreator.html" > Creator (game.make)< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Sprite.html" > Sprite< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Image.html" > Image< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Sound.html" > Sound< / a > < / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Video.html" > Video< / a > < / li >
2015-01-06 06:57:25 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Particles.Arcade.Emitter.html" > Particle Emitter< / a > < / li >
2014-12-03 10:39:11 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Particle.html" > Particle< / a > < / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Text.html" > Text< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Tween.html" > Tween< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.BitmapText.html" > BitmapText< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Tilemap.html" > Tilemap< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.BitmapData.html" > BitmapData< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.RetroFont.html" > RetroFont< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Button.html" > Button< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Animation.html" > Animation< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Graphics.html" > Graphics< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.RenderTexture.html" > RenderTexture< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.TileSprite.html" > TileSprite< / a > < / li >
< / ul >
< / li >
< li class = "dropdown" >
< a href = "#" class = "dropdown-toggle" data-toggle = "dropdown" > Geometry< b class = "caret" > < / b > < / a >
< ul class = "dropdown-menu " >
< li class = "class-depth-1" > < a href = "Phaser.Circle.html" > Circle< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Ellipse.html" > Ellipse< / a > < / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Line.html" > Line< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Matrix.html" > Matrix< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Point.html" > Point< / a > < / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Polygon.html" > Polygon< / a > < / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Rectangle.html" > Rectangle< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.RoundedRectangle.html" > Rounded Rectangle< / a > < / li >
2014-11-25 00:23:44 +00:00
< / ul >
< / li >
2014-11-15 20:01:46 +00:00
2014-11-25 00:23:44 +00:00
< li class = "dropdown" >
< a href = "#" class = "dropdown-toggle" data-toggle = "dropdown" > Physics< b class = "caret" > < / b > < / a >
< ul class = "dropdown-menu " >
< li class = "class-depth-1" > < a href = "Phaser.Physics.Arcade.html" > Arcade Physics< / a > < / li >
< li class = "class-depth-2" > < a href = "Phaser.Physics.Arcade.Body.html" > Body< / a > < / li >
2016-06-17 00:11:24 +00:00
< li class = "class-depth-2" > < a href = "Phaser.Weapon.html" > Weapon< / a > < / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Physics.P2.html" > P2 Physics< / a > < / li >
< li class = "class-depth-2" > < a href = "Phaser.Physics.P2.Body.html" > Body< / a > < / li >
< li class = "class-depth-2" > < a href = "Phaser.Physics.P2.Spring.html" > Spring< / a > < / li >
< li class = "class-depth-2" > < a href = "Phaser.Physics.P2.CollisionGroup.html" > CollisionGroup< / a > < / li >
< li class = "class-depth-2" > < a href = "Phaser.Physics.P2.ContactMaterial.html" > ContactMaterial< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Physics.Ninja.html" > Ninja Physics< / a > < / li >
< li class = "class-depth-2" > < a href = "Phaser.Physics.Body.html" > Body< / a > < / li >
2014-11-15 20:01:46 +00:00
< / ul >
< / li >
2014-11-25 00:23:44 +00:00
< li class = "dropdown" >
< a href = "#" class = "dropdown-toggle" data-toggle = "dropdown" > Input< b class = "caret" > < / b > < / a >
< ul class = "dropdown-menu " >
< li class = "class-depth-1" > < a href = "Phaser.InputHandler.html" > Input Handler< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Pointer.html" > Pointer< / a > < / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" > < a href = "Phaser.DeviceButton.html" > Device Button< / a > < / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Mouse.html" > Mouse< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Keyboard.html" > Keyboard< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Key.html" > Key< / a > < / li >
2016-08-26 00:18:47 +00:00
< li class = "class-depth-1" > < a href = "Phaser.KeyCode.html" > Key Codes< / a > < / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Gamepad.html" > Gamepad< / a > < / li >
< / ul >
< / li >
< li class = "dropdown" >
< a href = "#" class = "dropdown-toggle" data-toggle = "dropdown" > Community< b class = "caret" > < / b > < / a >
< ul class = "dropdown-menu " >
2015-03-26 02:55:18 +00:00
< li class = "class-depth-1" > < a href = "http://phaser.io" > Phaser Web Site< / a > < / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "https://github.com/photonstorm/phaser" > Phaser Github< / a > < / li >
2015-03-26 02:55:18 +00:00
< li class = "class-depth-1" > < a href = "http://phaser.io/examples" > Phaser Examples< / a > < / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "https://github.com/photonstorm/phaser-plugins" > Phaser Plugins< / a > < / li >
< li class = "class-depth-1" > < a href = "http://www.html5gamedevs.com/forum/14-phaser/" > Forum< / a > < / li >
< li class = "class-depth-1" > < a href = "http://stackoverflow.com/questions/tagged/phaser-framework" > Stack Overflow< / a > < / li >
2015-07-22 14:31:30 +00:00
< li class = "class-depth-1" > < a href = "http://phaser.io/learn" > Tutorials< / a > < / li >
2016-05-19 11:36:51 +00:00
< li class = "class-depth-1" > < a href = "http://phaser.io/community/newsletter" > Newsletter< / a > < / li >
2015-03-26 02:55:18 +00:00
< li class = "class-depth-1" > < a href = "http://phaser.io/community/twitter" > Twitter< / a > < / li >
2016-06-17 00:11:24 +00:00
< li class = "class-depth-1" > < a href = "http://phaser.io/community/slack" > Slack< / a > < / li >
< li class = "class-depth-1" > < a href = "http://phaser.io/community/donate" > Donate< / a > < / li >
2015-03-23 23:46:30 +00:00
< li class = "class-depth-1" > < a href = "https://www.codeandweb.com/texturepacker/phaser" > Texture Packer< / a > < / li >
2014-11-25 00:23:44 +00:00
< / ul >
< / li >
2013-10-02 14:05:55 +00:00
< / ul >
< / div >
< / div >
< div class = "row-fluid" >
< div class = "span12" >
< div id = "main" >
2015-03-23 23:46:30 +00:00
< h1 class = "page-title" > Source: src/input/InputHandler.js< / h1 >
2013-10-02 14:05:55 +00:00
< section >
< article >
< pre class = "sunlight-highlight-javascript linenums" > /**
* @author Richard Davey < rich@photonstorm.com>
2016-04-22 14:15:28 +00:00
* @copyright 2016 Photon Storm Ltd.
2013-10-02 14:05:55 +00:00
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
2013-11-28 15:57:09 +00:00
* The Input Handler is bound to a specific Sprite and is responsible for managing all Input events on that Sprite.
2014-10-22 20:49:44 +00:00
*
2013-10-02 14:05:55 +00:00
* @class Phaser.InputHandler
* @constructor
2013-11-28 15:57:09 +00:00
* @param {Phaser.Sprite} sprite - The Sprite object to which this Input Handler belongs.
2013-10-02 14:05:55 +00:00
*/
Phaser.InputHandler = function (sprite) {
2013-11-28 15:57:09 +00:00
/**
* @property {Phaser.Sprite} sprite - The Sprite object to which this Input Handler belongs.
*/
this.sprite = sprite;
2013-10-02 14:05:55 +00:00
/**
2014-03-28 01:42:49 +00:00
* @property {Phaser.Game} game - A reference to the currently running game.
2013-10-02 14:05:55 +00:00
*/
this.game = sprite.game;
2013-11-28 15:57:09 +00:00
/**
* @property {boolean} enabled - If enabled the Input Handler will process input requests and monitor pointer activity.
* @default
*/
2013-10-02 14:05:55 +00:00
this.enabled = false;
2014-07-18 11:45:51 +00:00
/**
* @property {boolean} checked - A disposable flag used by the Pointer class when performing priority checks.
* @protected
*/
this.checked = false;
2013-11-28 15:57:09 +00:00
/**
2014-04-29 14:39:02 +00:00
* The priorityID is used to determine which game objects should get priority when input events occur. For example if you have
* several Sprites that overlap, by default the one at the top of the display list is given priority for input events. You can
* stop this from happening by controlling the priorityID value. The higher the value, the more important they are considered to the Input events.
* @property {number} priorityID
2013-11-28 15:57:09 +00:00
* @default
*/
2013-10-02 14:05:55 +00:00
this.priorityID = 0;
2014-03-28 01:42:49 +00:00
2013-11-28 15:57:09 +00:00
/**
* @property {boolean} useHandCursor - On a desktop browser you can set the 'hand' cursor to appear when moving over the Sprite.
* @default
*/
2013-10-02 14:05:55 +00:00
this.useHandCursor = false;
2014-03-28 01:42:49 +00:00
2014-03-24 12:41:45 +00:00
/**
* @property {boolean} _setHandCursor - Did this Sprite trigger the hand cursor?
* @private
*/
this._setHandCursor = false;
2013-11-28 15:57:09 +00:00
/**
* @property {boolean} isDragged - true if the Sprite is being currently dragged.
* @default
*/
2013-10-02 14:05:55 +00:00
this.isDragged = false;
2014-03-28 01:42:49 +00:00
2013-11-28 15:57:09 +00:00
/**
* @property {boolean} allowHorizontalDrag - Controls if the Sprite is allowed to be dragged horizontally.
* @default
*/
2013-10-02 14:05:55 +00:00
this.allowHorizontalDrag = true;
2014-03-28 01:42:49 +00:00
2013-11-28 15:57:09 +00:00
/**
* @property {boolean} allowVerticalDrag - Controls if the Sprite is allowed to be dragged vertically.
* @default
*/
2013-10-02 14:05:55 +00:00
this.allowVerticalDrag = true;
2014-03-28 01:42:49 +00:00
2013-11-28 15:57:09 +00:00
/**
* @property {boolean} bringToTop - If true when this Sprite is clicked or dragged it will automatically be bought to the top of the Group it is within.
* @default
*/
2013-10-02 14:05:55 +00:00
this.bringToTop = false;
2013-11-28 15:57:09 +00:00
/**
* @property {Phaser.Point} snapOffset - A Point object that contains by how far the Sprite snap is offset.
* @default
*/
2013-10-02 14:05:55 +00:00
this.snapOffset = null;
2014-03-28 01:42:49 +00:00
2013-11-28 15:57:09 +00:00
/**
* @property {boolean} snapOnDrag - When the Sprite is dragged this controls if the center of the Sprite will snap to the pointer on drag or not.
* @default
*/
2013-10-02 14:05:55 +00:00
this.snapOnDrag = false;
2014-03-28 01:42:49 +00:00
2013-11-28 15:57:09 +00:00
/**
* @property {boolean} snapOnRelease - When the Sprite is dragged this controls if the Sprite will be snapped on release.
* @default
*/
2013-10-02 14:05:55 +00:00
this.snapOnRelease = false;
2014-03-28 01:42:49 +00:00
2013-11-28 15:57:09 +00:00
/**
* @property {number} snapX - When a Sprite has snapping enabled this holds the width of the snap grid.
* @default
*/
2013-10-02 14:05:55 +00:00
this.snapX = 0;
2014-03-28 01:42:49 +00:00
2013-11-28 15:57:09 +00:00
/**
* @property {number} snapY - When a Sprite has snapping enabled this holds the height of the snap grid.
* @default
*/
2013-10-02 14:05:55 +00:00
this.snapY = 0;
2014-02-05 06:29:17 +00:00
/**
* @property {number} snapOffsetX - This defines the top-left X coordinate of the snap grid.
* @default
*/
this.snapOffsetX = 0;
2014-03-28 01:42:49 +00:00
2014-02-05 06:29:17 +00:00
/**
* @property {number} snapOffsetY - This defines the top-left Y coordinate of the snap grid..
* @default
*/
this.snapOffsetY = 0;
2013-11-28 15:57:09 +00:00
/**
2014-02-18 03:01:51 +00:00
* Set to true to use pixel perfect hit detection when checking if the pointer is over this Sprite.
* The x/y coordinates of the pointer are tested against the image in combination with the InputHandler.pixelPerfectAlpha value.
2015-03-23 23:46:30 +00:00
* This feature only works for display objects with image based textures such as Sprites. It won't work on BitmapText or Rope.
2014-02-18 03:01:51 +00:00
* Warning: This is expensive, especially on mobile (where it's not even needed!) so only enable if required. Also see the less-expensive InputHandler.pixelPerfectClick.
2015-03-23 23:46:30 +00:00
* @property {boolean} pixelPerfectOver - Use a pixel perfect check when testing for pointer over.
2013-11-28 15:57:09 +00:00
* @default
*/
2014-02-18 03:01:51 +00:00
this.pixelPerfectOver = false;
/**
* Set to true to use pixel perfect hit detection when checking if the pointer is over this Sprite when it's clicked or touched.
* The x/y coordinates of the pointer are tested against the image in combination with the InputHandler.pixelPerfectAlpha value.
2015-03-23 23:46:30 +00:00
* This feature only works for display objects with image based textures such as Sprites. It won't work on BitmapText or Rope.
2014-02-18 03:01:51 +00:00
* Warning: This is expensive so only enable if you really need it.
2015-03-23 23:46:30 +00:00
* @property {boolean} pixelPerfectClick - Use a pixel perfect check when testing for clicks or touches on the Sprite.
2014-02-18 03:01:51 +00:00
* @default
*/
this.pixelPerfectClick = false;
2013-10-02 14:05:55 +00:00
/**
* @property {number} pixelPerfectAlpha - The alpha tolerance threshold. If the alpha value of the pixel matches or is above this value, it's considered a hit.
* @default
*/
this.pixelPerfectAlpha = 255;
/**
* @property {boolean} draggable - Is this sprite allowed to be dragged by the mouse? true = yes, false = no
2014-03-28 01:42:49 +00:00
* @default
2013-10-02 14:05:55 +00:00
*/
this.draggable = false;
/**
2013-11-28 15:57:09 +00:00
* @property {Phaser.Rectangle} boundsRect - A region of the game world within which the sprite is restricted during drag.
2014-03-28 01:42:49 +00:00
* @default
2013-10-02 14:05:55 +00:00
*/
this.boundsRect = null;
/**
2013-11-28 15:57:09 +00:00
* @property {Phaser.Sprite} boundsSprite - A Sprite the bounds of which this sprite is restricted during drag.
2013-10-02 14:05:55 +00:00
* @default
*/
this.boundsSprite = null;
2014-10-09 15:12:53 +00:00
/**
* @property {boolean} scaleLayer - EXPERIMENTAL: Please do not use this property unless you know what it does. Likely to change in the future.
*/
this.scaleLayer = false;
2015-03-23 23:46:30 +00:00
/**
* @property {Phaser.Point} dragOffset - The offset from the Sprites position that dragging takes place from.
*/
this.dragOffset = new Phaser.Point();
/**
* @property {boolean} dragFromCenter - Is the Sprite dragged from its center, or the point at which the Pointer was pressed down upon it?
*/
this.dragFromCenter = false;
2016-06-09 16:13:31 +00:00
/**
* @property {boolean} dragStopBlocksInputUp - If enabled, when the Sprite stops being dragged, it will only dispatch the `onDragStop` event, and not the `onInputUp` event. If set to `false` it will dispatch both events.
*/
this.dragStopBlocksInputUp = false;
2015-03-23 23:46:30 +00:00
/**
* @property {Phaser.Point} dragStartPoint - The Point from which the most recent drag started from. Useful if you need to return an object to its starting position.
*/
this.dragStartPoint = new Phaser.Point();
2016-06-09 16:13:31 +00:00
/**
* @property {integer} dragDistanceThreshold - The distance, in pixels, the pointer has to move while being held down, before the Sprite thinks it is being dragged.
*/
this.dragDistanceThreshold = 0;
/**
* @property {integer} dragTimeThreshold - The amount of time, in ms, the pointer has to be held down over the Sprite before it thinks it is being dragged.
*/
this.dragTimeThreshold = 0;
/**
* @property {Phaser.Point} downPoint - A Point object containing the coordinates of the Pointer when it was first pressed down onto this Sprite.
*/
this.downPoint = new Phaser.Point();
2015-07-22 14:31:30 +00:00
/**
* @property {Phaser.Point} snapPoint - If the sprite is set to snap while dragging this holds the point of the most recent 'snap' event.
*/
this.snapPoint = new Phaser.Point();
2015-03-23 23:46:30 +00:00
/**
* @property {Phaser.Point} _dragPoint - Internal cache var.
* @private
*/
this._dragPoint = new Phaser.Point();
2014-05-20 09:12:48 +00:00
/**
* @property {boolean} _dragPhase - Internal cache var.
* @private
*/
this._dragPhase = false;
2016-06-09 16:13:31 +00:00
/**
* @property {boolean} _pendingDrag - Internal cache var.
* @private
*/
this._pendingDrag = false;
/**
* @property {boolean} _dragTimePass - Internal cache var.
* @private
*/
this._dragTimePass = false;
/**
* @property {boolean} _dragDistancePass - Internal cache var.
* @private
*/
this._dragDistancePass = false;
2014-04-11 12:09:28 +00:00
/**
* @property {boolean} _wasEnabled - Internal cache var.
* @private
*/
this._wasEnabled = false;
2013-10-02 14:05:55 +00:00
/**
2014-02-18 03:01:51 +00:00
* @property {Phaser.Point} _tempPoint - Internal cache var.
2013-10-02 14:05:55 +00:00
* @private
*/
2013-11-28 15:57:09 +00:00
this._tempPoint = new Phaser.Point();
2013-10-02 14:05:55 +00:00
2014-02-18 03:01:51 +00:00
/**
* @property {array} _pointerData - Internal cache var.
* @private
*/
2013-10-02 14:05:55 +00:00
this._pointerData = [];
this._pointerData.push({
id: 0,
x: 0,
y: 0,
2016-04-22 14:15:28 +00:00
camX: 0,
camY: 0,
2013-10-02 14:05:55 +00:00
isDown: false,
isUp: false,
isOver: false,
isOut: false,
timeOver: 0,
timeOut: 0,
timeDown: 0,
timeUp: 0,
downDuration: 0,
isDragged: false
});
};
Phaser.InputHandler.prototype = {
2013-11-28 15:57:09 +00:00
/**
* Starts the Input Handler running. This is called automatically when you enable input on a Sprite, or can be called directly if you need to set a specific priority.
2016-07-01 15:57:13 +00:00
*
2013-11-28 15:57:09 +00:00
* @method Phaser.InputHandler#start
2016-07-01 15:57:13 +00:00
* @param {number} [priority=0] - Higher priority sprites take click priority over low-priority sprites when they are stacked on-top of each other.
* @param {boolean} [useHandCursor=false] - If true the Sprite will show the hand cursor on mouse-over (doesn't apply to mobile browsers)
2013-11-28 15:57:09 +00:00
* @return {Phaser.Sprite} The Sprite object to which the Input Handler is bound.
*/
start: function (priority, useHandCursor) {
priority = priority || 0;
2015-07-22 14:31:30 +00:00
if (useHandCursor === undefined) { useHandCursor = false; }
2013-10-02 14:05:55 +00:00
// Turning on
2013-11-28 15:57:09 +00:00
if (this.enabled === false)
2013-10-02 14:05:55 +00:00
{
// Register, etc
2013-11-28 15:57:09 +00:00
this.game.input.interactiveItems.add(this);
2013-10-02 14:05:55 +00:00
this.useHandCursor = useHandCursor;
this.priorityID = priority;
for (var i = 0; i < 10; i++)
{
this._pointerData[i] = {
id: i,
x: 0,
y: 0,
isDown: false,
isUp: false,
isOver: false,
isOut: false,
timeOver: 0,
timeOut: 0,
timeDown: 0,
timeUp: 0,
downDuration: 0,
isDragged: false
};
}
2013-11-28 15:57:09 +00:00
this.snapOffset = new Phaser.Point();
2013-10-02 14:05:55 +00:00
this.enabled = true;
2014-04-11 12:09:28 +00:00
this._wasEnabled = true;
2013-10-02 14:05:55 +00:00
}
2014-04-11 12:09:28 +00:00
this.sprite.events.onAddedToGroup.add(this.addedToGroup, this);
this.sprite.events.onRemovedFromGroup.add(this.removedFromGroup, this);
2013-10-02 14:05:55 +00:00
return this.sprite;
2013-11-28 15:57:09 +00:00
},
2013-10-02 14:05:55 +00:00
2014-04-11 12:09:28 +00:00
/**
* Handles when the parent Sprite is added to a new Group.
*
* @method Phaser.InputHandler#addedToGroup
* @private
*/
addedToGroup: function () {
2014-05-20 09:12:48 +00:00
if (this._dragPhase)
{
return;
}
2015-03-23 23:46:30 +00:00
if (this._wasEnabled & & !this.enabled)
2014-04-11 12:09:28 +00:00
{
this.start();
}
},
/**
* Handles when the parent Sprite is removed from a Group.
*
* @method Phaser.InputHandler#removedFromGroup
* @private
*/
removedFromGroup: function () {
2014-05-20 09:12:48 +00:00
if (this._dragPhase)
{
return;
}
2014-04-11 12:09:28 +00:00
if (this.enabled)
{
this._wasEnabled = true;
this.stop();
}
else
{
this._wasEnabled = false;
}
},
2013-11-28 15:57:09 +00:00
/**
* Resets the Input Handler and disables it.
* @method Phaser.InputHandler#reset
*/
2013-10-02 14:05:55 +00:00
reset: function () {
this.enabled = false;
for (var i = 0; i < 10; i++)
{
this._pointerData[i] = {
id: i,
x: 0,
y: 0,
isDown: false,
isUp: false,
isOver: false,
isOut: false,
timeOver: 0,
timeOut: 0,
timeDown: 0,
timeUp: 0,
downDuration: 0,
isDragged: false
};
}
},
2013-11-28 15:57:09 +00:00
/**
* Stops the Input Handler from running.
* @method Phaser.InputHandler#stop
*/
stop: function () {
2013-10-02 14:05:55 +00:00
// Turning off
2013-11-28 15:57:09 +00:00
if (this.enabled === false)
2013-10-02 14:05:55 +00:00
{
return;
}
else
{
// De-register, etc
this.enabled = false;
2013-11-28 15:57:09 +00:00
this.game.input.interactiveItems.remove(this);
2013-10-02 14:05:55 +00:00
}
2013-11-28 15:57:09 +00:00
},
2013-10-02 14:05:55 +00:00
2013-11-28 15:57:09 +00:00
/**
* Clean up memory.
* @method Phaser.InputHandler#destroy
*/
2013-10-02 14:05:55 +00:00
destroy: function () {
2014-04-29 14:39:02 +00:00
if (this.sprite)
2013-10-02 14:05:55 +00:00
{
2014-03-24 12:41:45 +00:00
if (this._setHandCursor)
{
this.game.canvas.style.cursor = "default";
this._setHandCursor = false;
}
2013-10-25 15:54:40 +00:00
this.enabled = false;
this.game.input.interactiveItems.remove(this);
2014-02-18 03:01:51 +00:00
this._pointerData.length = 0;
this.boundsRect = null;
this.boundsSprite = null;
2013-11-28 15:57:09 +00:00
this.sprite = null;
2013-10-02 14:05:55 +00:00
}
2014-02-18 03:01:51 +00:00
2013-10-02 14:05:55 +00:00
},
2014-03-24 12:41:45 +00:00
/**
* Checks if the object this InputHandler is bound to is valid for consideration in the Pointer move event.
* This is called by Phaser.Pointer and shouldn't typically be called directly.
*
* @method Phaser.InputHandler#validForInput
* @protected
* @param {number} highestID - The highest ID currently processed by the Pointer.
* @param {number} highestRenderID - The highest Render Order ID currently processed by the Pointer.
2014-07-18 11:45:51 +00:00
* @param {boolean} [includePixelPerfect=true] - If this object has `pixelPerfectClick` or `pixelPerfectOver` set should it be considered as valid?
2014-03-24 12:41:45 +00:00
* @return {boolean} True if the object this InputHandler is bound to should be considered as valid for input detection.
*/
2014-07-18 11:45:51 +00:00
validForInput: function (highestID, highestRenderID, includePixelPerfect) {
2015-07-22 14:31:30 +00:00
if (includePixelPerfect === undefined) { includePixelPerfect = true; }
2014-03-24 12:41:45 +00:00
2016-06-09 16:13:31 +00:00
if (!this.enabled ||
this.sprite.scale.x === 0 ||
this.sprite.scale.y === 0 ||
this.priorityID < this.game.input.minPriorityID ||
(this.sprite.parent & & this.sprite.parent.ignoreChildInput))
2014-03-24 12:41:45 +00:00
{
return false;
}
2014-07-18 11:45:51 +00:00
// If we're trying to specifically IGNORE pixel perfect objects, then set includePixelPerfect to false and skip it
2015-03-23 23:46:30 +00:00
if (!includePixelPerfect & & (this.pixelPerfectClick || this.pixelPerfectOver))
2014-03-24 12:41:45 +00:00
{
2014-07-18 11:45:51 +00:00
return false;
2014-03-24 12:41:45 +00:00
}
2016-06-09 16:13:31 +00:00
if (this.priorityID > highestID || (this.priorityID === highestID & & this.sprite.renderOrderID > highestRenderID))
2014-03-24 12:41:45 +00:00
{
return true;
}
return false;
},
2014-07-18 11:45:51 +00:00
/**
* Is this object using pixel perfect checking?
*
* @method Phaser.InputHandler#isPixelPerfect
* @return {boolean} True if the this InputHandler has either `pixelPerfectClick` or `pixelPerfectOver` set to `true`.
*/
isPixelPerfect: function () {
return (this.pixelPerfectClick || this.pixelPerfectOver);
},
2013-11-28 15:57:09 +00:00
/**
2013-10-02 14:05:55 +00:00
* The x coordinate of the Input pointer, relative to the top-left of the parent Sprite.
* This value is only set when the pointer is over this Sprite.
2014-10-22 20:49:44 +00:00
*
2013-10-02 14:05:55 +00:00
* @method Phaser.InputHandler#pointerX
2015-10-15 11:06:38 +00:00
* @param {integer} [pointerId=0]
2013-10-02 14:05:55 +00:00
* @return {number} The x coordinate of the Input pointer.
2013-11-28 15:57:09 +00:00
*/
2015-10-15 11:06:38 +00:00
pointerX: function (pointerId) {
2013-10-02 14:05:55 +00:00
2015-10-15 11:06:38 +00:00
pointerId = pointerId || 0;
2013-10-02 14:05:55 +00:00
2015-10-15 11:06:38 +00:00
return this._pointerData[pointerId].x;
2013-10-02 14:05:55 +00:00
},
2013-11-28 15:57:09 +00:00
/**
2013-10-02 14:05:55 +00:00
* The y coordinate of the Input pointer, relative to the top-left of the parent Sprite
* This value is only set when the pointer is over this Sprite.
2014-10-22 20:49:44 +00:00
*
2013-10-02 14:05:55 +00:00
* @method Phaser.InputHandler#pointerY
2015-10-15 11:06:38 +00:00
* @param {integer} [pointerId=0]
2013-10-02 14:05:55 +00:00
* @return {number} The y coordinate of the Input pointer.
*/
2015-10-15 11:06:38 +00:00
pointerY: function (pointerId) {
2013-10-02 14:05:55 +00:00
2015-10-15 11:06:38 +00:00
pointerId = pointerId || 0;
2013-10-02 14:05:55 +00:00
2015-10-15 11:06:38 +00:00
return this._pointerData[pointerId].y;
2013-10-02 14:05:55 +00:00
},
2013-11-28 15:57:09 +00:00
/**
2015-10-15 11:06:38 +00:00
* If the Pointer is down this returns true.
* This *only* checks if the Pointer is down, not if it's down over any specific Sprite.
2014-10-22 20:49:44 +00:00
*
2013-10-02 14:05:55 +00:00
* @method Phaser.InputHandler#pointerDown
2015-10-15 11:06:38 +00:00
* @param {integer} [pointerId=0]
2014-09-09 14:36:56 +00:00
* @return {boolean} - True if the given pointer is down, otherwise false.
2013-10-02 14:05:55 +00:00
*/
2015-10-15 11:06:38 +00:00
pointerDown: function (pointerId) {
2013-10-02 14:05:55 +00:00
2015-10-15 11:06:38 +00:00
pointerId = pointerId || 0;
2013-10-02 14:05:55 +00:00
2015-10-15 11:06:38 +00:00
return this._pointerData[pointerId].isDown;
2013-10-02 14:05:55 +00:00
},
2013-11-28 15:57:09 +00:00
/**
2015-10-15 11:06:38 +00:00
* If the Pointer is up this returns true.
* This *only* checks if the Pointer is up, not if it's up over any specific Sprite.
2014-10-22 20:49:44 +00:00
*
2013-10-02 14:05:55 +00:00
* @method Phaser.InputHandler#pointerUp
2015-10-15 11:06:38 +00:00
* @param {integer} [pointerId=0]
2014-09-09 14:36:56 +00:00
* @return {boolean} - True if the given pointer is up, otherwise false.
2013-10-02 14:05:55 +00:00
*/
2015-10-15 11:06:38 +00:00
pointerUp: function (pointerId) {
2013-10-02 14:05:55 +00:00
2015-10-15 11:06:38 +00:00
pointerId = pointerId || 0;
2013-10-02 14:05:55 +00:00
2015-10-15 11:06:38 +00:00
return this._pointerData[pointerId].isUp;
2013-10-02 14:05:55 +00:00
},
2013-11-28 15:57:09 +00:00
/**
2013-10-02 14:05:55 +00:00
* A timestamp representing when the Pointer first touched the touchscreen.
2014-10-22 20:49:44 +00:00
*
2013-10-02 14:05:55 +00:00
* @method Phaser.InputHandler#pointerTimeDown
2015-10-15 11:06:38 +00:00
* @param {integer} [pointerId=(check all)]
2013-10-02 14:05:55 +00:00
* @return {number}
*/
2015-10-15 11:06:38 +00:00
pointerTimeDown: function (pointerId) {
2013-10-02 14:05:55 +00:00
2015-10-15 11:06:38 +00:00
pointerId = pointerId || 0;
2013-10-02 14:05:55 +00:00
2015-10-15 11:06:38 +00:00
return this._pointerData[pointerId].timeDown;
2013-10-02 14:05:55 +00:00
},
2013-11-28 15:57:09 +00:00
/**
2013-10-02 14:05:55 +00:00
* A timestamp representing when the Pointer left the touchscreen.
2015-10-15 11:06:38 +00:00
*
2013-10-02 14:05:55 +00:00
* @method Phaser.InputHandler#pointerTimeUp
2015-10-15 11:06:38 +00:00
* @param {integer} [pointerId=0]
2013-10-02 14:05:55 +00:00
* @return {number}
*/
2015-10-15 11:06:38 +00:00
pointerTimeUp: function (pointerId) {
2013-10-02 14:05:55 +00:00
2015-10-15 11:06:38 +00:00
pointerId = pointerId || 0;
2013-10-02 14:05:55 +00:00
2015-10-15 11:06:38 +00:00
return this._pointerData[pointerId].timeUp;
2013-10-02 14:05:55 +00:00
},
2013-11-28 15:57:09 +00:00
/**
2013-10-02 14:05:55 +00:00
* Is the Pointer over this Sprite?
2014-10-22 20:49:44 +00:00
*
2013-10-02 14:05:55 +00:00
* @method Phaser.InputHandler#pointerOver
2015-10-15 11:06:38 +00:00
* @param {integer} [pointerId=(check all)] The ID number of a Pointer to check. If you don't provide a number it will check all Pointers.
2014-09-09 14:36:56 +00:00
* @return {boolean} - True if the given pointer (if a index was given, or any pointer if not) is over this object.
2013-10-02 14:05:55 +00:00
*/
2015-10-15 11:06:38 +00:00
pointerOver: function (pointerId) {
2013-10-02 14:05:55 +00:00
2015-10-15 11:06:38 +00:00
if (!this.enabled)
2013-11-07 06:10:15 +00:00
{
2015-10-15 11:06:38 +00:00
return false;
}
if (pointerId === undefined)
{
for (var i = 0; i < 10; i++)
2013-11-07 06:10:15 +00:00
{
2015-10-15 11:06:38 +00:00
if (this._pointerData[i].isOver)
2013-11-07 06:10:15 +00:00
{
2015-10-15 11:06:38 +00:00
return true;
2013-11-07 06:10:15 +00:00
}
}
2016-02-17 13:27:09 +00:00
return false;
2013-11-07 06:10:15 +00:00
}
2015-10-15 11:06:38 +00:00
else
{
return this._pointerData[pointerId].isOver;
}
2013-10-02 14:05:55 +00:00
},
2013-11-28 15:57:09 +00:00
/**
2013-10-02 14:05:55 +00:00
* Is the Pointer outside of this Sprite?
2015-10-15 11:06:38 +00:00
*
2013-10-02 14:05:55 +00:00
* @method Phaser.InputHandler#pointerOut
2015-10-15 11:06:38 +00:00
* @param {integer} [pointerId=(check all)] The ID number of a Pointer to check. If you don't provide a number it will check all Pointers.
2013-11-07 06:10:15 +00:00
* @return {boolean} True if the given pointer (if a index was given, or any pointer if not) is out of this object.
2013-10-02 14:05:55 +00:00
*/
2015-10-15 11:06:38 +00:00
pointerOut: function (pointerId) {
2013-10-02 14:05:55 +00:00
2015-10-15 11:06:38 +00:00
if (!this.enabled)
2013-11-07 06:10:15 +00:00
{
2015-10-15 11:06:38 +00:00
return false;
}
if (pointerId === undefined)
{
for (var i = 0; i < 10; i++)
2013-11-07 06:10:15 +00:00
{
2015-10-15 11:06:38 +00:00
if (this._pointerData[i].isOut)
2013-11-07 06:10:15 +00:00
{
2015-10-15 11:06:38 +00:00
return true;
2013-11-07 06:10:15 +00:00
}
}
}
2015-10-15 11:06:38 +00:00
else
{
return this._pointerData[pointerId].isOut;
}
2013-10-02 14:05:55 +00:00
},
2013-11-28 15:57:09 +00:00
/**
2013-10-02 14:05:55 +00:00
* A timestamp representing when the Pointer first touched the touchscreen.
2015-10-15 11:06:38 +00:00
*
2013-10-02 14:05:55 +00:00
* @method Phaser.InputHandler#pointerTimeOver
2015-10-15 11:06:38 +00:00
* @param {integer} [pointerId=0]
2013-10-02 14:05:55 +00:00
* @return {number}
*/
2015-10-15 11:06:38 +00:00
pointerTimeOver: function (pointerId) {
2013-10-02 14:05:55 +00:00
2015-10-15 11:06:38 +00:00
pointerId = pointerId || 0;
2013-10-02 14:05:55 +00:00
2015-10-15 11:06:38 +00:00
return this._pointerData[pointerId].timeOver;
2013-10-02 14:05:55 +00:00
},
2013-11-28 15:57:09 +00:00
/**
2013-10-02 14:05:55 +00:00
* A timestamp representing when the Pointer left the touchscreen.
2015-10-15 11:06:38 +00:00
*
2013-10-02 14:05:55 +00:00
* @method Phaser.InputHandler#pointerTimeOut
2015-10-15 11:06:38 +00:00
* @param {integer} [pointerId=0]
2013-10-02 14:05:55 +00:00
* @return {number}
*/
2015-10-15 11:06:38 +00:00
pointerTimeOut: function (pointerId) {
2013-10-02 14:05:55 +00:00
2015-10-15 11:06:38 +00:00
pointerId = pointerId || 0;
2013-10-02 14:05:55 +00:00
2015-10-15 11:06:38 +00:00
return this._pointerData[pointerId].timeOut;
2013-10-02 14:05:55 +00:00
},
2013-11-28 15:57:09 +00:00
/**
2013-10-02 14:05:55 +00:00
* Is this sprite being dragged by the mouse or not?
2015-10-15 11:06:38 +00:00
*
2014-02-21 15:37:26 +00:00
* @method Phaser.InputHandler#pointerDragged
2015-10-15 11:06:38 +00:00
* @param {integer} [pointerId=0]
2014-02-21 15:37:26 +00:00
* @return {boolean} True if the pointer is dragging an object, otherwise false.
2013-10-02 14:05:55 +00:00
*/
2015-10-15 11:06:38 +00:00
pointerDragged: function (pointerId) {
2013-10-02 14:05:55 +00:00
2015-10-15 11:06:38 +00:00
pointerId = pointerId || 0;
2013-10-02 14:05:55 +00:00
2015-10-15 11:06:38 +00:00
return this._pointerData[pointerId].isDragged;
2013-10-02 14:05:55 +00:00
},
2014-02-18 03:01:51 +00:00
/**
2014-07-18 11:45:51 +00:00
* Checks if the given pointer is both down and over the Sprite this InputHandler belongs to.
* Use the `fastTest` flag is to quickly check just the bounding hit area even if `InputHandler.pixelPerfectOver` is `true`.
2014-10-22 20:49:44 +00:00
*
2014-02-18 03:01:51 +00:00
* @method Phaser.InputHandler#checkPointerDown
* @param {Phaser.Pointer} pointer
2014-07-18 11:45:51 +00:00
* @param {boolean} [fastTest=false] - Force a simple hit area check even if `pixelPerfectOver` is true for this object?
2014-02-21 15:37:26 +00:00
* @return {boolean} True if the pointer is down, otherwise false.
2014-02-18 03:01:51 +00:00
*/
2014-07-18 11:45:51 +00:00
checkPointerDown: function (pointer, fastTest) {
2014-02-18 03:01:51 +00:00
2016-05-19 11:36:51 +00:00
if (!pointer.isDown ||
!this.enabled ||
!this.sprite ||
!this.sprite.parent ||
!this.sprite.visible ||
2016-06-03 17:48:34 +00:00
!this.sprite.parent.visible ||
2016-05-19 11:36:51 +00:00
this.sprite.worldScale.x === 0 ||
this.sprite.worldScale.y === 0)
2014-02-18 03:01:51 +00:00
{
return false;
}
// Need to pass it a temp point, in case we need it again for the pixel check
if (this.game.input.hitTest(this.sprite, pointer, this._tempPoint))
{
2015-08-24 14:43:45 +00:00
if (fastTest === undefined)
{
fastTest = false;
}
2014-07-18 11:45:51 +00:00
2015-03-23 23:46:30 +00:00
if (!fastTest & & this.pixelPerfectClick)
2014-02-18 03:01:51 +00:00
{
return this.checkPixel(this._tempPoint.x, this._tempPoint.y);
}
else
{
return true;
}
}
return false;
},
2013-11-28 15:57:09 +00:00
/**
2014-07-18 11:45:51 +00:00
* Checks if the given pointer is over the Sprite this InputHandler belongs to.
* Use the `fastTest` flag is to quickly check just the bounding hit area even if `InputHandler.pixelPerfectOver` is `true`.
2014-10-22 20:49:44 +00:00
*
2013-10-02 14:05:55 +00:00
* @method Phaser.InputHandler#checkPointerOver
2013-11-28 15:57:09 +00:00
* @param {Phaser.Pointer} pointer
2014-07-18 11:45:51 +00:00
* @param {boolean} [fastTest=false] - Force a simple hit area check even if `pixelPerfectOver` is true for this object?
2013-10-02 14:05:55 +00:00
* @return {boolean}
*/
2014-07-18 11:45:51 +00:00
checkPointerOver: function (pointer, fastTest) {
2013-10-02 14:05:55 +00:00
2016-06-03 17:48:34 +00:00
if (!this.enabled ||
2016-05-19 11:36:51 +00:00
!this.sprite ||
!this.sprite.parent ||
!this.sprite.visible ||
2016-06-03 17:48:34 +00:00
!this.sprite.parent.visible ||
2016-05-19 11:36:51 +00:00
this.sprite.worldScale.x === 0 ||
this.sprite.worldScale.y === 0)
2013-10-02 14:05:55 +00:00
{
2013-11-28 15:57:09 +00:00
return false;
}
2014-02-08 07:24:22 +00:00
// Need to pass it a temp point, in case we need it again for the pixel check
if (this.game.input.hitTest(this.sprite, pointer, this._tempPoint))
2013-11-28 15:57:09 +00:00
{
2015-08-24 14:43:45 +00:00
if (fastTest === undefined)
{
fastTest = false;
}
2014-07-18 11:45:51 +00:00
2015-03-23 23:46:30 +00:00
if (!fastTest & & this.pixelPerfectOver)
2013-10-02 14:05:55 +00:00
{
2013-11-28 15:57:09 +00:00
return this.checkPixel(this._tempPoint.x, this._tempPoint.y);
}
else
{
return true;
2013-10-02 14:05:55 +00:00
}
}
2014-02-08 07:24:22 +00:00
return false;
2013-10-02 14:05:55 +00:00
},
2013-11-28 15:57:09 +00:00
/**
2013-11-07 06:10:15 +00:00
* Runs a pixel perfect check against the given x/y coordinates of the Sprite this InputHandler is bound to.
* It compares the alpha value of the pixel and if >= InputHandler.pixelPerfectAlpha it returns true.
2015-10-15 11:06:38 +00:00
*
2013-11-07 06:10:15 +00:00
* @method Phaser.InputHandler#checkPixel
* @param {number} x - The x coordinate to check.
* @param {number} y - The y coordinate to check.
2014-02-18 03:01:51 +00:00
* @param {Phaser.Pointer} [pointer] - The pointer to get the x/y coordinate from if not passed as the first two parameters.
2013-11-07 06:10:15 +00:00
* @return {boolean} true if there is the alpha of the pixel is >= InputHandler.pixelPerfectAlpha
*/
2014-02-18 03:01:51 +00:00
checkPixel: function (x, y, pointer) {
2013-10-02 14:05:55 +00:00
// Grab a pixel from our image into the hitCanvas and then test it
if (this.sprite.texture.baseTexture.source)
{
2015-03-23 23:46:30 +00:00
if (x === null & & y === null)
2014-02-18 03:01:51 +00:00
{
// Use the pointer parameter
this.game.input.getLocalPosition(this.sprite, pointer, this._tempPoint);
var x = this._tempPoint.x;
var y = this._tempPoint.y;
}
if (this.sprite.anchor.x !== 0)
{
x -= -this.sprite.texture.frame.width * this.sprite.anchor.x;
}
if (this.sprite.anchor.y !== 0)
{
y -= -this.sprite.texture.frame.height * this.sprite.anchor.y;
}
2013-10-25 15:54:40 +00:00
x += this.sprite.texture.frame.x;
y += this.sprite.texture.frame.y;
2014-09-09 14:36:56 +00:00
if (this.sprite.texture.trim)
{
x -= this.sprite.texture.trim.x;
y -= this.sprite.texture.trim.y;
// If the coordinates are outside the trim area we return false immediately, to save doing a draw call
if (x < this.sprite.texture.crop.x || x > this.sprite.texture.crop.right || y < this.sprite.texture.crop.y || y > this.sprite.texture.crop.bottom)
{
this._dx = x;
this._dy = y;
return false;
}
}
this._dx = x;
this._dy = y;
this.game.input.hitContext.clearRect(0, 0, 1, 1);
2013-10-02 14:05:55 +00:00
this.game.input.hitContext.drawImage(this.sprite.texture.baseTexture.source, x, y, 1, 1, 0, 0, 1, 1);
2014-03-28 01:42:49 +00:00
2013-10-02 14:05:55 +00:00
var rgb = this.game.input.hitContext.getImageData(0, 0, 1, 1);
if (rgb.data[3] >= this.pixelPerfectAlpha)
{
return true;
}
}
return false;
},
2013-11-28 15:57:09 +00:00
/**
2016-06-09 16:13:31 +00:00
* Internal Update method. This is called automatically and handles the Pointer
* and drag update loops.
2014-10-22 20:49:44 +00:00
*
2013-10-02 14:05:55 +00:00
* @method Phaser.InputHandler#update
2014-02-18 03:01:51 +00:00
* @protected
2013-11-28 15:57:09 +00:00
* @param {Phaser.Pointer} pointer
2016-06-09 16:13:31 +00:00
* @return {boolean} True if the pointer is still active, otherwise false.
2013-10-02 14:05:55 +00:00
*/
update: function (pointer) {
2014-04-11 12:09:28 +00:00
if (this.sprite === null || this.sprite.parent === undefined)
2014-02-18 03:01:51 +00:00
{
// Abort. We've been destroyed.
return;
}
2014-02-21 15:37:26 +00:00
if (!this.enabled || !this.sprite.visible || !this.sprite.parent.visible)
2013-10-02 14:05:55 +00:00
{
this._pointerOutHandler(pointer);
return false;
}
2016-06-09 16:13:31 +00:00
if (this._pendingDrag)
{
if (!this._dragDistancePass)
{
this._dragDistancePass = (Phaser.Math.distance(pointer.x, pointer.y, this.downPoint.x, this.downPoint.y) >= this.dragDistanceThreshold);
}
if (this._dragDistancePass & & this._dragTimePass)
{
this.startDrag(pointer);
}
return true;
}
else if (this.draggable & & this._draggedPointerID === pointer.id)
2013-10-02 14:05:55 +00:00
{
2016-07-08 14:46:26 +00:00
return this.updateDrag(pointer, false);
2013-10-02 14:05:55 +00:00
}
2014-10-22 20:49:44 +00:00
else if (this._pointerData[pointer.id].isOver)
2013-10-02 14:05:55 +00:00
{
if (this.checkPointerOver(pointer))
{
this._pointerData[pointer.id].x = pointer.x - this.sprite.x;
this._pointerData[pointer.id].y = pointer.y - this.sprite.y;
return true;
}
else
{
this._pointerOutHandler(pointer);
return false;
}
}
},
2013-11-28 15:57:09 +00:00
/**
* Internal method handling the pointer over event.
2014-10-22 20:49:44 +00:00
*
2013-11-28 15:57:09 +00:00
* @method Phaser.InputHandler#_pointerOverHandler
* @private
2015-07-22 14:31:30 +00:00
* @param {Phaser.Pointer} pointer - The pointer that triggered the event
2016-06-09 16:13:31 +00:00
* @param {boolean} [silent=false] - If silent is `true` then this method will not dispatch any Signals from the parent Sprite.
2013-11-28 15:57:09 +00:00
*/
2016-06-09 16:13:31 +00:00
_pointerOverHandler: function (pointer, silent) {
2013-10-02 14:05:55 +00:00
2014-02-18 03:01:51 +00:00
if (this.sprite === null)
{
// Abort. We've been destroyed.
return;
}
2015-08-24 14:43:45 +00:00
var data = this._pointerData[pointer.id];
if (data.isOver === false || pointer.dirty)
2013-10-02 14:05:55 +00:00
{
2016-02-17 13:27:09 +00:00
var sendEvent = (data.isOver === false);
2015-08-24 14:43:45 +00:00
data.isOver = true;
data.isOut = false;
data.timeOver = this.game.time.time;
data.x = pointer.x - this.sprite.x;
data.y = pointer.y - this.sprite.y;
2013-10-02 14:05:55 +00:00
2015-08-24 14:43:45 +00:00
if (this.useHandCursor & & data.isDragged === false)
2013-10-02 14:05:55 +00:00
{
2014-02-05 06:29:17 +00:00
this.game.canvas.style.cursor = "pointer";
2014-04-29 14:39:02 +00:00
this._setHandCursor = true;
2013-10-02 14:05:55 +00:00
}
2016-06-09 16:13:31 +00:00
if (!silent & & sendEvent & & this.sprite & & this.sprite.events)
2014-04-29 14:39:02 +00:00
{
2014-12-03 10:39:11 +00:00
this.sprite.events.onInputOver$dispatch(this.sprite, pointer);
2014-04-29 14:39:02 +00:00
}
2016-06-09 16:13:31 +00:00
if (this.sprite.parent & & this.sprite.parent.type === Phaser.GROUP)
{
this.sprite.parent.onChildInputOver.dispatch(this.sprite, pointer);
}
2013-10-02 14:05:55 +00:00
}
2014-02-18 03:01:51 +00:00
2013-10-02 14:05:55 +00:00
},
2013-11-28 15:57:09 +00:00
/**
* Internal method handling the pointer out event.
2014-10-22 20:49:44 +00:00
*
2013-11-28 15:57:09 +00:00
* @method Phaser.InputHandler#_pointerOutHandler
* @private
2015-07-22 14:31:30 +00:00
* @param {Phaser.Pointer} pointer - The pointer that triggered the event.
2016-06-09 16:13:31 +00:00
* @param {boolean} [silent=false] - If silent is `true` then this method will not dispatch any Signals from the parent Sprite.
2013-11-28 15:57:09 +00:00
*/
2016-06-09 16:13:31 +00:00
_pointerOutHandler: function (pointer, silent) {
2013-10-02 14:05:55 +00:00
2014-02-18 03:01:51 +00:00
if (this.sprite === null)
{
// Abort. We've been destroyed.
return;
}
2015-08-24 14:43:45 +00:00
var data = this._pointerData[pointer.id];
data.isOver = false;
data.isOut = true;
data.timeOut = this.game.time.time;
2013-10-02 14:05:55 +00:00
2015-08-24 14:43:45 +00:00
if (this.useHandCursor & & data.isDragged === false)
2013-10-02 14:05:55 +00:00
{
2014-02-05 06:29:17 +00:00
this.game.canvas.style.cursor = "default";
2014-03-24 12:41:45 +00:00
this._setHandCursor = false;
2013-10-02 14:05:55 +00:00
}
2016-06-09 16:13:31 +00:00
if (!silent & & this.sprite & & this.sprite.events)
2013-10-25 15:54:40 +00:00
{
2014-12-03 10:39:11 +00:00
this.sprite.events.onInputOut$dispatch(this.sprite, pointer);
2016-06-09 16:13:31 +00:00
if (this.sprite & & this.sprite.parent & & this.sprite.parent.type === Phaser.GROUP)
{
this.sprite.parent.onChildInputOut.dispatch(this.sprite, pointer);
}
2013-10-25 15:54:40 +00:00
}
2013-10-02 14:05:55 +00:00
},
2013-11-28 15:57:09 +00:00
/**
2015-07-22 14:31:30 +00:00
* Internal method handling the touched / clicked event.
*
2013-11-28 15:57:09 +00:00
* @method Phaser.InputHandler#_touchedHandler
* @private
2015-07-22 14:31:30 +00:00
* @param {Phaser.Pointer} pointer - The pointer that triggered the event.
2013-11-28 15:57:09 +00:00
*/
2013-10-02 14:05:55 +00:00
_touchedHandler: function (pointer) {
2014-02-18 03:01:51 +00:00
if (this.sprite === null)
{
// Abort. We've been destroyed.
return;
}
2015-08-24 14:43:45 +00:00
var data = this._pointerData[pointer.id];
if (!data.isDown & & data.isOver)
2013-10-02 14:05:55 +00:00
{
2015-03-23 23:46:30 +00:00
if (this.pixelPerfectClick & & !this.checkPixel(null, null, pointer))
2014-02-18 03:01:51 +00:00
{
return;
}
2015-08-24 14:43:45 +00:00
data.isDown = true;
data.isUp = false;
data.timeDown = this.game.time.time;
2014-10-22 20:49:44 +00:00
2016-06-09 16:13:31 +00:00
this.downPoint.set(pointer.x, pointer.y);
2016-04-22 14:15:28 +00:00
// It's possible the onInputDown event creates a new Sprite that is on-top of this one, so we ought to force a Pointer update
pointer.dirty = true;
2015-03-23 23:46:30 +00:00
if (this.sprite & & this.sprite.events)
2014-04-29 14:39:02 +00:00
{
2014-12-03 10:39:11 +00:00
this.sprite.events.onInputDown$dispatch(this.sprite, pointer);
2016-06-09 16:13:31 +00:00
// The event above might have destroyed this sprite.
if (this.sprite & & this.sprite.parent & & this.sprite.parent.type === Phaser.GROUP)
{
this.sprite.parent.onChildInputDown.dispatch(this.sprite, pointer);
}
// The events might have destroyed this sprite.
2016-04-22 14:15:28 +00:00
if (this.sprite === null)
{
return;
}
2014-04-29 14:39:02 +00:00
}
2013-10-02 14:05:55 +00:00
// Start drag
2015-03-23 23:46:30 +00:00
if (this.draggable & & this.isDragged === false)
2013-10-02 14:05:55 +00:00
{
2016-06-09 16:13:31 +00:00
if (this.dragTimeThreshold === 0 & & this.dragDistanceThreshold === 0)
{
this.startDrag(pointer);
}
else
{
this._pendingDrag = true;
this._dragDistancePass = (this.dragDistanceThreshold === 0);
if (this.dragTimeThreshold > 0)
{
this._dragTimePass = false;
this.game.time.events.add(this.dragTimeThreshold, this.dragTimeElapsed, this, pointer);
}
else
{
this._dragTimePass = true;
}
}
2013-10-02 14:05:55 +00:00
}
if (this.bringToTop)
{
this.sprite.bringToTop();
2013-11-28 15:57:09 +00:00
}
2013-10-02 14:05:55 +00:00
}
},
2016-06-09 16:13:31 +00:00
/**
* Internal method handling the drag threshold timer.
*
* @method Phaser.InputHandler#dragTimeElapsed
* @private
* @param {Phaser.Pointer} pointer
*/
dragTimeElapsed: function (pointer) {
this._dragTimePass = true;
if (this._pendingDrag & & this.sprite)
{
if (this._dragDistancePass)
{
this.startDrag(pointer);
}
}
},
2013-11-28 15:57:09 +00:00
/**
* Internal method handling the pointer released event.
* @method Phaser.InputHandler#_releasedHandler
* @private
* @param {Phaser.Pointer} pointer
*/
2013-10-02 14:05:55 +00:00
_releasedHandler: function (pointer) {
2014-02-18 03:01:51 +00:00
if (this.sprite === null)
{
// Abort. We've been destroyed.
return;
}
2015-08-24 14:43:45 +00:00
var data = this._pointerData[pointer.id];
2013-10-02 14:05:55 +00:00
// If was previously touched by this Pointer, check if still is AND still over this item
2015-08-24 14:43:45 +00:00
if (data.isDown & & pointer.isUp)
2013-10-02 14:05:55 +00:00
{
2015-08-24 14:43:45 +00:00
data.isDown = false;
data.isUp = true;
data.timeUp = this.game.time.time;
data.downDuration = data.timeUp - data.timeDown;
2013-10-02 14:05:55 +00:00
// Only release the InputUp signal if the pointer is still over this sprite
2015-08-24 14:43:45 +00:00
var isOver = this.checkPointerOver(pointer);
if (this.sprite & & this.sprite.events)
2013-10-02 14:05:55 +00:00
{
2016-06-09 16:13:31 +00:00
if (!this.dragStopBlocksInputUp ||
this.dragStopBlocksInputUp & & !(this.draggable & & this.isDragged & & this._draggedPointerID === pointer.id))
{
this.sprite.events.onInputUp$dispatch(this.sprite, pointer, isOver);
}
if (this.sprite & & this.sprite.parent & & this.sprite.parent.type === Phaser.GROUP)
{
this.sprite.parent.onChildInputUp.dispatch(this.sprite, pointer, isOver);
}
2015-08-24 14:43:45 +00:00
// The onInputUp event may have changed the sprite so that checkPointerOver is no longer true, so update it.
if (isOver)
2014-04-29 14:39:02 +00:00
{
2015-08-24 14:43:45 +00:00
isOver = this.checkPointerOver(pointer);
2014-04-29 14:39:02 +00:00
}
2013-10-02 14:05:55 +00:00
}
2015-08-24 14:43:45 +00:00
data.isOver = isOver;
2014-02-05 06:29:17 +00:00
2015-08-24 14:43:45 +00:00
if (!isOver & & this.useHandCursor)
{
this.game.canvas.style.cursor = "default";
this._setHandCursor = false;
2013-10-02 14:05:55 +00:00
}
2015-08-24 14:43:45 +00:00
// It's possible the onInputUp event created a new Sprite that is on-top of this one, so force a Pointer update
2014-09-09 14:36:56 +00:00
pointer.dirty = true;
2016-06-09 16:13:31 +00:00
this._pendingDrag = false;
2013-10-02 14:05:55 +00:00
// Stop drag
2015-03-23 23:46:30 +00:00
if (this.draggable & & this.isDragged & & this._draggedPointerID === pointer.id)
2013-10-02 14:05:55 +00:00
{
this.stopDrag(pointer);
}
}
},
2013-11-28 15:57:09 +00:00
/**
2016-07-08 14:46:26 +00:00
* Called as a Pointer actively drags this Game Object.
*
2013-10-02 14:05:55 +00:00
* @method Phaser.InputHandler#updateDrag
2016-07-08 14:46:26 +00:00
* @private
* @param {Phaser.Pointer} pointer - The Pointer causing the drag update.
* @param {boolean} fromStart - True if this is the first update, immediately after the drag has started.
2013-10-02 14:05:55 +00:00
* @return {boolean}
*/
2016-02-08 17:01:36 +00:00
updateDrag: function (pointer, fromStart) {
2013-10-02 14:05:55 +00:00
2016-07-08 14:46:26 +00:00
if (fromStart === undefined) { fromStart = false; }
2013-10-02 14:05:55 +00:00
if (pointer.isUp)
{
this.stopDrag(pointer);
return false;
}
2014-10-09 15:12:53 +00:00
var px = this.globalToLocalX(pointer.x) + this._dragPoint.x + this.dragOffset.x;
var py = this.globalToLocalY(pointer.y) + this._dragPoint.y + this.dragOffset.y;
2014-02-05 06:29:17 +00:00
if (this.sprite.fixedToCamera)
2013-10-02 14:05:55 +00:00
{
2014-02-05 06:29:17 +00:00
if (this.allowHorizontalDrag)
{
2014-10-09 15:12:53 +00:00
this.sprite.cameraOffset.x = px;
2014-02-05 06:29:17 +00:00
}
2013-10-02 14:05:55 +00:00
2014-02-05 06:29:17 +00:00
if (this.allowVerticalDrag)
{
2014-10-09 15:12:53 +00:00
this.sprite.cameraOffset.y = py;
2014-02-05 06:29:17 +00:00
}
2013-10-02 14:05:55 +00:00
2014-02-05 06:29:17 +00:00
if (this.boundsRect)
{
this.checkBoundsRect();
}
2013-10-02 14:05:55 +00:00
2014-02-05 06:29:17 +00:00
if (this.boundsSprite)
{
this.checkBoundsSprite();
}
2013-10-02 14:05:55 +00:00
2014-02-05 06:29:17 +00:00
if (this.snapOnDrag)
{
this.sprite.cameraOffset.x = Math.round((this.sprite.cameraOffset.x - (this.snapOffsetX % this.snapX)) / this.snapX) * this.snapX + (this.snapOffsetX % this.snapX);
this.sprite.cameraOffset.y = Math.round((this.sprite.cameraOffset.y - (this.snapOffsetY % this.snapY)) / this.snapY) * this.snapY + (this.snapOffsetY % this.snapY);
2015-07-22 14:31:30 +00:00
this.snapPoint.set(this.sprite.cameraOffset.x, this.sprite.cameraOffset.y);
2014-02-05 06:29:17 +00:00
}
}
else
2013-10-02 14:05:55 +00:00
{
2016-04-22 14:15:28 +00:00
var cx = this.game.camera.x - this._pointerData[pointer.id].camX;
var cy = this.game.camera.y - this._pointerData[pointer.id].camY;
2014-02-05 06:29:17 +00:00
if (this.allowHorizontalDrag)
{
2016-04-22 14:15:28 +00:00
this.sprite.x = px + cx;
2014-02-05 06:29:17 +00:00
}
if (this.allowVerticalDrag)
{
2016-04-22 14:15:28 +00:00
this.sprite.y = py + cy;
2014-02-05 06:29:17 +00:00
}
if (this.boundsRect)
{
this.checkBoundsRect();
}
if (this.boundsSprite)
{
this.checkBoundsSprite();
}
if (this.snapOnDrag)
{
this.sprite.x = Math.round((this.sprite.x - (this.snapOffsetX % this.snapX)) / this.snapX) * this.snapX + (this.snapOffsetX % this.snapX);
this.sprite.y = Math.round((this.sprite.y - (this.snapOffsetY % this.snapY)) / this.snapY) * this.snapY + (this.snapOffsetY % this.snapY);
2015-07-22 14:31:30 +00:00
this.snapPoint.set(this.sprite.x, this.sprite.y);
2014-02-05 06:29:17 +00:00
}
2013-10-02 14:05:55 +00:00
}
2016-02-08 17:01:36 +00:00
this.sprite.events.onDragUpdate.dispatch(this.sprite, pointer, px, py, this.snapPoint, fromStart);
2015-07-22 14:31:30 +00:00
2013-10-02 14:05:55 +00:00
return true;
},
2013-11-28 15:57:09 +00:00
/**
2013-10-02 14:05:55 +00:00
* Returns true if the pointer has entered the Sprite within the specified delay time (defaults to 500ms, half a second)
2015-10-15 11:06:38 +00:00
*
2013-10-02 14:05:55 +00:00
* @method Phaser.InputHandler#justOver
2015-10-15 11:06:38 +00:00
* @param {integer} [pointerId=0]
2013-10-02 14:05:55 +00:00
* @param {number} delay - The time below which the pointer is considered as just over.
* @return {boolean}
*/
2015-10-15 11:06:38 +00:00
justOver: function (pointerId, delay) {
2013-10-02 14:05:55 +00:00
2015-10-15 11:06:38 +00:00
pointerId = pointerId || 0;
2013-11-28 15:57:09 +00:00
delay = delay || 500;
2013-10-02 14:05:55 +00:00
2015-10-15 11:06:38 +00:00
return (this._pointerData[pointerId].isOver & & this.overDuration(pointerId) < delay);
2013-10-02 14:05:55 +00:00
},
2013-11-28 15:57:09 +00:00
/**
2013-10-02 14:05:55 +00:00
* Returns true if the pointer has left the Sprite within the specified delay time (defaults to 500ms, half a second)
2015-10-15 11:06:38 +00:00
*
2013-10-02 14:05:55 +00:00
* @method Phaser.InputHandler#justOut
2015-10-15 11:06:38 +00:00
* @param {integer} [pointerId=0]
2013-10-02 14:05:55 +00:00
* @param {number} delay - The time below which the pointer is considered as just out.
* @return {boolean}
*/
2015-10-15 11:06:38 +00:00
justOut: function (pointerId, delay) {
2013-10-02 14:05:55 +00:00
2015-10-15 11:06:38 +00:00
pointerId = pointerId || 0;
2013-11-28 15:57:09 +00:00
delay = delay || 500;
2013-10-02 14:05:55 +00:00
2015-10-15 11:06:38 +00:00
return (this._pointerData[pointerId].isOut & & (this.game.time.time - this._pointerData[pointerId].timeOut < delay));
2013-10-02 14:05:55 +00:00
},
2013-11-28 15:57:09 +00:00
/**
2014-02-18 03:01:51 +00:00
* Returns true if the pointer has touched or clicked on the Sprite within the specified delay time (defaults to 500ms, half a second)
2015-10-15 11:06:38 +00:00
*
2013-10-02 14:05:55 +00:00
* @method Phaser.InputHandler#justPressed
2015-10-15 11:06:38 +00:00
* @param {integer} [pointerId=0]
2013-10-02 14:05:55 +00:00
* @param {number} delay - The time below which the pointer is considered as just over.
* @return {boolean}
*/
2015-10-15 11:06:38 +00:00
justPressed: function (pointerId, delay) {
2013-10-02 14:05:55 +00:00
2015-10-15 11:06:38 +00:00
pointerId = pointerId || 0;
2013-11-28 15:57:09 +00:00
delay = delay || 500;
2013-10-02 14:05:55 +00:00
2015-10-15 11:06:38 +00:00
return (this._pointerData[pointerId].isDown & & this.downDuration(pointerId) < delay);
2013-10-02 14:05:55 +00:00
},
2013-11-28 15:57:09 +00:00
/**
2014-02-18 03:01:51 +00:00
* Returns true if the pointer was touching this Sprite, but has been released within the specified delay time (defaults to 500ms, half a second)
2015-10-15 11:06:38 +00:00
*
2013-10-02 14:05:55 +00:00
* @method Phaser.InputHandler#justReleased
2015-10-15 11:06:38 +00:00
* @param {integer} [pointerId=0]
2013-10-02 14:05:55 +00:00
* @param {number} delay - The time below which the pointer is considered as just out.
* @return {boolean}
*/
2015-10-15 11:06:38 +00:00
justReleased: function (pointerId, delay) {
2013-10-02 14:05:55 +00:00
2015-10-15 11:06:38 +00:00
pointerId = pointerId || 0;
2013-11-28 15:57:09 +00:00
delay = delay || 500;
2013-10-02 14:05:55 +00:00
2015-10-15 11:06:38 +00:00
return (this._pointerData[pointerId].isUp & & (this.game.time.time - this._pointerData[pointerId].timeUp < delay));
2013-10-02 14:05:55 +00:00
},
2013-11-28 15:57:09 +00:00
/**
2013-10-02 14:05:55 +00:00
* If the pointer is currently over this Sprite this returns how long it has been there for in milliseconds.
2015-10-15 11:06:38 +00:00
*
2013-10-02 14:05:55 +00:00
* @method Phaser.InputHandler#overDuration
2015-10-15 11:06:38 +00:00
* @param {integer} [pointerId=0]
2013-10-02 14:05:55 +00:00
* @return {number} The number of milliseconds the pointer has been over the Sprite, or -1 if not over.
*/
2015-10-15 11:06:38 +00:00
overDuration: function (pointerId) {
2013-10-02 14:05:55 +00:00
2015-10-15 11:06:38 +00:00
pointerId = pointerId || 0;
2013-10-02 14:05:55 +00:00
2015-10-15 11:06:38 +00:00
if (this._pointerData[pointerId].isOver)
2013-10-02 14:05:55 +00:00
{
2015-10-15 11:06:38 +00:00
return this.game.time.time - this._pointerData[pointerId].timeOver;
2013-10-02 14:05:55 +00:00
}
return -1;
},
2013-11-28 15:57:09 +00:00
/**
2013-10-02 14:05:55 +00:00
* If the pointer is currently over this Sprite this returns how long it has been there for in milliseconds.
2015-10-15 11:06:38 +00:00
*
2013-10-02 14:05:55 +00:00
* @method Phaser.InputHandler#downDuration
2015-10-15 11:06:38 +00:00
* @param {integer} [pointerId=0]
2013-10-02 14:05:55 +00:00
* @return {number} The number of milliseconds the pointer has been pressed down on the Sprite, or -1 if not over.
*/
2015-10-15 11:06:38 +00:00
downDuration: function (pointerId) {
2013-10-02 14:05:55 +00:00
2015-10-15 11:06:38 +00:00
pointerId = pointerId || 0;
2013-10-02 14:05:55 +00:00
2015-10-15 11:06:38 +00:00
if (this._pointerData[pointerId].isDown)
2013-10-02 14:05:55 +00:00
{
2015-10-15 11:06:38 +00:00
return this.game.time.time - this._pointerData[pointerId].timeDown;
2013-10-02 14:05:55 +00:00
}
return -1;
},
2013-11-28 15:57:09 +00:00
/**
2015-07-22 14:31:30 +00:00
* Allow this Sprite to be dragged by any valid pointer.
*
* When the drag begins the Sprite.events.onDragStart event will be dispatched.
*
* When the drag completes by way of the user letting go of the pointer that was dragging the sprite, the Sprite.events.onDragStop event is dispatched.
*
2016-06-09 16:13:31 +00:00
* You can control the thresholds over when a drag starts via the properties:
*
* `Pointer.dragDistanceThreshold` the distance, in pixels, that the pointer has to move
* before the drag will start.
*
* `Pointer.dragTimeThreshold` the time, in ms, that the pointer must be held down on
* the Sprite before the drag will start.
*
* You can set either (or both) of these properties after enabling a Sprite for drag.
*
2015-07-22 14:31:30 +00:00
* For the duration of the drag the Sprite.events.onDragUpdate event is dispatched. This event is only dispatched when the pointer actually
* changes position and moves. The event sends 5 parameters: `sprite`, `pointer`, `dragX`, `dragY` and `snapPoint`.
*
2013-10-02 14:05:55 +00:00
* @method Phaser.InputHandler#enableDrag
2013-11-28 15:57:09 +00:00
* @param {boolean} [lockCenter=false] - If false the Sprite will drag from where you click it minus the dragOffset. If true it will center itself to the tip of the mouse pointer.
* @param {boolean} [bringToTop=false] - If true the Sprite will be bought to the top of the rendering list in its current Group.
* @param {boolean} [pixelPerfect=false] - If true it will use a pixel perfect test to see if you clicked the Sprite. False uses the bounding box.
* @param {boolean} [alphaThreshold=255] - If using pixel perfect collision this specifies the alpha level from 0 to 255 above which a collision is processed.
* @param {Phaser.Rectangle} [boundsRect=null] - If you want to restrict the drag of this sprite to a specific Rectangle, pass the Phaser.Rectangle here, otherwise it's free to drag anywhere.
* @param {Phaser.Sprite} [boundsSprite=null] - If you want to restrict the drag of this sprite to within the bounding box of another sprite, pass it here.
2013-10-02 14:05:55 +00:00
*/
enableDrag: function (lockCenter, bringToTop, pixelPerfect, alphaThreshold, boundsRect, boundsSprite) {
2015-07-22 14:31:30 +00:00
if (lockCenter === undefined) { lockCenter = false; }
if (bringToTop === undefined) { bringToTop = false; }
if (pixelPerfect === undefined) { pixelPerfect = false; }
if (alphaThreshold === undefined) { alphaThreshold = 255; }
if (boundsRect === undefined) { boundsRect = null; }
if (boundsSprite === undefined) { boundsSprite = null; }
2013-10-02 14:05:55 +00:00
this._dragPoint = new Phaser.Point();
this.draggable = true;
this.bringToTop = bringToTop;
this.dragOffset = new Phaser.Point();
this.dragFromCenter = lockCenter;
2014-07-18 11:45:51 +00:00
this.pixelPerfectClick = pixelPerfect;
2013-10-02 14:05:55 +00:00
this.pixelPerfectAlpha = alphaThreshold;
if (boundsRect)
{
this.boundsRect = boundsRect;
}
if (boundsSprite)
{
this.boundsSprite = boundsSprite;
}
},
2013-11-28 15:57:09 +00:00
/**
2015-10-15 11:06:38 +00:00
* Stops this sprite from being able to be dragged.
* If it is currently the target of an active drag it will be stopped immediately; also disables any set callbacks.
*
2013-10-02 14:05:55 +00:00
* @method Phaser.InputHandler#disableDrag
*/
disableDrag: function () {
if (this._pointerData)
{
for (var i = 0; i < 10; i++)
{
this._pointerData[i].isDragged = false;
}
}
this.draggable = false;
this.isDragged = false;
this._draggedPointerID = -1;
2016-06-09 16:13:31 +00:00
this._pendingDrag = false;
2013-10-02 14:05:55 +00:00
},
2013-11-28 15:57:09 +00:00
/**
2013-10-02 14:05:55 +00:00
* Called by Pointer when drag starts on this Sprite. Should not usually be called directly.
2015-10-15 11:06:38 +00:00
*
2013-10-02 14:05:55 +00:00
* @method Phaser.InputHandler#startDrag
2013-11-28 15:57:09 +00:00
* @param {Phaser.Pointer} pointer
2013-10-02 14:05:55 +00:00
*/
startDrag: function (pointer) {
2015-03-23 23:46:30 +00:00
var x = this.sprite.x;
var y = this.sprite.y;
2013-10-02 14:05:55 +00:00
this.isDragged = true;
this._draggedPointerID = pointer.id;
2016-04-22 14:15:28 +00:00
this._pointerData[pointer.id].camX = this.game.camera.x;
this._pointerData[pointer.id].camY = this.game.camera.y;
2013-10-02 14:05:55 +00:00
this._pointerData[pointer.id].isDragged = true;
2014-02-05 06:29:17 +00:00
if (this.sprite.fixedToCamera)
2013-10-02 14:05:55 +00:00
{
2014-02-05 06:29:17 +00:00
if (this.dragFromCenter)
{
2016-04-22 14:15:28 +00:00
var bounds = this.sprite.getBounds();
this.sprite.cameraOffset.x = this.globalToLocalX(pointer.x) + (this.sprite.cameraOffset.x - bounds.centerX);
this.sprite.cameraOffset.y = this.globalToLocalY(pointer.y) + (this.sprite.cameraOffset.y - bounds.centerY);
2014-02-05 06:29:17 +00:00
}
2016-04-22 14:15:28 +00:00
this._dragPoint.setTo(this.sprite.cameraOffset.x - pointer.x, this.sprite.cameraOffset.y - pointer.y);
2013-10-02 14:05:55 +00:00
}
else
{
2014-02-05 06:29:17 +00:00
if (this.dragFromCenter)
{
2014-03-24 12:41:45 +00:00
var bounds = this.sprite.getBounds();
2014-10-09 15:12:53 +00:00
this.sprite.x = this.globalToLocalX(pointer.x) + (this.sprite.x - bounds.centerX);
this.sprite.y = this.globalToLocalY(pointer.y) + (this.sprite.y - bounds.centerY);
2014-02-05 06:29:17 +00:00
}
2014-10-22 20:49:44 +00:00
2014-10-09 15:12:53 +00:00
this._dragPoint.setTo(this.sprite.x - this.globalToLocalX(pointer.x), this.sprite.y - this.globalToLocalY(pointer.y));
2013-10-02 14:05:55 +00:00
}
2016-02-08 17:01:36 +00:00
this.updateDrag(pointer, true);
2014-03-28 01:42:49 +00:00
2013-10-02 14:05:55 +00:00
if (this.bringToTop)
{
2014-05-20 09:12:48 +00:00
this._dragPhase = true;
2013-10-02 14:05:55 +00:00
this.sprite.bringToTop();
}
2015-03-23 23:46:30 +00:00
this.dragStartPoint.set(x, y);
2016-06-09 16:13:31 +00:00
2015-03-23 23:46:30 +00:00
this.sprite.events.onDragStart$dispatch(this.sprite, pointer, x, y);
2013-10-02 14:05:55 +00:00
2016-06-09 16:13:31 +00:00
this._pendingDrag = false;
2013-10-02 14:05:55 +00:00
},
2014-10-09 15:12:53 +00:00
/**
* Warning: EXPERIMENTAL
2015-10-15 11:06:38 +00:00
*
2014-10-09 15:12:53 +00:00
* @method Phaser.InputHandler#globalToLocalX
* @param {number} x
*/
globalToLocalX: function (x) {
if (this.scaleLayer)
{
x -= this.game.scale.grid.boundsFluid.x;
x *= this.game.scale.grid.scaleFluidInversed.x;
}
return x;
},
/**
* Warning: EXPERIMENTAL
2015-10-15 11:06:38 +00:00
*
2014-10-09 15:12:53 +00:00
* @method Phaser.InputHandler#globalToLocalY
* @param {number} y
*/
globalToLocalY: function (y) {
if (this.scaleLayer)
{
y -= this.game.scale.grid.boundsFluid.y;
y *= this.game.scale.grid.scaleFluidInversed.y;
}
return y;
},
2013-11-28 15:57:09 +00:00
/**
2013-10-02 14:05:55 +00:00
* Called by Pointer when drag is stopped on this Sprite. Should not usually be called directly.
2015-10-15 11:06:38 +00:00
*
2013-10-02 14:05:55 +00:00
* @method Phaser.InputHandler#stopDrag
2013-11-28 15:57:09 +00:00
* @param {Phaser.Pointer} pointer
2013-10-02 14:05:55 +00:00
*/
stopDrag: function (pointer) {
this.isDragged = false;
this._draggedPointerID = -1;
this._pointerData[pointer.id].isDragged = false;
2014-05-20 09:12:48 +00:00
this._dragPhase = false;
2016-06-09 16:13:31 +00:00
this._pendingDrag = false;
2014-03-28 01:42:49 +00:00
2013-10-02 14:05:55 +00:00
if (this.snapOnRelease)
{
2014-02-05 06:29:17 +00:00
if (this.sprite.fixedToCamera)
{
this.sprite.cameraOffset.x = Math.round((this.sprite.cameraOffset.x - (this.snapOffsetX % this.snapX)) / this.snapX) * this.snapX + (this.snapOffsetX % this.snapX);
this.sprite.cameraOffset.y = Math.round((this.sprite.cameraOffset.y - (this.snapOffsetY % this.snapY)) / this.snapY) * this.snapY + (this.snapOffsetY % this.snapY);
}
else
{
this.sprite.x = Math.round((this.sprite.x - (this.snapOffsetX % this.snapX)) / this.snapX) * this.snapX + (this.snapOffsetX % this.snapX);
this.sprite.y = Math.round((this.sprite.y - (this.snapOffsetY % this.snapY)) / this.snapY) * this.snapY + (this.snapOffsetY % this.snapY);
}
2013-10-02 14:05:55 +00:00
}
2014-12-03 10:39:11 +00:00
this.sprite.events.onDragStop$dispatch(this.sprite, pointer);
2013-10-02 14:05:55 +00:00
2013-11-28 15:57:09 +00:00
if (this.checkPointerOver(pointer) === false)
2013-11-01 18:16:52 +00:00
{
this._pointerOutHandler(pointer);
}
2013-10-02 14:05:55 +00:00
},
2013-11-28 15:57:09 +00:00
/**
2013-10-02 14:05:55 +00:00
* Restricts this sprite to drag movement only on the given axis. Note: If both are set to false the sprite will never move!
2015-10-15 11:06:38 +00:00
*
2013-10-02 14:05:55 +00:00
* @method Phaser.InputHandler#setDragLock
2013-11-28 15:57:09 +00:00
* @param {boolean} [allowHorizontal=true] - To enable the sprite to be dragged horizontally set to true, otherwise false.
* @param {boolean} [allowVertical=true] - To enable the sprite to be dragged vertically set to true, otherwise false.
2013-10-02 14:05:55 +00:00
*/
setDragLock: function (allowHorizontal, allowVertical) {
2015-07-22 14:31:30 +00:00
if (allowHorizontal === undefined) { allowHorizontal = true; }
if (allowVertical === undefined) { allowVertical = true; }
2013-10-02 14:05:55 +00:00
this.allowHorizontalDrag = allowHorizontal;
this.allowVerticalDrag = allowVertical;
},
2013-11-28 15:57:09 +00:00
/**
2013-10-02 14:05:55 +00:00
* Make this Sprite snap to the given grid either during drag or when it's released.
* For example 16x16 as the snapX and snapY would make the sprite snap to every 16 pixels.
2015-10-15 11:06:38 +00:00
*
2013-10-02 14:05:55 +00:00
* @method Phaser.InputHandler#enableSnap
2013-11-28 15:57:09 +00:00
* @param {number} snapX - The width of the grid cell to snap to.
* @param {number} snapY - The height of the grid cell to snap to.
* @param {boolean} [onDrag=true] - If true the sprite will snap to the grid while being dragged.
* @param {boolean} [onRelease=false] - If true the sprite will snap to the grid when released.
2014-02-05 06:29:17 +00:00
* @param {number} [snapOffsetX=0] - Used to offset the top-left starting point of the snap grid.
2015-07-22 14:31:30 +00:00
* @param {number} [snapOffsetY=0] - Used to offset the top-left starting point of the snap grid.
2013-10-02 14:05:55 +00:00
*/
2014-03-14 06:36:05 +00:00
enableSnap: function (snapX, snapY, onDrag, onRelease, snapOffsetX, snapOffsetY) {
2013-10-02 14:05:55 +00:00
2015-07-22 14:31:30 +00:00
if (onDrag === undefined) { onDrag = true; }
if (onRelease === undefined) { onRelease = false; }
if (snapOffsetX === undefined) { snapOffsetX = 0; }
if (snapOffsetY === undefined) { snapOffsetY = 0; }
2013-10-02 14:05:55 +00:00
this.snapX = snapX;
this.snapY = snapY;
2014-02-05 06:29:17 +00:00
this.snapOffsetX = snapOffsetX;
this.snapOffsetY = snapOffsetY;
2013-10-02 14:05:55 +00:00
this.snapOnDrag = onDrag;
this.snapOnRelease = onRelease;
},
2013-11-28 15:57:09 +00:00
/**
2013-10-02 14:05:55 +00:00
* Stops the sprite from snapping to a grid during drag or release.
2015-10-15 11:06:38 +00:00
*
2013-10-02 14:05:55 +00:00
* @method Phaser.InputHandler#disableSnap
*/
disableSnap: function () {
this.snapOnDrag = false;
this.snapOnRelease = false;
},
2013-11-28 15:57:09 +00:00
/**
2013-10-02 14:05:55 +00:00
* Bounds Rect check for the sprite drag
2015-10-15 11:06:38 +00:00
*
2013-10-02 14:05:55 +00:00
* @method Phaser.InputHandler#checkBoundsRect
*/
checkBoundsRect: function () {
2014-02-05 06:29:17 +00:00
if (this.sprite.fixedToCamera)
2013-10-02 14:05:55 +00:00
{
2014-02-05 06:29:17 +00:00
if (this.sprite.cameraOffset.x < this.boundsRect.left)
{
2014-09-09 14:36:56 +00:00
this.sprite.cameraOffset.x = this.boundsRect.left;
2014-02-05 06:29:17 +00:00
}
else if ((this.sprite.cameraOffset.x + this.sprite.width) > this.boundsRect.right)
{
this.sprite.cameraOffset.x = this.boundsRect.right - this.sprite.width;
}
2013-10-02 14:05:55 +00:00
2014-02-05 06:29:17 +00:00
if (this.sprite.cameraOffset.y < this.boundsRect.top)
{
this.sprite.cameraOffset.y = this.boundsRect.top;
}
else if ((this.sprite.cameraOffset.y + this.sprite.height) > this.boundsRect.bottom)
{
this.sprite.cameraOffset.y = this.boundsRect.bottom - this.sprite.height;
}
2013-10-02 14:05:55 +00:00
}
2014-02-05 06:29:17 +00:00
else
2013-10-02 14:05:55 +00:00
{
2015-03-23 23:46:30 +00:00
if (this.sprite.left < this.boundsRect.left)
2014-02-05 06:29:17 +00:00
{
2015-03-23 23:46:30 +00:00
this.sprite.x = this.boundsRect.x + this.sprite.offsetX;
2014-02-05 06:29:17 +00:00
}
2015-03-23 23:46:30 +00:00
else if (this.sprite.right > this.boundsRect.right)
2014-02-05 06:29:17 +00:00
{
2015-03-23 23:46:30 +00:00
this.sprite.x = this.boundsRect.right - (this.sprite.width - this.sprite.offsetX);
2014-02-05 06:29:17 +00:00
}
2015-03-23 23:46:30 +00:00
if (this.sprite.top < this.boundsRect.top)
2014-02-05 06:29:17 +00:00
{
2015-03-23 23:46:30 +00:00
this.sprite.y = this.boundsRect.top + this.sprite.offsetY;
2014-02-05 06:29:17 +00:00
}
2015-03-23 23:46:30 +00:00
else if (this.sprite.bottom > this.boundsRect.bottom)
2014-02-05 06:29:17 +00:00
{
2015-03-23 23:46:30 +00:00
this.sprite.y = this.boundsRect.bottom - (this.sprite.height - this.sprite.offsetY);
2014-02-05 06:29:17 +00:00
}
2013-10-02 14:05:55 +00:00
}
},
2013-11-28 15:57:09 +00:00
/**
2013-10-02 14:05:55 +00:00
* Parent Sprite Bounds check for the sprite drag.
2015-10-15 11:06:38 +00:00
*
2013-10-02 14:05:55 +00:00
* @method Phaser.InputHandler#checkBoundsSprite
*/
checkBoundsSprite: function () {
2015-03-23 23:46:30 +00:00
if (this.sprite.fixedToCamera & & this.boundsSprite.fixedToCamera)
2013-10-02 14:05:55 +00:00
{
2015-03-23 23:46:30 +00:00
if (this.sprite.cameraOffset.x < this.boundsSprite.cameraOffset.x)
2014-02-05 06:29:17 +00:00
{
2015-03-23 23:46:30 +00:00
this.sprite.cameraOffset.x = this.boundsSprite.cameraOffset.x;
2014-02-05 06:29:17 +00:00
}
2015-03-23 23:46:30 +00:00
else if ((this.sprite.cameraOffset.x + this.sprite.width) > (this.boundsSprite.cameraOffset.x + this.boundsSprite.width))
2014-02-05 06:29:17 +00:00
{
2015-03-23 23:46:30 +00:00
this.sprite.cameraOffset.x = (this.boundsSprite.cameraOffset.x + this.boundsSprite.width) - this.sprite.width;
2014-02-05 06:29:17 +00:00
}
2013-10-02 14:05:55 +00:00
2015-03-23 23:46:30 +00:00
if (this.sprite.cameraOffset.y < this.boundsSprite.cameraOffset.y)
2014-02-05 06:29:17 +00:00
{
2015-03-23 23:46:30 +00:00
this.sprite.cameraOffset.y = this.boundsSprite.cameraOffset.y;
2014-02-05 06:29:17 +00:00
}
2015-03-23 23:46:30 +00:00
else if ((this.sprite.cameraOffset.y + this.sprite.height) > (this.boundsSprite.cameraOffset.y + this.boundsSprite.height))
2014-02-05 06:29:17 +00:00
{
2015-03-23 23:46:30 +00:00
this.sprite.cameraOffset.y = (this.boundsSprite.cameraOffset.y + this.boundsSprite.height) - this.sprite.height;
2014-02-05 06:29:17 +00:00
}
2013-10-02 14:05:55 +00:00
}
2014-02-05 06:29:17 +00:00
else
2013-10-02 14:05:55 +00:00
{
2015-03-23 23:46:30 +00:00
if (this.sprite.left < this.boundsSprite.left)
2014-02-05 06:29:17 +00:00
{
2015-03-23 23:46:30 +00:00
this.sprite.x = this.boundsSprite.left + this.sprite.offsetX;
2014-02-05 06:29:17 +00:00
}
2015-03-23 23:46:30 +00:00
else if (this.sprite.right > this.boundsSprite.right)
2014-02-05 06:29:17 +00:00
{
2015-03-23 23:46:30 +00:00
this.sprite.x = this.boundsSprite.right - (this.sprite.width - this.sprite.offsetX);
2014-02-05 06:29:17 +00:00
}
2015-03-23 23:46:30 +00:00
if (this.sprite.top < this.boundsSprite.top)
2014-02-05 06:29:17 +00:00
{
2015-03-23 23:46:30 +00:00
this.sprite.y = this.boundsSprite.top + this.sprite.offsetY;
2014-02-05 06:29:17 +00:00
}
2015-03-23 23:46:30 +00:00
else if (this.sprite.bottom > this.boundsSprite.bottom)
2014-02-05 06:29:17 +00:00
{
2015-03-23 23:46:30 +00:00
this.sprite.y = this.boundsSprite.bottom - (this.sprite.height - this.sprite.offsetY);
2014-02-05 06:29:17 +00:00
}
2013-10-02 14:05:55 +00:00
}
}
2014-02-05 06:29:17 +00:00
};
Phaser.InputHandler.prototype.constructor = Phaser.InputHandler;
< / pre >
2013-10-02 14:05:55 +00:00
< / article >
< / section >
< / div >
< div class = "clearfix" > < / div >
< footer >
< span class = "copyright" >
2016-04-22 14:15:28 +00:00
Phaser Copyright © 2012-2016 Photon Storm Ltd.
2013-10-02 14:05:55 +00:00
< / span >
< br / >
< span class = "jsdoc-message" >
2016-08-26 00:18:47 +00:00
Documentation generated by < a href = "https://github.com/jsdoc3/jsdoc" > JSDoc 3.4.0< / a >
on Fri Aug 26 2016 01:16:09 GMT+0100 (BST) using the < a href = "https://github.com/terryweiss/docstrap" > DocStrap template< / a > .
2013-10-02 14:05:55 +00:00
< / span >
< / footer >
< / div >
< br clear = "both" >
< / div >
< / div >
< script src = "scripts/sunlight.js" > < / script >
< script src = "scripts/sunlight.javascript.js" > < / script >
< script src = "scripts/sunlight-plugin.doclinks.js" > < / script >
< script src = "scripts/sunlight-plugin.linenumbers.js" > < / script >
< script src = "scripts/sunlight-plugin.menu.js" > < / script >
< script src = "scripts/jquery.min.js" > < / script >
< script src = "scripts/jquery.scrollTo.js" > < / script >
< script src = "scripts/jquery.localScroll.js" > < / script >
< script src = "scripts/bootstrap-dropdown.js" > < / script >
< script src = "scripts/toc.js" > < / script >
< script > Sunlight . highlightAll ( { lineNumbers : true , showMenu : true , enableDoclinks : true } ) ; < / script >
< script >
$( function () {
$( "#toc" ).toc( {
2014-04-10 22:13:43 +00:00
anchorName : function(i, heading, prefix) {
2014-03-14 06:36:05 +00:00
return $(heading).attr("id") || ( prefix + i );
},
2013-10-02 14:05:55 +00:00
selectors : "h1,h2,h3,h4",
showAndHide : false,
scrollTo : 60
} );
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
} );
< / script >
< / body >
< / html >