Skip to content

Commit 251bc10

Browse files
committed
jshint fixes.
1 parent 11ca2de commit 251bc10

2 files changed

Lines changed: 68 additions & 19 deletions

File tree

src/physics/p2/World.js

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ Phaser.Physics.P2 = function (game, config) {
4545
*/
4646
this.useElapsedTime = false;
4747

48+
/**
49+
* @property {boolean} paused - The paused state of the P2 World.
50+
* @default
51+
*/
52+
this.paused = false;
53+
4854
/**
4955
* @property {array<Phaser.Physics.P2.Material>} materials - A local array of all created Materials.
5056
* @protected
@@ -628,26 +634,38 @@ Phaser.Physics.P2.prototype = {
628634
},
629635

630636
/**
637+
* Pauses the P2 World independent of the game pause state.
638+
*
631639
* @method Phaser.Physics.P2#pause
632640
*/
633641
pause: function() {
634-
this.paused = true
642+
643+
this.paused = true;
644+
635645
},
636646

637647
/**
648+
* Resumes a paused P2 World.
649+
*
638650
* @method Phaser.Physics.P2#resume
639651
*/
640652
resume: function() {
641-
this.paused = false
653+
654+
this.paused = false;
655+
642656
},
643657

644658
/**
659+
* Internal P2 update loop.
660+
*
645661
* @method Phaser.Physics.P2#update
646662
*/
647663
update: function () {
648-
// do nothing when the pysics engine was paused before
649-
if (this.paused){
650-
return
664+
665+
// Do nothing when the pysics engine was paused before
666+
if (this.paused)
667+
{
668+
return;
651669
}
652670

653671
if (this.useElapsedTime)

src/utils/Color.js

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ Phaser.Color = {
276276

277277
// achromatic by default
278278
out.h = 0;
279-
out.s = max == 0 ? 0 : d / max;
279+
out.s = max === 0 ? 0 : d / max;
280280
out.v = max;
281281

282282
if (max !== min)
@@ -332,22 +332,34 @@ Phaser.Color = {
332332
switch (i % 6)
333333
{
334334
case 0:
335-
r = v, g = t, b = p;
335+
r = v;
336+
g = t;
337+
b = p;
336338
break;
337339
case 1:
338-
r = q, g = v, b = p;
340+
r = q;
341+
g = v;
342+
b = p;
339343
break;
340344
case 2:
341-
r = p, g = v, b = t;
345+
r = p;
346+
g = v;
347+
b = t;
342348
break;
343349
case 3:
344-
r = p, g = q, b = v;
350+
r = p;
351+
g = q;
352+
b = v;
345353
break;
346354
case 4:
347-
r = t, g = p, b = v;
355+
r = t;
356+
g = p;
357+
b = v;
348358
break;
349359
case 5:
350-
r = v, g = p, b = q;
360+
r = v;
361+
g = p;
362+
b = q;
351363
break;
352364
}
353365

@@ -372,11 +384,30 @@ Phaser.Color = {
372384
*/
373385
hueToColor: function (p, q, t) {
374386

375-
if (t < 0) t += 1;
376-
if (t > 1) t -= 1;
377-
if (t < 1 / 6) return p + (q - p) * 6 * t;
378-
if (t < 1 / 2) return q;
379-
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
387+
if (t < 0)
388+
{
389+
t += 1;
390+
}
391+
392+
if (t > 1)
393+
{
394+
t -= 1;
395+
}
396+
397+
if (t < 1 / 6)
398+
{
399+
return p + (q - p) * 6 * t;
400+
}
401+
402+
if (t < 1 / 2)
403+
{
404+
return q;
405+
}
406+
407+
if (t < 2 / 3)
408+
{
409+
return p + (q - p) * (2 / 3 - t) * 6;
410+
}
380411

381412
return p;
382413

@@ -459,8 +490,8 @@ Phaser.Color = {
459490
*/
460491
RGBtoString: function (r, g, b, a, prefix) {
461492

462-
if (typeof a === 'undefined') { a = 255 };
463-
if (typeof prefix === 'undefined') { prefix = '#' };
493+
if (typeof a === 'undefined') { a = 255; }
494+
if (typeof prefix === 'undefined') { prefix = '#'; }
464495

465496
if (prefix === '#')
466497
{

0 commit comments

Comments
 (0)