mirror of
https://github.com/photonstorm/phaser
synced 2024-11-16 09:48:18 +00:00
1878 lines
49 KiB
HTML
1878 lines
49 KiB
HTML
|
<!DOCTYPE html>
|
||
|
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<meta charset="utf-8">
|
||
|
<title>Phaser Source: d:/wamp/www/phaser/src/pixi/InteractionManager.js</title>
|
||
|
|
||
|
<!--[if lt IE 9]>
|
||
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||
|
<![endif]-->
|
||
|
|
||
|
<link type="text/css" rel="stylesheet" href="styles/default.css">
|
||
|
|
||
|
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
|
||
|
|
||
|
|
||
|
<link type="text/css" rel="stylesheet" href="styles/site.cerulean.css">
|
||
|
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
<div class="container-fluid">
|
||
|
<div class="navbar navbar-fixed-top navbar-inverse">
|
||
|
<div class="navbar-inner">
|
||
|
<a class="brand" href="index.html">Phaser</a>
|
||
|
<ul class="nav">
|
||
|
|
||
|
<li class="dropdown">
|
||
|
<a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b
|
||
|
class="caret"></b></a>
|
||
|
|
||
|
<ul class="dropdown-menu ">
|
||
|
|
||
|
<li class="class-depth-0">
|
||
|
<a href="Phaser.html">Phaser</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-0">
|
||
|
<a href="PIXI.html">PIXI</a>
|
||
|
</li>
|
||
|
|
||
|
|
||
|
</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 ">
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Animation.html">Animation</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.AnimationManager.html">AnimationManager</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.AnimationParser.html">AnimationParser</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.ArrayList.html">ArrayList</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.ArrayUtils.html">ArrayUtils</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.AudioSprite.html">AudioSprite</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.BitmapData.html">BitmapData</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.BitmapText.html">BitmapText</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Button.html">Button</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Cache.html">Cache</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Camera.html">Camera</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Canvas.html">Canvas</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Circle.html">Circle</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Color.html">Color</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Device.html">Device</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.DOM.html">DOM</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Easing.html">Easing</a>
|
||
|
</li>
|
||
|
|
||
|
<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>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Ellipse.html">Ellipse</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Events.html">Events</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Filter.html">Filter</a>
|
||
|
</li>
|
||
|
|
||
|
<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>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Frame.html">Frame</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.FrameData.html">FrameData</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Game.html">Game</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.GameObjectCreator.html">GameObjectCreator</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.GameObjectFactory.html">GameObjectFactory</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Gamepad.html">Gamepad</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.GamepadButton.html">GamepadButton</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Graphics.html">Graphics</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Group.html">Group</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Image.html">Image</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Input.html">Input</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.InputHandler.html">InputHandler</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Key.html">Key</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Keyboard.html">Keyboard</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Line.html">Line</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.LinkedList.html">LinkedList</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Loader.html">Loader</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.LoaderParser.html">LoaderParser</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Math.html">Math</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Mouse.html">Mouse</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.MSPointer.html">MSPointer</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Net.html">Net</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Particle.html">Particle</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Particles.html">Particles</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-2">
|
||
|
<a href="Phaser.Particles.Arcade.html">Arcade</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-3">
|
||
|
<a href="Phaser.Particles.Arcade.Emitter.html">Emitter</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Physics.html">Physics</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-2">
|
||
|
<a href="Phaser.Physics.Arcade.html">Arcade</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-3">
|
||
|
<a href="Phaser.Physics.Arcade.Body.html">Body</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-2">
|
||
|
<a href="Phaser.Physics.Ninja.html">Ninja</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-3">
|
||
|
<a href="Phaser.Physics.Ninja.AABB.html">AABB</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-3">
|
||
|
<a href="Phaser.Physics.Ninja.Body.html">Body</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-3">
|
||
|
<a href="Phaser.Physics.Ninja.Circle.html">Circle</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-3">
|
||
|
<a href="Phaser.Physics.Ninja.Tile.html">Tile</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-2">
|
||
|
<a href="Phaser.Physics.P2.html">P2</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-3">
|
||
|
<a href="Phaser.Physics.P2.Body.html">Body</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-3">
|
||
|
<a href="Phaser.Physics.P2.BodyDebug.html">BodyDebug</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-3">
|
||
|
<a href="Phaser.Physics.P2.CollisionGroup.html">CollisionGroup</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-3">
|
||
|
<a href="Phaser.Physics.P2.ContactMaterial.html">ContactMaterial</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-3">
|
||
|
<a href="Phaser.Physics.P2.DistanceConstraint.html">DistanceConstraint</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-3">
|
||
|
<a href="Phaser.Physics.P2.FixtureList.html">FixtureList</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-3">
|
||
|
<a href="Phaser.Physics.P2.GearConstraint.html">GearConstraint</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-3">
|
||
|
<a href="Phaser.Physics.P2.InversePointProxy.html">InversePointProxy</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-3">
|
||
|
<a href="Phaser.Physics.P2.LockConstraint.html">LockConstraint</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-3">
|
||
|
<a href="Phaser.Physics.P2.Material.html">Material</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-3">
|
||
|
<a href="Phaser.Physics.P2.PointProxy.html">PointProxy</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-3">
|
||
|
<a href="Phaser.Physics.P2.PrismaticConstraint.html">PrismaticConstraint</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-3">
|
||
|
<a href="Phaser.Physics.P2.RevoluteConstraint.html">RevoluteConstraint</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-3">
|
||
|
<a href="Phaser.Physics.P2.RotationalSpring.html">RotationalSpring</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-3">
|
||
|
<a href="Phaser.Physics.P2.Spring.html">Spring</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Plugin.html">Plugin</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.PluginManager.html">PluginManager</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Point.html">Point</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Pointer.html">Pointer</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Polygon.html">Polygon</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.QuadTree.html">QuadTree</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.RandomDataGenerator.html">RandomDataGenerator</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Rectangle.html">Rectangle</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.RenderTexture.html">RenderTexture</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.RequestAnimationFrame.html">RequestAnimationFrame</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.RetroFont.html">RetroFont</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Rope.html">Rope</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.ScaleManager.html">ScaleManager</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Signal.html">Signal</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.SignalBinding.html">SignalBinding</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.SinglePad.html">SinglePad</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Sound.html">Sound</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.SoundManager.html">SoundManager</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Sprite.html">Sprite</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.SpriteBatch.html">SpriteBatch</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Stage.html">Stage</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.State.html">State</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.StateManager.html">StateManager</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Text.html">Text</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Tile.html">Tile</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Tilemap.html">Tilemap</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.TilemapLayer.html">TilemapLayer</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.TilemapParser.html">TilemapParser</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Tileset.html">Tileset</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.TileSprite.html">TileSprite</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Time.html">Time</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Timer.html">Timer</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.TimerEvent.html">TimerEvent</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Touch.html">Touch</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Tween.html">Tween</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.TweenManager.html">TweenManager</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.Utils.html">Utils</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-2">
|
||
|
<a href="Phaser.Utils.Debug.html">Debug</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="Phaser.World.html">World</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.AbstractFilter.html">AbstractFilter</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.AjaxRequest.html">AjaxRequest</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.AlphaMaskFilter.html">AlphaMaskFilter</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.AsciiFilter.html">AsciiFilter</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.AssetLoader.html">AssetLoader</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.AtlasLoader.html">AtlasLoader</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.BaseTexture.html">BaseTexture</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.BitmapFontLoader.html">BitmapFontLoader</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.BitmapText.html">BitmapText</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.BlurFilter.html">BlurFilter</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.BlurXFilter.html">BlurXFilter</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.BlurYFilter.html">BlurYFilter</a>
|
||
|
</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>
|
||
|
|
||
|
<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.Circle.html">Circle</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.ColorMatrixFilter.html">ColorMatrixFilter</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.ColorStepFilter.html">ColorStepFilter</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.ComplexPrimitiveShader.html">ComplexPrimitiveShader</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.ConvolutionFilter.html">ConvolutionFilter</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.CrossHatchFilter.html">CrossHatchFilter</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.DisplacementFilter.html">DisplacementFilter</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.DisplayObject.html">DisplayObject</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.DisplayObjectContainer.html">DisplayObjectContainer</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.DotScreenFilter.html">DotScreenFilter</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.Ellipse.html">Ellipse</a>
|
||
|
</li>
|
||
|
|
||
|
<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.FilterBlock.html">FilterBlock</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.GrayFilter.html">GrayFilter</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.ImageLoader.html">ImageLoader</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.InteractionData.html">InteractionData</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.InteractionManager.html">InteractionManager</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.InvertFilter.html">InvertFilter</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.JsonLoader.html">JsonLoader</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.Matrix.html">Matrix</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.MovieClip.html">MovieClip</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.NoiseFilter.html">NoiseFilter</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.NormalMapFilter.html">NormalMapFilter</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.PixelateFilter.html">PixelateFilter</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.PIXI.html">PIXI</a>
|
||
|
</li>
|
||
|
|
||
|
<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">
|
||
|
<a href="PIXI.Point.html">Point</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.Polygon.html">Polygon</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.PolyK.html">PolyK</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.PrimitiveShader.html">PrimitiveShader</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.Rectangle.html">Rectangle</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.RenderTexture.html">RenderTexture</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.RGBSplitFilter.html">RGBSplitFilter</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.Rope.html">Rope</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.RoundedRectangle.html">RoundedRectangle</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.SepiaFilter.html">SepiaFilter</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.SmartBlurFilter.html">SmartBlurFilter</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.Spine.html">Spine</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.SpineLoader.html">SpineLoader</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.Sprite.html">Sprite</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.SpriteBatch.html">SpriteBatch</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.SpriteSheetLoader.html">SpriteSheetLoader</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.Stage.html">Stage</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.Strip.html">Strip</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.StripShader.html">StripShader</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.Text.html">Text</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.Texture.html">Texture</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.TilingSprite.html">TilingSprite</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.TiltShiftFilter.html">TiltShiftFilter</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.TiltShiftXFilter.html">TiltShiftXFilter</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.TiltShiftYFilter.html">TiltShiftYFilter</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.TwistFilter.html">TwistFilter</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.VideoTexture.html">VideoTexture</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.WebGLBlendModeManager.html">WebGLBlendModeManager</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.WebGLFastSpriteBatch.html">WebGLFastSpriteBatch</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.WebGLFilterManager.html">WebGLFilterManager</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-1">
|
||
|
<a href="PIXI.WebGLRenderer.html">WebGLRenderer</a>
|
||
|
</li>
|
||
|
|
||
|
|
||
|
</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 ">
|
||
|
|
||
|
<li class="class-depth-0">
|
||
|
<a href="global.html#clone">clone</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-0">
|
||
|
<a href="global.html#createCustomLayer">createCustomLayer</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-0">
|
||
|
<a href="global.html#createFixedLayer">createFixedLayer</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-0">
|
||
|
<a href="global.html#createFluidLayer">createFluidLayer</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-0">
|
||
|
<a href="global.html#createFullLayer">createFullLayer</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-0">
|
||
|
<a href="global.html#debug">debug</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-0">
|
||
|
<a href="global.html#destroy">destroy</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-0">
|
||
|
<a href="global.html#onResize">onResize</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-0">
|
||
|
<a href="global.html#originalEvent">originalEvent</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-0">
|
||
|
<a href="global.html#refresh">refresh</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-0">
|
||
|
<a href="global.html#reset">reset</a>
|
||
|
</li>
|
||
|
|
||
|
<li class="class-depth-0">
|
||
|
<a href="global.html#setSize">setSize</a>
|
||
|
</li>
|
||
|
|
||
|
|
||
|
</ul>
|
||
|
</li>
|
||
|
|
||
|
</ul>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="row-fluid">
|
||
|
|
||
|
|
||
|
<div class="span12">
|
||
|
|
||
|
<div id="main">
|
||
|
|
||
|
|
||
|
|
||
|
<h1 class="page-title">Source: d:/wamp/www/phaser/src/pixi/InteractionManager.js</h1>
|
||
|
|
||
|
<section>
|
||
|
<article>
|
||
|
<pre class="sunlight-highlight-javascript linenums">/**
|
||
|
* @author Mat Groves http://matgroves.com/ @Doormat23
|
||
|
*/
|
||
|
|
||
|
/**
|
||
|
* The interaction manager deals with mouse and touch events. Any DisplayObject can be interactive
|
||
|
* if its interactive parameter is set to true
|
||
|
* This manager also supports multitouch.
|
||
|
*
|
||
|
* @class InteractionManager
|
||
|
* @constructor
|
||
|
* @param stage {Stage} The stage to handle interactions
|
||
|
*/
|
||
|
PIXI.InteractionManager = function(stage)
|
||
|
{
|
||
|
/**
|
||
|
* A reference to the stage
|
||
|
*
|
||
|
* @property stage
|
||
|
* @type Stage
|
||
|
*/
|
||
|
this.stage = stage;
|
||
|
|
||
|
/**
|
||
|
* The mouse data
|
||
|
*
|
||
|
* @property mouse
|
||
|
* @type InteractionData
|
||
|
*/
|
||
|
this.mouse = new PIXI.InteractionData();
|
||
|
|
||
|
/**
|
||
|
* An object that stores current touches (InteractionData) by id reference
|
||
|
*
|
||
|
* @property touches
|
||
|
* @type Object
|
||
|
*/
|
||
|
this.touches = {};
|
||
|
|
||
|
/**
|
||
|
* @property tempPoint
|
||
|
* @type Point
|
||
|
* @private
|
||
|
*/
|
||
|
this.tempPoint = new PIXI.Point();
|
||
|
|
||
|
/**
|
||
|
* @property mouseoverEnabled
|
||
|
* @type Boolean
|
||
|
* @default
|
||
|
*/
|
||
|
this.mouseoverEnabled = true;
|
||
|
|
||
|
/**
|
||
|
* Tiny little interactiveData pool !
|
||
|
*
|
||
|
* @property pool
|
||
|
* @type Array
|
||
|
*/
|
||
|
this.pool = [];
|
||
|
|
||
|
/**
|
||
|
* An array containing all the iterative items from the our interactive tree
|
||
|
* @property interactiveItems
|
||
|
* @type Array
|
||
|
* @private
|
||
|
*/
|
||
|
this.interactiveItems = [];
|
||
|
|
||
|
/**
|
||
|
* Our canvas
|
||
|
* @property interactionDOMElement
|
||
|
* @type HTMLCanvasElement
|
||
|
* @private
|
||
|
*/
|
||
|
this.interactionDOMElement = null;
|
||
|
|
||
|
//this will make it so that you don't have to call bind all the time
|
||
|
|
||
|
/**
|
||
|
* @property onMouseMove
|
||
|
* @type Function
|
||
|
*/
|
||
|
this.onMouseMove = this.onMouseMove.bind( this );
|
||
|
|
||
|
/**
|
||
|
* @property onMouseDown
|
||
|
* @type Function
|
||
|
*/
|
||
|
this.onMouseDown = this.onMouseDown.bind(this);
|
||
|
|
||
|
/**
|
||
|
* @property onMouseOut
|
||
|
* @type Function
|
||
|
*/
|
||
|
this.onMouseOut = this.onMouseOut.bind(this);
|
||
|
|
||
|
/**
|
||
|
* @property onMouseUp
|
||
|
* @type Function
|
||
|
*/
|
||
|
this.onMouseUp = this.onMouseUp.bind(this);
|
||
|
|
||
|
/**
|
||
|
* @property onTouchStart
|
||
|
* @type Function
|
||
|
*/
|
||
|
this.onTouchStart = this.onTouchStart.bind(this);
|
||
|
|
||
|
/**
|
||
|
* @property onTouchEnd
|
||
|
* @type Function
|
||
|
*/
|
||
|
this.onTouchEnd = this.onTouchEnd.bind(this);
|
||
|
|
||
|
/**
|
||
|
* @property onTouchMove
|
||
|
* @type Function
|
||
|
*/
|
||
|
this.onTouchMove = this.onTouchMove.bind(this);
|
||
|
|
||
|
/**
|
||
|
* @property last
|
||
|
* @type Number
|
||
|
*/
|
||
|
this.last = 0;
|
||
|
|
||
|
/**
|
||
|
* The css style of the cursor that is being used
|
||
|
* @property currentCursorStyle
|
||
|
* @type String
|
||
|
*/
|
||
|
this.currentCursorStyle = 'inherit';
|
||
|
|
||
|
/**
|
||
|
* Is set to true when the mouse is moved out of the canvas
|
||
|
* @property mouseOut
|
||
|
* @type Boolean
|
||
|
*/
|
||
|
this.mouseOut = false;
|
||
|
|
||
|
/**
|
||
|
* @property resolution
|
||
|
* @type Number
|
||
|
*/
|
||
|
this.resolution = 1;
|
||
|
};
|
||
|
|
||
|
// constructor
|
||
|
PIXI.InteractionManager.prototype.constructor = PIXI.InteractionManager;
|
||
|
|
||
|
/**
|
||
|
* Collects an interactive sprite recursively to have their interactions managed
|
||
|
*
|
||
|
* @method collectInteractiveSprite
|
||
|
* @param displayObject {DisplayObject} the displayObject to collect
|
||
|
* @param iParent {DisplayObject} the display object's parent
|
||
|
* @private
|
||
|
*/
|
||
|
PIXI.InteractionManager.prototype.collectInteractiveSprite = function(displayObject, iParent)
|
||
|
{
|
||
|
var children = displayObject.children;
|
||
|
var length = children.length;
|
||
|
|
||
|
// make an interaction tree... {item.__interactiveParent}
|
||
|
for (var i = length - 1; i >= 0; i--)
|
||
|
{
|
||
|
var child = children[i];
|
||
|
|
||
|
// push all interactive bits
|
||
|
if (child._interactive)
|
||
|
{
|
||
|
iParent.interactiveChildren = true;
|
||
|
//child.__iParent = iParent;
|
||
|
this.interactiveItems.push(child);
|
||
|
|
||
|
if (child.children.length > 0) {
|
||
|
this.collectInteractiveSprite(child, child);
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
child.__iParent = null;
|
||
|
if (child.children.length > 0)
|
||
|
{
|
||
|
this.collectInteractiveSprite(child, iParent);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Sets the target for event delegation
|
||
|
*
|
||
|
* @method setTarget
|
||
|
* @param target {WebGLRenderer|CanvasRenderer} the renderer to bind events to
|
||
|
* @private
|
||
|
*/
|
||
|
PIXI.InteractionManager.prototype.setTarget = function(target)
|
||
|
{
|
||
|
this.target = target;
|
||
|
this.resolution = target.resolution;
|
||
|
|
||
|
// Check if the dom element has been set. If it has don't do anything.
|
||
|
if (this.interactionDOMElement !== null) return;
|
||
|
|
||
|
this.setTargetDomElement (target.view);
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Sets the DOM element which will receive mouse/touch events. This is useful for when you have other DOM
|
||
|
* elements on top of the renderers Canvas element. With this you'll be able to delegate another DOM element
|
||
|
* to receive those events
|
||
|
*
|
||
|
* @method setTargetDomElement
|
||
|
* @param domElement {DOMElement} the DOM element which will receive mouse and touch events
|
||
|
* @private
|
||
|
*/
|
||
|
PIXI.InteractionManager.prototype.setTargetDomElement = function(domElement)
|
||
|
{
|
||
|
this.removeEvents();
|
||
|
|
||
|
if (window.navigator.msPointerEnabled)
|
||
|
{
|
||
|
// time to remove some of that zoom in ja..
|
||
|
domElement.style['-ms-content-zooming'] = 'none';
|
||
|
domElement.style['-ms-touch-action'] = 'none';
|
||
|
}
|
||
|
|
||
|
this.interactionDOMElement = domElement;
|
||
|
|
||
|
domElement.addEventListener('mousemove', this.onMouseMove, true);
|
||
|
domElement.addEventListener('mousedown', this.onMouseDown, true);
|
||
|
domElement.addEventListener('mouseout', this.onMouseOut, true);
|
||
|
|
||
|
// aint no multi touch just yet!
|
||
|
domElement.addEventListener('touchstart', this.onTouchStart, true);
|
||
|
domElement.addEventListener('touchend', this.onTouchEnd, true);
|
||
|
domElement.addEventListener('touchmove', this.onTouchMove, true);
|
||
|
|
||
|
window.addEventListener('mouseup', this.onMouseUp, true);
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* @method removeEvents
|
||
|
* @private
|
||
|
*/
|
||
|
PIXI.InteractionManager.prototype.removeEvents = function()
|
||
|
{
|
||
|
if (!this.interactionDOMElement) return;
|
||
|
|
||
|
this.interactionDOMElement.style['-ms-content-zooming'] = '';
|
||
|
this.interactionDOMElement.style['-ms-touch-action'] = '';
|
||
|
|
||
|
this.interactionDOMElement.removeEventListener('mousemove', this.onMouseMove, true);
|
||
|
this.interactionDOMElement.removeEventListener('mousedown', this.onMouseDown, true);
|
||
|
this.interactionDOMElement.removeEventListener('mouseout', this.onMouseOut, true);
|
||
|
|
||
|
// aint no multi touch just yet!
|
||
|
this.interactionDOMElement.removeEventListener('touchstart', this.onTouchStart, true);
|
||
|
this.interactionDOMElement.removeEventListener('touchend', this.onTouchEnd, true);
|
||
|
this.interactionDOMElement.removeEventListener('touchmove', this.onTouchMove, true);
|
||
|
|
||
|
this.interactionDOMElement = null;
|
||
|
|
||
|
window.removeEventListener('mouseup', this.onMouseUp, true);
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* updates the state of interactive objects
|
||
|
*
|
||
|
* @method update
|
||
|
* @private
|
||
|
*/
|
||
|
PIXI.InteractionManager.prototype.update = function()
|
||
|
{
|
||
|
if (!this.target) return;
|
||
|
|
||
|
// frequency of 30fps??
|
||
|
var now = Date.now();
|
||
|
var diff = now - this.last;
|
||
|
diff = (diff * PIXI.INTERACTION_FREQUENCY ) / 1000;
|
||
|
if (diff < 1) return;
|
||
|
this.last = now;
|
||
|
|
||
|
var i = 0;
|
||
|
|
||
|
// ok.. so mouse events??
|
||
|
// yes for now :)
|
||
|
// OPTIMISE - how often to check??
|
||
|
if (this.dirty)
|
||
|
{
|
||
|
this.rebuildInteractiveGraph();
|
||
|
}
|
||
|
|
||
|
// loop through interactive objects!
|
||
|
var length = this.interactiveItems.length;
|
||
|
var cursor = 'inherit';
|
||
|
var over = false;
|
||
|
|
||
|
for (i = 0; i < length; i++)
|
||
|
{
|
||
|
var item = this.interactiveItems[i];
|
||
|
|
||
|
// OPTIMISATION - only calculate every time if the mousemove function exists..
|
||
|
// OK so.. does the object have any other interactive functions?
|
||
|
// hit-test the clip!
|
||
|
// if (item.mouseover || item.mouseout || item.buttonMode)
|
||
|
// {
|
||
|
// ok so there are some functions so lets hit test it..
|
||
|
item.__hit = this.hitTest(item, this.mouse);
|
||
|
this.mouse.target = item;
|
||
|
// ok so deal with interactions..
|
||
|
// looks like there was a hit!
|
||
|
if (item.__hit && !over)
|
||
|
{
|
||
|
if (item.buttonMode) cursor = item.defaultCursor;
|
||
|
|
||
|
if (!item.interactiveChildren)
|
||
|
{
|
||
|
over = true;
|
||
|
}
|
||
|
|
||
|
if (!item.__isOver)
|
||
|
{
|
||
|
if (item.mouseover)
|
||
|
{
|
||
|
item.mouseover (this.mouse);
|
||
|
}
|
||
|
item.__isOver = true;
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (item.__isOver)
|
||
|
{
|
||
|
// roll out!
|
||
|
if (item.mouseout)
|
||
|
{
|
||
|
item.mouseout (this.mouse);
|
||
|
}
|
||
|
item.__isOver = false;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if (this.currentCursorStyle !== cursor)
|
||
|
{
|
||
|
this.currentCursorStyle = cursor;
|
||
|
this.interactionDOMElement.style.cursor = cursor;
|
||
|
}
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* @method rebuildInteractiveGraph
|
||
|
* @private
|
||
|
*/
|
||
|
PIXI.InteractionManager.prototype.rebuildInteractiveGraph = function()
|
||
|
{
|
||
|
this.dirty = false;
|
||
|
|
||
|
var len = this.interactiveItems.length;
|
||
|
|
||
|
for (var i = 0; i < len; i++) {
|
||
|
this.interactiveItems[i].interactiveChildren = false;
|
||
|
}
|
||
|
|
||
|
this.interactiveItems = [];
|
||
|
|
||
|
if (this.stage.interactive)
|
||
|
{
|
||
|
this.interactiveItems.push(this.stage);
|
||
|
}
|
||
|
|
||
|
// Go through and collect all the objects that are interactive..
|
||
|
this.collectInteractiveSprite(this.stage, this.stage);
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Is called when the mouse moves across the renderer element
|
||
|
*
|
||
|
* @method onMouseMove
|
||
|
* @param event {Event} The DOM event of the mouse moving
|
||
|
* @private
|
||
|
*/
|
||
|
PIXI.InteractionManager.prototype.onMouseMove = function(event)
|
||
|
{
|
||
|
if (this.dirty)
|
||
|
{
|
||
|
this.rebuildInteractiveGraph();
|
||
|
}
|
||
|
|
||
|
this.mouse.originalEvent = event;
|
||
|
|
||
|
// TODO optimize by not check EVERY TIME! maybe half as often? //
|
||
|
var rect = this.interactionDOMElement.getBoundingClientRect();
|
||
|
|
||
|
this.mouse.global.x = (event.clientX - rect.left) * (this.target.width / rect.width) / this.resolution;
|
||
|
this.mouse.global.y = (event.clientY - rect.top) * ( this.target.height / rect.height) / this.resolution;
|
||
|
|
||
|
var length = this.interactiveItems.length;
|
||
|
|
||
|
for (var i = 0; i < length; i++)
|
||
|
{
|
||
|
var item = this.interactiveItems[i];
|
||
|
|
||
|
// Call the function!
|
||
|
if (item.mousemove)
|
||
|
{
|
||
|
item.mousemove(this.mouse);
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Is called when the mouse button is pressed down on the renderer element
|
||
|
*
|
||
|
* @method onMouseDown
|
||
|
* @param event {Event} The DOM event of a mouse button being pressed down
|
||
|
* @private
|
||
|
*/
|
||
|
PIXI.InteractionManager.prototype.onMouseDown = function(event)
|
||
|
{
|
||
|
if (this.dirty)
|
||
|
{
|
||
|
this.rebuildInteractiveGraph();
|
||
|
}
|
||
|
|
||
|
this.mouse.originalEvent = event;
|
||
|
|
||
|
if (PIXI.AUTO_PREVENT_DEFAULT)
|
||
|
{
|
||
|
this.mouse.originalEvent.preventDefault();
|
||
|
}
|
||
|
|
||
|
// loop through interaction tree...
|
||
|
// hit test each item! ->
|
||
|
// get interactive items under point??
|
||
|
//stage.__i
|
||
|
var length = this.interactiveItems.length;
|
||
|
|
||
|
var e = this.mouse.originalEvent;
|
||
|
var isRightButton = e.button === 2 || e.which === 3;
|
||
|
var downFunction = isRightButton ? 'rightdown' : 'mousedown';
|
||
|
var clickFunction = isRightButton ? 'rightclick' : 'click';
|
||
|
var buttonIsDown = isRightButton ? '__rightIsDown' : '__mouseIsDown';
|
||
|
var isDown = isRightButton ? '__isRightDown' : '__isDown';
|
||
|
|
||
|
// while
|
||
|
// hit test
|
||
|
for (var i = 0; i < length; i++)
|
||
|
{
|
||
|
var item = this.interactiveItems[i];
|
||
|
|
||
|
if (item[downFunction] || item[clickFunction])
|
||
|
{
|
||
|
item[buttonIsDown] = true;
|
||
|
item.__hit = this.hitTest(item, this.mouse);
|
||
|
|
||
|
if (item.__hit)
|
||
|
{
|
||
|
//call the function!
|
||
|
if (item[downFunction])
|
||
|
{
|
||
|
item[downFunction](this.mouse);
|
||
|
}
|
||
|
item[isDown] = true;
|
||
|
|
||
|
// just the one!
|
||
|
if (!item.interactiveChildren) break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Is called when the mouse is moved out of the renderer element
|
||
|
*
|
||
|
* @method onMouseOut
|
||
|
* @param event {Event} The DOM event of a mouse being moved out
|
||
|
* @private
|
||
|
*/
|
||
|
PIXI.InteractionManager.prototype.onMouseOut = function(event)
|
||
|
{
|
||
|
if (this.dirty)
|
||
|
{
|
||
|
this.rebuildInteractiveGraph();
|
||
|
}
|
||
|
|
||
|
this.mouse.originalEvent = event;
|
||
|
|
||
|
var length = this.interactiveItems.length;
|
||
|
|
||
|
this.interactionDOMElement.style.cursor = 'inherit';
|
||
|
|
||
|
for (var i = 0; i < length; i++)
|
||
|
{
|
||
|
var item = this.interactiveItems[i];
|
||
|
if (item.__isOver)
|
||
|
{
|
||
|
this.mouse.target = item;
|
||
|
if (item.mouseout)
|
||
|
{
|
||
|
item.mouseout(this.mouse);
|
||
|
}
|
||
|
item.__isOver = false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
this.mouseOut = true;
|
||
|
|
||
|
// move the mouse to an impossible position
|
||
|
this.mouse.global.x = -10000;
|
||
|
this.mouse.global.y = -10000;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Is called when the mouse button is released on the renderer element
|
||
|
*
|
||
|
* @method onMouseUp
|
||
|
* @param event {Event} The DOM event of a mouse button being released
|
||
|
* @private
|
||
|
*/
|
||
|
PIXI.InteractionManager.prototype.onMouseUp = function(event)
|
||
|
{
|
||
|
if (this.dirty)
|
||
|
{
|
||
|
this.rebuildInteractiveGraph();
|
||
|
}
|
||
|
|
||
|
this.mouse.originalEvent = event;
|
||
|
|
||
|
var length = this.interactiveItems.length;
|
||
|
var up = false;
|
||
|
|
||
|
var e = this.mouse.originalEvent;
|
||
|
var isRightButton = e.button === 2 || e.which === 3;
|
||
|
|
||
|
var upFunction = isRightButton ? 'rightup' : 'mouseup';
|
||
|
var clickFunction = isRightButton ? 'rightclick' : 'click';
|
||
|
var upOutsideFunction = isRightButton ? 'rightupoutside' : 'mouseupoutside';
|
||
|
var isDown = isRightButton ? '__isRightDown' : '__isDown';
|
||
|
|
||
|
for (var i = 0; i < length; i++)
|
||
|
{
|
||
|
var item = this.interactiveItems[i];
|
||
|
|
||
|
if (item[clickFunction] || item[upFunction] || item[upOutsideFunction])
|
||
|
{
|
||
|
item.__hit = this.hitTest(item, this.mouse);
|
||
|
|
||
|
if (item.__hit && !up)
|
||
|
{
|
||
|
//call the function!
|
||
|
if (item[upFunction])
|
||
|
{
|
||
|
item[upFunction](this.mouse);
|
||
|
}
|
||
|
if (item[isDown])
|
||
|
{
|
||
|
if (item[clickFunction])
|
||
|
{
|
||
|
item[clickFunction](this.mouse);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if (!item.interactiveChildren)
|
||
|
{
|
||
|
up = true;
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (item[isDown])
|
||
|
{
|
||
|
if (item[upOutsideFunction]) item[upOutsideFunction](this.mouse);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
item[isDown] = false;
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Tests if the current mouse coordinates hit a sprite
|
||
|
*
|
||
|
* @method hitTest
|
||
|
* @param item {DisplayObject} The displayObject to test for a hit
|
||
|
* @param interactionData {InteractionData} The interactionData object to update in the case there is a hit
|
||
|
* @private
|
||
|
*/
|
||
|
PIXI.InteractionManager.prototype.hitTest = function(item, interactionData)
|
||
|
{
|
||
|
var global = interactionData.global;
|
||
|
|
||
|
if (!item.worldVisible)
|
||
|
{
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
// temp fix for if the element is in a non visible
|
||
|
|
||
|
var worldTransform = item.worldTransform, i,
|
||
|
a = worldTransform.a, b = worldTransform.b,
|
||
|
c = worldTransform.c, tx = worldTransform.tx,
|
||
|
d = worldTransform.d, ty = worldTransform.ty,
|
||
|
|
||
|
id = 1 / (a * d + c * -b),
|
||
|
x = d * id * global.x + -c * id * global.y + (ty * c - tx * d) * id,
|
||
|
y = a * id * global.y + -b * id * global.x + (-ty * a + tx * b) * id;
|
||
|
|
||
|
|
||
|
interactionData.target = item;
|
||
|
|
||
|
//a sprite or display object with a hit area defined
|
||
|
if (item.hitArea && item.hitArea.contains)
|
||
|
{
|
||
|
if (item.hitArea.contains(x, y))
|
||
|
{
|
||
|
interactionData.target = item;
|
||
|
return true;
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
// a sprite with no hitarea defined
|
||
|
else if(item instanceof PIXI.Sprite)
|
||
|
{
|
||
|
var width = item.texture.frame.width;
|
||
|
var height = item.texture.frame.height;
|
||
|
var x1 = -width * item.anchor.x;
|
||
|
var y1;
|
||
|
|
||
|
if (x > x1 && x < x1 + width)
|
||
|
{
|
||
|
y1 = -height * item.anchor.y;
|
||
|
|
||
|
if (y > y1 && y < y1 + height)
|
||
|
{
|
||
|
// set the target property if a hit is true!
|
||
|
interactionData.target = item;
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
else if(item instanceof PIXI.Graphics)
|
||
|
{
|
||
|
var graphicsData = item.graphicsData;
|
||
|
for (i = 0; i < graphicsData.length; i++)
|
||
|
{
|
||
|
var data = graphicsData[i];
|
||
|
if(!data.fill)continue;
|
||
|
|
||
|
// only deal with fills..
|
||
|
if(data.shape)
|
||
|
{
|
||
|
if(data.shape.contains(x, y))
|
||
|
{
|
||
|
interactionData.target = item;
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
var length = item.children.length;
|
||
|
|
||
|
for (i = 0; i < length; i++)
|
||
|
{
|
||
|
var tempItem = item.children[i];
|
||
|
var hit = this.hitTest(tempItem, interactionData);
|
||
|
if (hit)
|
||
|
{
|
||
|
// hmm.. TODO SET CORRECT TARGET?
|
||
|
interactionData.target = item;
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
return false;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Is called when a touch is moved across the renderer element
|
||
|
*
|
||
|
* @method onTouchMove
|
||
|
* @param event {Event} The DOM event of a touch moving across the renderer view
|
||
|
* @private
|
||
|
*/
|
||
|
PIXI.InteractionManager.prototype.onTouchMove = function(event)
|
||
|
{
|
||
|
if (this.dirty)
|
||
|
{
|
||
|
this.rebuildInteractiveGraph();
|
||
|
}
|
||
|
|
||
|
var rect = this.interactionDOMElement.getBoundingClientRect();
|
||
|
var changedTouches = event.changedTouches;
|
||
|
var touchData;
|
||
|
var i = 0;
|
||
|
|
||
|
for (i = 0; i < changedTouches.length; i++)
|
||
|
{
|
||
|
var touchEvent = changedTouches[i];
|
||
|
touchData = this.touches[touchEvent.identifier];
|
||
|
touchData.originalEvent = event;
|
||
|
|
||
|
// update the touch position
|
||
|
touchData.global.x = ( (touchEvent.clientX - rect.left) * (this.target.width / rect.width) ) / this.resolution;
|
||
|
touchData.global.y = ( (touchEvent.clientY - rect.top) * (this.target.height / rect.height) ) / this.resolution;
|
||
|
if (navigator.isCocoonJS && !rect.left && !rect.top && !event.target.style.width && !event.target.style.height)
|
||
|
{
|
||
|
//Support for CocoonJS fullscreen scale modes
|
||
|
touchData.global.x = touchEvent.clientX;
|
||
|
touchData.global.y = touchEvent.clientY;
|
||
|
}
|
||
|
|
||
|
for (var j = 0; j < this.interactiveItems.length; j++)
|
||
|
{
|
||
|
var item = this.interactiveItems[j];
|
||
|
if (item.touchmove && item.__touchData && item.__touchData[touchEvent.identifier])
|
||
|
{
|
||
|
item.touchmove(touchData);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Is called when a touch is started on the renderer element
|
||
|
*
|
||
|
* @method onTouchStart
|
||
|
* @param event {Event} The DOM event of a touch starting on the renderer view
|
||
|
* @private
|
||
|
*/
|
||
|
PIXI.InteractionManager.prototype.onTouchStart = function(event)
|
||
|
{
|
||
|
if (this.dirty)
|
||
|
{
|
||
|
this.rebuildInteractiveGraph();
|
||
|
}
|
||
|
|
||
|
var rect = this.interactionDOMElement.getBoundingClientRect();
|
||
|
|
||
|
if (PIXI.AUTO_PREVENT_DEFAULT)
|
||
|
{
|
||
|
event.preventDefault();
|
||
|
}
|
||
|
|
||
|
var changedTouches = event.changedTouches;
|
||
|
for (var i=0; i < changedTouches.length; i++)
|
||
|
{
|
||
|
var touchEvent = changedTouches[i];
|
||
|
|
||
|
var touchData = this.pool.pop();
|
||
|
if (!touchData)
|
||
|
{
|
||
|
touchData = new PIXI.InteractionData();
|
||
|
}
|
||
|
|
||
|
touchData.originalEvent = event;
|
||
|
|
||
|
this.touches[touchEvent.identifier] = touchData;
|
||
|
touchData.global.x = ( (touchEvent.clientX - rect.left) * (this.target.width / rect.width) ) / this.resolution;
|
||
|
touchData.global.y = ( (touchEvent.clientY - rect.top) * (this.target.height / rect.height) ) / this.resolution;
|
||
|
if (navigator.isCocoonJS && !rect.left && !rect.top && !event.target.style.width && !event.target.style.height)
|
||
|
{
|
||
|
//Support for CocoonJS fullscreen scale modes
|
||
|
touchData.global.x = touchEvent.clientX;
|
||
|
touchData.global.y = touchEvent.clientY;
|
||
|
}
|
||
|
|
||
|
var length = this.interactiveItems.length;
|
||
|
|
||
|
for (var j = 0; j < length; j++)
|
||
|
{
|
||
|
var item = this.interactiveItems[j];
|
||
|
|
||
|
if (item.touchstart || item.tap)
|
||
|
{
|
||
|
item.__hit = this.hitTest(item, touchData);
|
||
|
|
||
|
if (item.__hit)
|
||
|
{
|
||
|
//call the function!
|
||
|
if (item.touchstart)item.touchstart(touchData);
|
||
|
item.__isDown = true;
|
||
|
item.__touchData = item.__touchData || {};
|
||
|
item.__touchData[touchEvent.identifier] = touchData;
|
||
|
|
||
|
if (!item.interactiveChildren) break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Is called when a touch is ended on the renderer element
|
||
|
*
|
||
|
* @method onTouchEnd
|
||
|
* @param event {Event} The DOM event of a touch ending on the renderer view
|
||
|
* @private
|
||
|
*/
|
||
|
PIXI.InteractionManager.prototype.onTouchEnd = function(event)
|
||
|
{
|
||
|
if (this.dirty)
|
||
|
{
|
||
|
this.rebuildInteractiveGraph();
|
||
|
}
|
||
|
|
||
|
var rect = this.interactionDOMElement.getBoundingClientRect();
|
||
|
var changedTouches = event.changedTouches;
|
||
|
|
||
|
for (var i=0; i < changedTouches.length; i++)
|
||
|
{
|
||
|
var touchEvent = changedTouches[i];
|
||
|
var touchData = this.touches[touchEvent.identifier];
|
||
|
var up = false;
|
||
|
touchData.global.x = ( (touchEvent.clientX - rect.left) * (this.target.width / rect.width) ) / this.resolution;
|
||
|
touchData.global.y = ( (touchEvent.clientY - rect.top) * (this.target.height / rect.height) ) / this.resolution;
|
||
|
if (navigator.isCocoonJS && !rect.left && !rect.top && !event.target.style.width && !event.target.style.height)
|
||
|
{
|
||
|
//Support for CocoonJS fullscreen scale modes
|
||
|
touchData.global.x = touchEvent.clientX;
|
||
|
touchData.global.y = touchEvent.clientY;
|
||
|
}
|
||
|
|
||
|
var length = this.interactiveItems.length;
|
||
|
for (var j = 0; j < length; j++)
|
||
|
{
|
||
|
var item = this.interactiveItems[j];
|
||
|
|
||
|
if (item.__touchData && item.__touchData[touchEvent.identifier])
|
||
|
{
|
||
|
|
||
|
item.__hit = this.hitTest(item, item.__touchData[touchEvent.identifier]);
|
||
|
|
||
|
// so this one WAS down...
|
||
|
touchData.originalEvent = event;
|
||
|
// hitTest??
|
||
|
|
||
|
if (item.touchend || item.tap)
|
||
|
{
|
||
|
if (item.__hit && !up)
|
||
|
{
|
||
|
if (item.touchend)
|
||
|
{
|
||
|
item.touchend(touchData);
|
||
|
}
|
||
|
if (item.__isDown && item.tap)
|
||
|
{
|
||
|
item.tap(touchData);
|
||
|
}
|
||
|
if (!item.interactiveChildren)
|
||
|
{
|
||
|
up = true;
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (item.__isDown && item.touchendoutside)
|
||
|
{
|
||
|
item.touchendoutside(touchData);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
item.__isDown = false;
|
||
|
}
|
||
|
|
||
|
item.__touchData[touchEvent.identifier] = null;
|
||
|
}
|
||
|
}
|
||
|
// remove the touch..
|
||
|
this.pool.push(touchData);
|
||
|
this.touches[touchEvent.identifier] = null;
|
||
|
}
|
||
|
};
|
||
|
</pre>
|
||
|
</article>
|
||
|
</section>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<div class="clearfix"></div>
|
||
|
<footer>
|
||
|
|
||
|
|
||
|
<span class="copyright">
|
||
|
Phaser Copyright © 2012-2014 Photon Storm Ltd.
|
||
|
</span>
|
||
|
<br />
|
||
|
|
||
|
<span class="jsdoc-message">
|
||
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
|
||
|
on Sat Nov 15 2014 19:54:25 GMT-0000 (GMT) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
|
||
|
</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( {
|
||
|
anchorName : function(i, heading, prefix) {
|
||
|
return $(heading).attr("id") || ( prefix + i );
|
||
|
},
|
||
|
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>
|