@@ -21,6 +21,21 @@ var GetValue = require('../../utils/object/GetValue');
2121// maxSpeed: 1.0
2222// };
2323
24+ /**
25+ * @typedef {object } SmoothedKeyControlConfig
26+ *
27+ * @property {Phaser.Cameras.Scene2D.Camera } [camera] - The Camera that this Control will update.
28+ * @property {Phaser.Input.Keyboard.Key } [left] - The Key to be pressed that will move the Camera left.
29+ * @property {Phaser.Input.Keyboard.Key } [right] - The Key to be pressed that will move the Camera right.
30+ * @property {Phaser.Input.Keyboard.Key } [up] - The Key to be pressed that will move the Camera up.
31+ * @property {Phaser.Input.Keyboard.Key } [zoomIn] - The Key to be pressed that will zoom the Camera in.
32+ * @property {Phaser.Input.Keyboard.Key } [zoomOut] - The Key to be pressed that will zoom the Camera out.
33+ * @property {float } [zoomSpeed=0.01] - The speed at which the camera will zoom if the `zoomIn` or `zoomOut` keys are pressed.
34+ * @property {float|{x:float,y:float} } [acceleration=0] - The horizontal and vertical acceleration the camera will move.
35+ * @property {float|{x:float,y:float} } [drag=0] - The horizontal and vertical drag applied to the camera when it is moving.
36+ * @property {float|{x:float,y:float} } [maxSpeed=0] - The maximum horizontal and vertical speed the camera will move.
37+ */
38+
2439/**
2540 * @classdesc
2641 * [description]
@@ -30,7 +45,7 @@ var GetValue = require('../../utils/object/GetValue');
3045 * @constructor
3146 * @since 3.0.0
3247 *
33- * @param {object } config - [description]
48+ * @param {SmoothedKeyControlConfig } config - [description]
3449 */
3550var SmoothedKeyControl = new Class ( {
3651
@@ -52,7 +67,7 @@ var SmoothedKeyControl = new Class({
5267 * The Key to be pressed that will move the Camera left.
5368 *
5469 * @name Phaser.Cameras.Controls.SmoothedKeyControl#left
55- * @type {Phaser.Input.Keyboard }
70+ * @type {Phaser.Input.Keyboard.Key }
5671 * @default null
5772 * @since 3.0.0
5873 */
@@ -62,7 +77,7 @@ var SmoothedKeyControl = new Class({
6277 * The Key to be pressed that will move the Camera right.
6378 *
6479 * @name Phaser.Cameras.Controls.SmoothedKeyControl#right
65- * @type {Phaser.Input.Keyboard }
80+ * @type {Phaser.Input.Keyboard.Key }
6681 * @default null
6782 * @since 3.0.0
6883 */
@@ -72,7 +87,7 @@ var SmoothedKeyControl = new Class({
7287 * The Key to be pressed that will move the Camera up.
7388 *
7489 * @name Phaser.Cameras.Controls.SmoothedKeyControl#up
75- * @type {Phaser.Input.Keyboard }
90+ * @type {Phaser.Input.Keyboard.Key }
7691 * @default null
7792 * @since 3.0.0
7893 */
@@ -82,7 +97,7 @@ var SmoothedKeyControl = new Class({
8297 * The Key to be pressed that will move the Camera down.
8398 *
8499 * @name Phaser.Cameras.Controls.SmoothedKeyControl#down
85- * @type {Phaser.Input.Keyboard }
100+ * @type {Phaser.Input.Keyboard.Key }
86101 * @default null
87102 * @since 3.0.0
88103 */
@@ -92,7 +107,7 @@ var SmoothedKeyControl = new Class({
92107 * The Key to be pressed that will zoom the Camera in.
93108 *
94109 * @name Phaser.Cameras.Controls.SmoothedKeyControl#zoomIn
95- * @type {Phaser.Input.Keyboard }
110+ * @type {Phaser.Input.Keyboard.Key }
96111 * @default null
97112 * @since 3.0.0
98113 */
@@ -102,7 +117,7 @@ var SmoothedKeyControl = new Class({
102117 * The Key to be pressed that will zoom the Camera out.
103118 *
104119 * @name Phaser.Cameras.Controls.SmoothedKeyControl#zoomOut
105- * @type {Phaser.Input.Keyboard }
120+ * @type {Phaser.Input.Keyboard.Key }
106121 * @default null
107122 * @since 3.0.0
108123 */
@@ -126,6 +141,7 @@ var SmoothedKeyControl = new Class({
126141 * @default 0
127142 * @since 3.0.0
128143 */
144+ this . accelX = 0 ;
129145
130146 /**
131147 * The vertical acceleration the camera will move.
@@ -135,6 +151,8 @@ var SmoothedKeyControl = new Class({
135151 * @default 0
136152 * @since 3.0.0
137153 */
154+ this . accelY = 0 ;
155+
138156 var accel = GetValue ( config , 'acceleration' , null ) ;
139157
140158 if ( typeof accel === 'number' )
@@ -156,6 +174,7 @@ var SmoothedKeyControl = new Class({
156174 * @default 0
157175 * @since 3.0.0
158176 */
177+ this . dragX = 0 ;
159178
160179 /**
161180 * The vertical drag applied to the camera when it is moving.
@@ -165,6 +184,8 @@ var SmoothedKeyControl = new Class({
165184 * @default 0
166185 * @since 3.0.0
167186 */
187+ this . dragY = 0 ;
188+
168189 var drag = GetValue ( config , 'drag' , null ) ;
169190
170191 if ( typeof drag === 'number' )
@@ -186,6 +207,7 @@ var SmoothedKeyControl = new Class({
186207 * @default 0
187208 * @since 3.0.0
188209 */
210+ this . maxSpeedX = 0 ;
189211
190212 /**
191213 * The maximum vertical speed the camera will move.
@@ -195,6 +217,8 @@ var SmoothedKeyControl = new Class({
195217 * @default 0
196218 * @since 3.0.0
197219 */
220+ this . maxSpeedY = 0 ;
221+
198222 var maxSpeed = GetValue ( config , 'maxSpeed' , null ) ;
199223
200224 if ( typeof maxSpeed === 'number' )
0 commit comments