@@ -175,31 +175,13 @@ var RotateTo = new Class({
175175 this . shortestPath = false ;
176176 } ,
177177
178- /**
179- * This event is fired when the Rotate effect begins to run on a camera.
180- *
181- * @event CameraRotateStartEvent
182- * @param {Phaser.Cameras.Scene2D.Camera } camera - The camera that the effect began on.
183- * @param {Phaser.Cameras.Scene2D.Effects.RotateTo } effect - A reference to the effect instance.
184- * @param {integer } duration - The duration of the effect.
185- * @param {number } angle - The destination angle in radians.
186- */
187-
188- /**
189- * This event is fired when the Rotate effect completes.
190- *
191- * @event CameraRotateCompleteEvent
192- * @param {Phaser.Cameras.Scene2D.Camera } camera - The camera that the effect began on.
193- * @param {Phaser.Cameras.Scene2D.Effects.RotateTo } effect - A reference to the effect instance.
194- */
195-
196178 /**
197179 * This effect will scroll the Camera so that the center of its viewport finishes at the given angle,
198180 * over the duration and with the ease specified.
199181 *
200182 * @method Phaser.Cameras.Scene2D.Effects.RotateTo#start
201- * @fires CameraRotateStartEvent
202- * @fires CameraRotateCompleteEvent
183+ * @fires Phaser.Cameras.Scene2D.Events#ROTATE_START
184+ * @fires Phaser.Cameras.Scene2D.Events#ROTATE_COMPLETE
203185 * @since 3.23.0
204186 *
205187 * @param {number } radians - The destination angle in radians to rotate the Camera viewport to. If the angle is positive then the rotation is clockwise else anticlockwise
@@ -221,17 +203,24 @@ var RotateTo = new Class({
221203 if ( force === undefined ) { force = false ; }
222204 if ( callback === undefined ) { callback = null ; }
223205 if ( context === undefined ) { context = this . camera . scene ; }
224- if ( shortestPath === undefined ) { shortestPath = false ; }
206+ if ( shortestPath === undefined ) { shortestPath = false ; }
207+
225208 this . shortestPath = shortestPath ;
226209
227210 var tmpDestination = radians ;
228- if ( radians < 0 ) {
211+
212+ if ( radians < 0 )
213+ {
229214 tmpDestination = - 1 * radians ;
230215 this . clockwise = false ;
231- } else {
216+ }
217+ else
218+ {
232219 this . clockwise = true ;
233220 }
221+
234222 var maxRad = ( 360 * Math . PI ) / 180 ;
223+
235224 tmpDestination = tmpDestination - ( Math . floor ( tmpDestination / maxRad ) * maxRad ) ;
236225
237226 var cam = this . camera ;
@@ -267,27 +256,42 @@ var RotateTo = new Class({
267256 this . _onUpdateScope = context ;
268257
269258
270- if ( this . shortestPath === true ) {
271- // The shotest path is true so calculate the quickest direction
259+ if ( this . shortestPath === true )
260+ {
261+ // The shortest path is true so calculate the quickest direction
272262 var cwDist = 0 ;
273263 var acwDist = 0 ;
274- if ( this . clockwise === false ) {
264+
265+ if ( this . clockwise === false )
266+ {
275267 target = this . current ;
276268 current = this . destination ;
277269 }
278- if ( this . destination > this . source ) {
270+
271+ if ( this . destination > this . source )
272+ {
279273 cwDist = Math . abs ( this . destination - this . source ) ;
280- } else {
274+ }
275+ else
276+ {
281277 cwDist = ( Math . abs ( this . destination + maxRad ) - this . source ) ;
282- }
283- if ( this . source > this . destination ) {
278+ }
279+
280+ if ( this . source > this . destination )
281+ {
284282 acwDist = Math . abs ( this . source - this . destination ) ;
285- } else {
283+ }
284+ else
285+ {
286286 acwDist = ( Math . abs ( this . source + maxRad ) - this . destination ) ;
287- }
288- if ( cwDist < acwDist ) {
287+ }
288+
289+ if ( cwDist < acwDist )
290+ {
289291 this . clockwise = true ;
290- } else if ( cwDist > acwDist ) {
292+ }
293+ else if ( cwDist > acwDist )
294+ {
291295 this . clockwise = false ;
292296 }
293297 }
@@ -330,22 +334,33 @@ var RotateTo = new Class({
330334 var maxRad = ( 360 * Math . PI ) / 180 ;
331335 var target = this . destination ;
332336 var current = this . current ;
333- if ( this . clockwise === false ) {
337+
338+ if ( this . clockwise === false )
339+ {
334340 target = this . current ;
335341 current = this . destination ;
336342 }
337- if ( target >= current ) {
343+
344+ if ( target >= current )
345+ {
338346 distance = Math . abs ( target - current ) ;
339- } else {
347+ }
348+ else
349+ {
340350 distance = ( Math . abs ( target + maxRad ) - current ) ;
341351 }
342352
343353 var r = 0 ;
344- if ( this . clockwise ) {
354+
355+ if ( this . clockwise )
356+ {
345357 r = ( cam . rotation + ( distance * v ) ) ;
346- } else {
358+ }
359+ else
360+ {
347361 r = ( cam . rotation - ( distance * v ) ) ;
348362 }
363+
349364 cam . rotation = r ;
350365
351366 if ( this . _onUpdate )
0 commit comments