Idiomatic JavaScript

Also remove executable bit from LICENSE.
This commit is contained in:
Mark Vasilkov 2013-03-22 16:15:27 +02:00
parent 9838176a49
commit cf00e200c7
6 changed files with 14 additions and 14 deletions

0
LICENSE Executable file → Normal file
View file

View file

@ -16,14 +16,14 @@ PIXI.Point = function(x, y)
* @type Number * @type Number
* @default 0 * @default 0
*/ */
this.x = x ? x : 0; this.x = x || 0;
/** /**
* @property y * @property y
* @type Number * @type Number
* @default 0 * @default 0
*/ */
this.y = y ? y : 0; this.y = y || 0;
} }
/** /**

View file

@ -18,28 +18,28 @@ PIXI.Rectangle = function(x, y, width, height)
* @type Number * @type Number
* @default 0 * @default 0
*/ */
this.x = x ? x : 0; this.x = x || 0;
/** /**
* @property y * @property y
* @type Number * @type Number
* @default 0 * @default 0
*/ */
this.y = y ? y : 0; this.y = y || 0;
/** /**
* @property width * @property width
* @type Number * @type Number
* @default 0 * @default 0
*/ */
this.width = width ? width : 0; this.width = width || 0;
/** /**
* @property height * @property height
* @type Number * @type Number
* @default 0 * @default 0
*/ */
this.height = height ? height : 0; this.height = height || 0;
} }
/** /**

View file

@ -21,7 +21,7 @@ PIXI.Stage = function(backgroundColor, interactive)
this.stage= this; this.stage= this;
// interaction! // interaction!
this.interactive = interactive ? true : false; this.interactive = !!interactive;
this.interactionManager = new PIXI.InteractionManager(this); this.interactionManager = new PIXI.InteractionManager(this);
this.setBackgroundColor(backgroundColor); this.setBackgroundColor(backgroundColor);
@ -62,7 +62,7 @@ PIXI.Stage.prototype.updateTransform = function()
*/ */
PIXI.Stage.prototype.setBackgroundColor = function(backgroundColor) PIXI.Stage.prototype.setBackgroundColor = function(backgroundColor)
{ {
this.backgroundColor = backgroundColor ? backgroundColor : 0x000000; this.backgroundColor = backgroundColor || 0x000000;
this.backgroundColorSplit = HEXtoRGB(this.backgroundColor); this.backgroundColorSplit = HEXtoRGB(this.backgroundColor);
this.backgroundColorString = "#" + this.backgroundColor.toString(16); this.backgroundColorString = "#" + this.backgroundColor.toString(16);
} }

View file

@ -18,14 +18,14 @@ PIXI.CanvasRenderer = function(width, height, view)
* @type Number * @type Number
* @default 800 * @default 800
*/ */
this.width = width ? width : 800; this.width = width || 800;
/** /**
* The height of the canvas view * The height of the canvas view
* @property height * @property height
* @type Number * @type Number
* @default 600 * @default 600
*/ */
this.height = height ? height : 600; this.height = height || 600;
this.refresh = true; this.refresh = true;
@ -34,7 +34,7 @@ PIXI.CanvasRenderer = function(width, height, view)
* @property view * @property view
* @type Canvas * @type Canvas
*/ */
this.view = view ? view : document.createElement( 'canvas' ); this.view = view || document.createElement( 'canvas' );
// hack to enable some hardware acceleration! // hack to enable some hardware acceleration!
//this.view.style["transform"] = "translatez(0)"; //this.view.style["transform"] = "translatez(0)";

View file

@ -17,10 +17,10 @@ PIXI._defaultFrame = new PIXI.Rectangle(0,0,1,1);
*/ */
PIXI.WebGLRenderer = function(width, height, view) PIXI.WebGLRenderer = function(width, height, view)
{ {
this.width = width ? width : 800; this.width = width || 800;
this.height = height ? height : 600; this.height = height || 600;
this.view = view ? view : document.createElement( 'canvas' ); this.view = view || document.createElement( 'canvas' );
this.view.width = this.width; this.view.width = this.width;
this.view.height = this.height; this.view.height = this.height;
this.view.background = "#FF0000"; this.view.background = "#FF0000";