diff --git a/dist/phaser-ui-tools.js b/dist/phaser-ui-tools.js index 90e8fce..e5e2dd9 100644 --- a/dist/phaser-ui-tools.js +++ b/dist/phaser-ui-tools.js @@ -1,4 +1,5 @@ -var uiWidgets = uiWidgets || {}; +var uiWidgets; +uiWidgets = uiWidgets || {}; uiWidgets.utils = {}; @@ -18,14 +19,16 @@ uiWidgets.utils.operators = { "+": function (a, b) { return a + b; }, "-": function (a, b) { return a - b; } }; -;var uiWidgets = uiWidgets || {}; +;var uiWidgets; +uiWidgets = uiWidgets || {}; /** * Group with a dedicated background image. * Children added to the group will always be above the background image. * @constructor * @param {Object} game - Current game instance. - * @param {Object} context - The context this object is called in. + * @param {Number} x - The x position of the Frame. + * @param {Number} y - The y position of the Frame. * @param {string} bg - The background image to use. */ uiWidgets.Frame = function (game, x, y, bg) { @@ -50,20 +53,32 @@ uiWidgets.Frame = function (game, x, y, bg) { uiWidgets.Frame.prototype = Object.create(Phaser.Group.prototype); uiWidgets.Frame.constructor = uiWidgets.Frame; -/** Adds a new object to the Frame. - * @param {Object} node - The sprite to add to the Frame. +/** Adds a new object into the Column, then aligns it under the previous object. + * @param {Object} node - The sprite to add to the Column. + * @param {Number} alignment - The alignment relative to the previous child. + * @param {Number} padding_x - The amount of horizontal space between objects. + * @param {Number} padding_y - The amount of vertical space between objects. */ -uiWidgets.Frame.prototype.addNode = function (node) { +uiWidgets.Frame.prototype.addNode = function (node, alignment, padding_x, padding_y) { "use strict"; + alignment = alignment || this.alignment; + padding_x = padding_x || 0; + padding_y = padding_y || 0; + this.add(node); + var previousNode = this.children[this.children.length - 2]; + + if (previousNode !== undefined) { + node.alignTo(previousNode, alignment, padding_x, padding_y); + } // Reset the positions for the bar's draggable area. if ("enableBarDrag" in node) { node.enableBarDrag(); } - }; -;var uiWidgets = uiWidgets || {}; +;var uiWidgets; +uiWidgets = uiWidgets || {}; /** Base object for all Bars. */ @@ -175,7 +190,8 @@ uiWidgets.DraggableBar.prototype.enableBarDrag = function () { draggableArea.h) ; }; -;var uiWidgets = uiWidgets || {}; +;var uiWidgets; +uiWidgets = uiWidgets || {}; /** * Bar that adjusts the size of a static sprite based on a value. @@ -367,7 +383,8 @@ uiWidgets.QuantityBar.prototype.getBarSize = function () { return barSize; }; -;var uiWidgets = uiWidgets || {}; +;var uiWidgets; +uiWidgets = uiWidgets || {}; /** Used by a QuantityBar to hold the bar's values. @@ -501,7 +518,8 @@ uiWidgets.ViewportRange.prototype.getCurrentValue = function () { return currentValue; }; -;var uiWidgets = uiWidgets || {}; +;var uiWidgets; +uiWidgets = uiWidgets || {}; /** * A bar that moves along a track. The bar is resized relative to the size of the track and size of the content to be scrolled. @@ -533,7 +551,7 @@ uiWidgets.Scrollbar = function (game, content, draggable, vertical, trackImage, // The smallest pixel size allowed for the bar. this.minBarSize = 44; - this.tweenParams = tweenParams || {'duration': 300, 'ease': Phaser.Easing.Quadratic.Out}; + this.tweenParams = tweenParams || {"duration": 300, "ease": Phaser.Easing.Quadratic.Out}; // Flag switched on when the track is clicked, switched off after the bar movement is finished. this.trackClicked = false; @@ -880,7 +898,8 @@ uiWidgets.Scrollbar.prototype.moveContent = function () { this.onMovement.dispatch(this); }; -;var uiWidgets = uiWidgets || {}; +;var uiWidgets; +uiWidgets = uiWidgets || {}; /** * Bar that adjusts a number. @@ -1017,9 +1036,9 @@ uiWidgets.ValueBar.prototype.setInitialBarPosition = function () { // The bar should always be in centered on it's current position. if (this.vertical) { - this.bar.y = gripPositionOnTrack + this.track.y - (this.bar.height / 2); + this.bar.y = gripPositionOnTrack + this.track.y - (this.bar.height / 2); } else { - this.bar.x = gripPositionOnTrack + this.track.x - (this.bar.width / 2); + this.bar.x = gripPositionOnTrack + this.track.x - (this.bar.width / 2); } }; @@ -1100,7 +1119,8 @@ uiWidgets.ValueBar.prototype.getGripPositionRatio = function () { return newGripPositionRatio; }; -;var uiWidgets = uiWidgets || {}; +;var uiWidgets; +uiWidgets = uiWidgets || {}; /** @@ -1153,13 +1173,16 @@ uiWidgets.textButton = function (game, image, label, style, x, y, callback, call uiWidgets.textButton.prototype = Object.create(Phaser.Button.prototype); uiWidgets.textButton.constructor = uiWidgets.textButton; -;var uiWidgets = uiWidgets || {}; +;var uiWidgets; +uiWidgets = uiWidgets || {}; /** * Frame that places new child nodes directly under the previous child. * @constructor * @param {Object} game - Current game instance. - * @param {Object} context - The context this object is called in. + * @param {Number} x - The x position of the Frame. + * @param {Number} y - The y position of the Frame. + * @param {string} bg - The background image to use. */ uiWidgets.Column = function (game, x, y, bg) { "use strict"; @@ -1169,35 +1192,17 @@ uiWidgets.Column = function (game, x, y, bg) { uiWidgets.Column.prototype = Object.create(uiWidgets.Frame.prototype); uiWidgets.Column.constructor = uiWidgets.Column; -/** Adds a new object into the Column, then aligns it under the previous object. - * @param {Object} node - The sprite to add to the Column. - * @param {Number} alignment - The alignment relative to the previous child. - * @param {Number} padding - The amount of space between objects. - */ -uiWidgets.Column.prototype.addNode = function (node, alignment, padding) { - "use strict"; - alignment = alignment || Phaser.BOTTOM_CENTER; - padding = padding || 0; - - this.add(node); - var previousNode = this.children[this.children.length - 2]; - - if (previousNode !== undefined) { - node.alignTo(previousNode, alignment, 0, padding); - } - - // Reset the positions for the bar's draggable area. - if ("enableBarDrag" in node) { - node.enableBarDrag(); - } -}; -;var uiWidgets = uiWidgets || {}; +uiWidgets.Column.prototype.alignment = Phaser.BOTTOM_CENTER; +;var uiWidgets; +uiWidgets = uiWidgets || {}; /** * Frame that places new child nodes directly next to the previous child. * @constructor * @param {Object} game - Current game instance. - * @param {Object} context - The context this object is called in. + * @param {Number} x - The x position of the Frame. + * @param {Number} y - The y position of the Frame. + * @param {string} bg - The background image to use. */ uiWidgets.Row = function (game, x, y, bg) { "use strict"; @@ -1207,29 +1212,9 @@ uiWidgets.Row = function (game, x, y, bg) { uiWidgets.Row.prototype = Object.create(uiWidgets.Frame.prototype); uiWidgets.Row.constructor = uiWidgets.Row; -/** Adds a new object into the Row, then aligns it next to the previous object. - * @param {Object} node - The sprite to add to the row. - * @param {Number} alignment - The alignment relative to the previous child. - * @param {Number} padding - The amount of space between objects. - */ -uiWidgets.Row.prototype.addNode = function (node, alignment, padding) { - "use strict"; - alignment = alignment || Phaser.RIGHT_CENTER; - padding = padding || 0; - - this.add(node); - var previousNode = this.children[this.children.length - 2]; - - if (previousNode !== undefined) { - node.alignTo(previousNode, alignment, padding); - } - - // Reset the positions for the bar's draggable area. - if ("enableBarDrag" in node) { - node.enableBarDrag(); - } -}; -;var uiWidgets = uiWidgets || {}; +uiWidgets.Row.prototype.alignment = Phaser.RIGHT_CENTER; +;var uiWidgets; +uiWidgets = uiWidgets || {}; /** * A container with a limited viewable area. Uses a mask to hide children outside of the specified x/y/width/height area. @@ -1310,7 +1295,8 @@ uiWidgets.Viewport.prototype.disableOutOfBounds = function (children, context, v } } }; -;var uiWidgets = uiWidgets || {}; +;var uiWidgets; +uiWidgets = uiWidgets || {}; /** Collection of sprites that can be selected with the keyboard. * When the select key is hit, the sprite that was selected is now connected to the keyboard. @@ -1429,7 +1415,8 @@ uiWidgets.KeyboardGroup.prototype.useBar = function () { this.downKey.onDown.add(this.selected.downEvent, this.selected); } }; -;var uiWidgets = uiWidgets || {}; +;var uiWidgets; +uiWidgets = uiWidgets || {}; /** * Represents a single point in a Wheel3D. diff --git a/dist/phaser-ui-tools.min.js b/dist/phaser-ui-tools.min.js index 3c79179..23207f1 100644 --- a/dist/phaser-ui-tools.min.js +++ b/dist/phaser-ui-tools.min.js @@ -1,3 +1,3 @@ -/*! phaser-ui-tools 2018-02-17 */ +/*! phaser-ui-tools 2018-03-23 */ -(uiWidgets=uiWidgets||{}).utils={},uiWidgets.utils.modulo=function(t,i){"use strict";return(t%i+i)%i},uiWidgets.utils.operators={"+":function(t,i){return t+i},"-":function(t,i){return t-i}},(uiWidgets=uiWidgets||{}).Frame=function(t,i,s,e){"use strict";if(Phaser.Group.call(this,t),t.add.existing(this),this.x=i||0,this.y=s||0,this.game=t,this.bg=e||null,null!==e){var a=t.add.sprite(0,0,e);a.sendToBack(),a.alignIn(this,Phaser.TOP_LEFT)}},uiWidgets.Frame.prototype=Object.create(Phaser.Group.prototype),uiWidgets.Frame.constructor=uiWidgets.Frame,uiWidgets.Frame.prototype.addNode=function(t){"use strict";this.add(t),"enableBarDrag"in t&&t.enableBarDrag()},(uiWidgets=uiWidgets||{}).Bar=function(){},uiWidgets.Bar.prototype=Object.create(Phaser.Group.prototype),uiWidgets.Bar.constructor=uiWidgets.Bar,uiWidgets.Bar.prototype.setTrackScrollAreaSize=function(){"use strict";this.vertical?this.trackScrollAreaSize=this.track.height-this.vslice:this.trackScrollAreaSize=this.track.width-this.hslice},uiWidgets.Bar.prototype.centerStaticAxis=function(){"use strict";this.vertical?this.bar.x=this.track.x+this.track.width/2-this.bar.width/2:this.bar.y=this.track.y+this.track.height/2-this.bar.height/2},uiWidgets.DraggableBar=function(){},uiWidgets.DraggableBar.prototype=Object.create(uiWidgets.Bar.prototype),uiWidgets.DraggableBar.constructor=uiWidgets.DraggableBar,uiWidgets.DraggableBar.prototype.verticalTrackClick=function(){"use strict";this.game.input.mousePointer.y>this.bar.y+this.bar.height+this.worldPosition.y?this.scrollDown():this.game.input.mousePointer.ythis.bar.x+this.bar.width+this.worldPosition.x?this.scrollRight():this.game.input.mousePointer.x1&&(this.ratio=1),this.currentValue=i,this.steps=[];for(var e=0;e1&&(this.ratio=1)},uiWidgets.ViewportRange.prototype.adjustValue=function(t){"use strict";this.vertical?this.viewport.y=t+this.viewport.area.y:this.viewport.x=t+this.viewport.area.x,this.viewport.disableOutOfBounds(this.viewport.children,this,this.vertical)},uiWidgets.ViewportRange.prototype.getCurrentValue=function(){"use strict";return this.vertical?this.viewport.y-this.viewport.area.y:this.viewport.x-this.viewport.area.x},(uiWidgets=uiWidgets||{}).Scrollbar=function(t,i,s,e,a,r,h){"use strict";Phaser.Group.call(this,t),t.add.existing(this),this.game=t,this.content=i,this.valueRange=new uiWidgets.ViewportRange(i,e),this.vertical=e||!1,this.draggable=s||!1,this.trackImage=a,this.barImage=r,this.minBarSize=44,this.tweenParams=h||{duration:300,ease:Phaser.Easing.Quadratic.Out},this.trackClicked=!1,this.barMoving=!1,this.mousePointer=null,this.track=this.game.add.sprite(0,0,this.trackImage),this.add(this.track),this.draggable&&this.enableTrackClick(),this.bar=this.game.add.button(this.x,this.y,this.barImage,this.moveContent,this,1,0),this.add(this.bar),this.resizeBar(),this.minY=this.track.y,this.maxY=this.track.y+this.track.height-this.bar.height,this.minX=this.track.x,this.maxX=this.track.x+this.track.width-this.bar.width,this.create(),this.onMovement=new Phaser.Signal},uiWidgets.Scrollbar.prototype=Object.create(uiWidgets.DraggableBar.prototype),uiWidgets.Scrollbar.constructor=uiWidgets.Scrollbar,uiWidgets.Scrollbar.prototype.setDraggableArea=function(){"use strict";this.verticalDraggableArea={x:this.track.x-(this.bar.width-this.track.width)/2,y:this.track.y,w:this.bar.width,h:this.track.height},this.horizontalDraggableArea={x:this.track.x,y:this.track.y-(this.bar.height-this.track.height)/2,w:this.track.width,h:this.bar.height}},uiWidgets.Scrollbar.prototype.resizeBar=function(){"use strict";var t;(t=this.vertical?this.track.height*this.valueRange.ratio:this.track.width*this.valueRange.ratio)=this.track.y+this.track.height?this.maxY:this.bar.y+this.vslice,this.addScrollTween({y:i})}},uiWidgets.Scrollbar.prototype.scrollLeft=function(){"use strict";if(this.bar.x!==this.track.x&&!this.barMoving){var t=this.bar.x-this.hslice,i=null;this.barMoving=!0,this.bar.inputEnabled=!1,i=t<=this.track.x?this.minX:this.bar.x-this.hslice,this.addScrollTween({x:i})}},uiWidgets.Scrollbar.prototype.scrollRight=function(){"use strict";if(this.bar.x+this.bar.width!==this.track.x+this.track.width&&!this.barMoving){var t=this.bar.x+2*this.hslice,i=null;this.barMoving=!0,this.bar.inputEnabled=!1,i=t>=this.track.x+this.track.width?this.maxX:this.bar.x+this.hslice,this.addScrollTween({x:i})}},uiWidgets.Scrollbar.prototype.saveMousePosition=function(t,i){"use strict";this.mousePointer={x:i.x,y:i.y}},uiWidgets.Scrollbar.prototype.getBarPosition=function(){"use strict";var t=this.valueRange.getCurrentValue()/this.windowScrollAreaSize;return this.trackScrollAreaSize*t},uiWidgets.Scrollbar.prototype.getMouseDelta=function(){"use strict";var t,i,s,e;return t=this.vertical?this.mousePointer.y:this.mousePointer.x,s=this.trackClicked?{x:this.bar.x,y:this.bar.y}:{x:this.game.input.mousePointer.x,y:this.game.input.mousePointer.y},i=this.vertical?s.y:s.x,this.mousePointer=s,e=this.vertical?this.track.height+this.worldPosition.y:this.track.width+this.worldPosition.x,i0?t=0:t<=-this.trackScrollAreaSize&&(t=-this.trackScrollAreaSize),this.vertical?this.bar.y<=this.track.y?t=0:this.bar.y+this.bar.height>=this.track.y+this.track.height&&(t=-this.trackScrollAreaSize):this.bar.x<=this.track.x?t=0:this.bar.x+this.bar.width>=this.track.x+this.track.width&&(t=-this.trackScrollAreaSize);var i=t/this.trackScrollAreaSize;return isNaN(i)&&(i=0),i},uiWidgets.Scrollbar.prototype.moveContent=function(){"use strict";var t=this.getGripPositionRatio()*this.windowScrollAreaSize;this.valueRange.adjustValue(t),this.onMovement.dispatch(this)},(uiWidgets=uiWidgets||{}).ValueBar=function(t,i,s,e,a,r,h,o){"use strict";Phaser.Group.call(this,t),t.add.existing(this),this.game=t,this.x=i.x,this.y=i.y,this.valueRange=new uiWidgets.ValueRange(s.step,s.startValue,s.maxValue),this.vertical=a||!1,this.draggable=e||!1,this.trackImage=r,this.barImage=h,this.tweenParams=o||{duration:300,ease:Phaser.Easing.Quadratic.Out},this.trackClicked=!1,this.barMoving=!1,this.mousePointer=null,this.track=this.game.add.sprite(0,0,this.trackImage),this.add(this.track),this.draggable&&this.enableTrackClick(),this.bar=this.game.add.button(this.x,this.y,this.barImage,this.moveContent,this,1,0),this.bg=this.game.add.graphics(0,0),this.add(this.bg),this.sendToBack(this.bg),this.bg.beginFill(16711680,0),this.vertical?this.bg.drawRect(0,0-this.bar.height/2,1,this.track.height+this.bar.height):this.bg.drawRect(0-this.bar.width/2,0,this.track.width+this.bar.width,1),this.bg.endFill(),this.snapping=!0,this.add(this.bar),this.minY=this.track.y-this.bar.height/2,this.maxY=this.track.y+this.track.height-this.bar.height/2,this.minX=this.track.x-this.bar.width/2,this.maxX=this.track.x+this.track.width-this.bar.width/2,this.create(),this.vertical?(this.upEvent=this.scrollUp,this.downEvent=this.scrollDown):(this.upEvent=this.scrollLeft,this.downEvent=this.scrollRight),this.onMovement=new Phaser.Signal},uiWidgets.ValueBar.prototype=Object.create(uiWidgets.Scrollbar.prototype),uiWidgets.ValueBar.constructor=uiWidgets.ValueBar,uiWidgets.ValueBar.prototype.setDraggableArea=function(){"use strict";this.verticalDraggableArea={x:this.track.x-(this.bar.width-this.track.width)/2,y:this.track.y-this.bar.height/2,w:this.bar.width,h:this.track.height+this.bar.height},this.horizontalDraggableArea={x:this.track.x-this.bar.width/2,y:this.track.y-(this.bar.height-this.track.height)/2,w:this.track.width+this.bar.width,h:this.bar.height}},uiWidgets.ValueBar.prototype.setTrackScrollAreaSize=function(){"use strict";this.vertical?this.trackScrollAreaSize=this.track.height:this.trackScrollAreaSize=this.track.width},uiWidgets.ValueBar.prototype.setInitialBarPosition=function(){"use strict";var t=this.getBarPosition();this.vertical?this.bar.y=t+this.track.y-this.bar.height/2:this.bar.x=t+this.track.x-this.bar.width/2},uiWidgets.ValueBar.prototype.getClosestPosition=function(){"use strict";for(var t=this.valueRange.getCurrentValue(),i=Math.abs(t-this.valueRange.steps[0]),s=this.valueRange.steps[0],e=0;e=this.trackScrollAreaSize&&(t=this.trackScrollAreaSize),this.vertical?this.bar.y<=this.track.y?t=0:this.bar.y+this.bar.height>=this.track.y+this.track.height&&(t=this.trackScrollAreaSize):this.bar.x<=this.track.x?t=0:this.bar.x+this.bar.width>=this.track.x+this.track.width&&(t=this.trackScrollAreaSize);var i=t/this.trackScrollAreaSize;return isNaN(i)&&(i=0),i},(uiWidgets=uiWidgets||{}).textSprite=function(t,i,s,e,a,r){"use strict";Phaser.Sprite.call(this,t,a,r,i),t.add.existing(this),this.text=this.game.add.text(0,0,s,e),this.text.anchor.set(.5,.5),this.addChild(this.text)},uiWidgets.textSprite.prototype=Object.create(Phaser.Sprite.prototype),uiWidgets.textSprite.constructor=uiWidgets.textSprite,uiWidgets.textButton=function(t,i,s,e,a,r,h,o){"use strict";Phaser.Button.call(this,t,a,r,i,h,o),t.add.existing(this),this.text=this.game.add.text(0,0,s,e),this.text.anchor.set(.5,.5),this.addChild(this.text)},uiWidgets.textButton.prototype=Object.create(Phaser.Button.prototype),uiWidgets.textButton.constructor=uiWidgets.textButton,(uiWidgets=uiWidgets||{}).Column=function(t,i,s,e){"use strict";uiWidgets.Frame.apply(this,arguments)},uiWidgets.Column.prototype=Object.create(uiWidgets.Frame.prototype),uiWidgets.Column.constructor=uiWidgets.Column,uiWidgets.Column.prototype.addNode=function(t,i,s){"use strict";i=i||Phaser.BOTTOM_CENTER,s=s||0,this.add(t);var e=this.children[this.children.length-2];void 0!==e&&t.alignTo(e,i,0,s),"enableBarDrag"in t&&t.enableBarDrag()},(uiWidgets=uiWidgets||{}).Row=function(t,i,s,e){"use strict";uiWidgets.Frame.apply(this,arguments)},uiWidgets.Row.prototype=Object.create(uiWidgets.Frame.prototype),uiWidgets.Row.constructor=uiWidgets.Row,uiWidgets.Row.prototype.addNode=function(t,i,s){"use strict";i=i||Phaser.RIGHT_CENTER,s=s||0,this.add(t);var e=this.children[this.children.length-2];void 0!==e&&t.alignTo(e,i,s),"enableBarDrag"in t&&t.enableBarDrag()},(uiWidgets=uiWidgets||{}).Viewport=function(t,i,s,e,a){"use strict";Phaser.Group.call(this,t),t.add.existing(this),this.x=i,this.y=s,this.area={x:i,y:s,width:e,height:a},this.mask=this.game.add.graphics(this.area.x,this.area.y),this.mask.beginFill(255),this.mask.drawRect(0,0,e,a),this.mask.endFill()},uiWidgets.Viewport.prototype=Object.create(Phaser.Group.prototype),uiWidgets.Viewport.constructor=uiWidgets.Viewport,uiWidgets.Viewport.prototype.addNode=function(t){"use strict";this.add(t)},uiWidgets.Viewport.prototype.disableOutOfBounds=function(t,i,s){"use strict";var e,a,r,h;if(void 0!==t)for(var o=0;othis.bar.y+this.bar.height+this.worldPosition.y?this.scrollDown():this.game.input.mousePointer.ythis.bar.x+this.bar.width+this.worldPosition.x?this.scrollRight():this.game.input.mousePointer.x1&&(this.ratio=1),this.currentValue=i,this.steps=[];for(var e=0;e1&&(this.ratio=1)},uiWidgets.ViewportRange.prototype.adjustValue=function(t){"use strict";this.vertical?this.viewport.y=t+this.viewport.area.y:this.viewport.x=t+this.viewport.area.x,this.viewport.disableOutOfBounds(this.viewport.children,this,this.vertical)},uiWidgets.ViewportRange.prototype.getCurrentValue=function(){"use strict";return this.vertical?this.viewport.y-this.viewport.area.y:this.viewport.x-this.viewport.area.x};var uiWidgets;(uiWidgets=uiWidgets||{}).Scrollbar=function(t,i,s,e,a,r,h){"use strict";Phaser.Group.call(this,t),t.add.existing(this),this.game=t,this.content=i,this.valueRange=new uiWidgets.ViewportRange(i,e),this.vertical=e||!1,this.draggable=s||!1,this.trackImage=a,this.barImage=r,this.minBarSize=44,this.tweenParams=h||{duration:300,ease:Phaser.Easing.Quadratic.Out},this.trackClicked=!1,this.barMoving=!1,this.mousePointer=null,this.track=this.game.add.sprite(0,0,this.trackImage),this.add(this.track),this.draggable&&this.enableTrackClick(),this.bar=this.game.add.button(this.x,this.y,this.barImage,this.moveContent,this,1,0),this.add(this.bar),this.resizeBar(),this.minY=this.track.y,this.maxY=this.track.y+this.track.height-this.bar.height,this.minX=this.track.x,this.maxX=this.track.x+this.track.width-this.bar.width,this.create(),this.onMovement=new Phaser.Signal},uiWidgets.Scrollbar.prototype=Object.create(uiWidgets.DraggableBar.prototype),uiWidgets.Scrollbar.constructor=uiWidgets.Scrollbar,uiWidgets.Scrollbar.prototype.setDraggableArea=function(){"use strict";this.verticalDraggableArea={x:this.track.x-(this.bar.width-this.track.width)/2,y:this.track.y,w:this.bar.width,h:this.track.height},this.horizontalDraggableArea={x:this.track.x,y:this.track.y-(this.bar.height-this.track.height)/2,w:this.track.width,h:this.bar.height}},uiWidgets.Scrollbar.prototype.resizeBar=function(){"use strict";var t;(t=this.vertical?this.track.height*this.valueRange.ratio:this.track.width*this.valueRange.ratio)=this.track.y+this.track.height?this.maxY:this.bar.y+this.vslice,this.addScrollTween({y:i})}},uiWidgets.Scrollbar.prototype.scrollLeft=function(){"use strict";if(this.bar.x!==this.track.x&&!this.barMoving){var t=this.bar.x-this.hslice,i=null;this.barMoving=!0,this.bar.inputEnabled=!1,i=t<=this.track.x?this.minX:this.bar.x-this.hslice,this.addScrollTween({x:i})}},uiWidgets.Scrollbar.prototype.scrollRight=function(){"use strict";if(this.bar.x+this.bar.width!==this.track.x+this.track.width&&!this.barMoving){var t=this.bar.x+2*this.hslice,i=null;this.barMoving=!0,this.bar.inputEnabled=!1,i=t>=this.track.x+this.track.width?this.maxX:this.bar.x+this.hslice,this.addScrollTween({x:i})}},uiWidgets.Scrollbar.prototype.saveMousePosition=function(t,i){"use strict";this.mousePointer={x:i.x,y:i.y}},uiWidgets.Scrollbar.prototype.getBarPosition=function(){"use strict";var t=this.valueRange.getCurrentValue()/this.windowScrollAreaSize;return this.trackScrollAreaSize*t},uiWidgets.Scrollbar.prototype.getMouseDelta=function(){"use strict";var t,i,s,e;return t=this.vertical?this.mousePointer.y:this.mousePointer.x,s=this.trackClicked?{x:this.bar.x,y:this.bar.y}:{x:this.game.input.mousePointer.x,y:this.game.input.mousePointer.y},i=this.vertical?s.y:s.x,this.mousePointer=s,e=this.vertical?this.track.height+this.worldPosition.y:this.track.width+this.worldPosition.x,i0?t=0:t<=-this.trackScrollAreaSize&&(t=-this.trackScrollAreaSize),this.vertical?this.bar.y<=this.track.y?t=0:this.bar.y+this.bar.height>=this.track.y+this.track.height&&(t=-this.trackScrollAreaSize):this.bar.x<=this.track.x?t=0:this.bar.x+this.bar.width>=this.track.x+this.track.width&&(t=-this.trackScrollAreaSize);var i=t/this.trackScrollAreaSize;return isNaN(i)&&(i=0),i},uiWidgets.Scrollbar.prototype.moveContent=function(){"use strict";var t=this.getGripPositionRatio()*this.windowScrollAreaSize;this.valueRange.adjustValue(t),this.onMovement.dispatch(this)};var uiWidgets;(uiWidgets=uiWidgets||{}).ValueBar=function(t,i,s,e,a,r,h,o){"use strict";Phaser.Group.call(this,t),t.add.existing(this),this.game=t,this.x=i.x,this.y=i.y,this.valueRange=new uiWidgets.ValueRange(s.step,s.startValue,s.maxValue),this.vertical=a||!1,this.draggable=e||!1,this.trackImage=r,this.barImage=h,this.tweenParams=o||{duration:300,ease:Phaser.Easing.Quadratic.Out},this.trackClicked=!1,this.barMoving=!1,this.mousePointer=null,this.track=this.game.add.sprite(0,0,this.trackImage),this.add(this.track),this.draggable&&this.enableTrackClick(),this.bar=this.game.add.button(this.x,this.y,this.barImage,this.moveContent,this,1,0),this.bg=this.game.add.graphics(0,0),this.add(this.bg),this.sendToBack(this.bg),this.bg.beginFill(16711680,0),this.vertical?this.bg.drawRect(0,0-this.bar.height/2,1,this.track.height+this.bar.height):this.bg.drawRect(0-this.bar.width/2,0,this.track.width+this.bar.width,1),this.bg.endFill(),this.snapping=!0,this.add(this.bar),this.minY=this.track.y-this.bar.height/2,this.maxY=this.track.y+this.track.height-this.bar.height/2,this.minX=this.track.x-this.bar.width/2,this.maxX=this.track.x+this.track.width-this.bar.width/2,this.create(),this.vertical?(this.upEvent=this.scrollUp,this.downEvent=this.scrollDown):(this.upEvent=this.scrollLeft,this.downEvent=this.scrollRight),this.onMovement=new Phaser.Signal},uiWidgets.ValueBar.prototype=Object.create(uiWidgets.Scrollbar.prototype),uiWidgets.ValueBar.constructor=uiWidgets.ValueBar,uiWidgets.ValueBar.prototype.setDraggableArea=function(){"use strict";this.verticalDraggableArea={x:this.track.x-(this.bar.width-this.track.width)/2,y:this.track.y-this.bar.height/2,w:this.bar.width,h:this.track.height+this.bar.height},this.horizontalDraggableArea={x:this.track.x-this.bar.width/2,y:this.track.y-(this.bar.height-this.track.height)/2,w:this.track.width+this.bar.width,h:this.bar.height}},uiWidgets.ValueBar.prototype.setTrackScrollAreaSize=function(){"use strict";this.vertical?this.trackScrollAreaSize=this.track.height:this.trackScrollAreaSize=this.track.width},uiWidgets.ValueBar.prototype.setInitialBarPosition=function(){"use strict";var t=this.getBarPosition();this.vertical?this.bar.y=t+this.track.y-this.bar.height/2:this.bar.x=t+this.track.x-this.bar.width/2},uiWidgets.ValueBar.prototype.getClosestPosition=function(){"use strict";for(var t=this.valueRange.getCurrentValue(),i=Math.abs(t-this.valueRange.steps[0]),s=this.valueRange.steps[0],e=0;e=this.trackScrollAreaSize&&(t=this.trackScrollAreaSize),this.vertical?this.bar.y<=this.track.y?t=0:this.bar.y+this.bar.height>=this.track.y+this.track.height&&(t=this.trackScrollAreaSize):this.bar.x<=this.track.x?t=0:this.bar.x+this.bar.width>=this.track.x+this.track.width&&(t=this.trackScrollAreaSize);var i=t/this.trackScrollAreaSize;return isNaN(i)&&(i=0),i};var uiWidgets;(uiWidgets=uiWidgets||{}).textSprite=function(t,i,s,e,a,r){"use strict";Phaser.Sprite.call(this,t,a,r,i),t.add.existing(this),this.text=this.game.add.text(0,0,s,e),this.text.anchor.set(.5,.5),this.addChild(this.text)},uiWidgets.textSprite.prototype=Object.create(Phaser.Sprite.prototype),uiWidgets.textSprite.constructor=uiWidgets.textSprite,uiWidgets.textButton=function(t,i,s,e,a,r,h,o){"use strict";Phaser.Button.call(this,t,a,r,i,h,o),t.add.existing(this),this.text=this.game.add.text(0,0,s,e),this.text.anchor.set(.5,.5),this.addChild(this.text)},uiWidgets.textButton.prototype=Object.create(Phaser.Button.prototype),uiWidgets.textButton.constructor=uiWidgets.textButton;var uiWidgets;(uiWidgets=uiWidgets||{}).Column=function(t,i,s,e){"use strict";uiWidgets.Frame.apply(this,arguments)},uiWidgets.Column.prototype=Object.create(uiWidgets.Frame.prototype),uiWidgets.Column.constructor=uiWidgets.Column,uiWidgets.Column.prototype.alignment=Phaser.BOTTOM_CENTER;var uiWidgets;(uiWidgets=uiWidgets||{}).Row=function(t,i,s,e){"use strict";uiWidgets.Frame.apply(this,arguments)},uiWidgets.Row.prototype=Object.create(uiWidgets.Frame.prototype),uiWidgets.Row.constructor=uiWidgets.Row,uiWidgets.Row.prototype.alignment=Phaser.RIGHT_CENTER;var uiWidgets;(uiWidgets=uiWidgets||{}).Viewport=function(t,i,s,e,a){"use strict";Phaser.Group.call(this,t),t.add.existing(this),this.x=i,this.y=s,this.area={x:i,y:s,width:e,height:a},this.mask=this.game.add.graphics(this.area.x,this.area.y),this.mask.beginFill(255),this.mask.drawRect(0,0,e,a),this.mask.endFill()},uiWidgets.Viewport.prototype=Object.create(Phaser.Group.prototype),uiWidgets.Viewport.constructor=uiWidgets.Viewport,uiWidgets.Viewport.prototype.addNode=function(t){"use strict";this.add(t)},uiWidgets.Viewport.prototype.disableOutOfBounds=function(t,i,s){"use strict";var e,a,r,h;if(void 0!==t)for(var o=0;oSource: bars/bar.js
var uiWidgets = uiWidgets || {};
+            class="sunlight-highlight-javascript linenums">var uiWidgets;
+uiWidgets = uiWidgets || {};
 
 
 /** Base object for all Bars. */
@@ -225,9 +226,9 @@ 
 	
 
 
-	Documentation generated by JSDoc 3.4.3
+	Documentation generated by JSDoc 3.5.5
 	
-		on Sat Feb 17th 2018
+		on Fri Mar 23rd 2018
 	
 	using the DocStrap template.
 
diff --git a/docs/bars_quantitybar.js.html b/docs/bars_quantitybar.js.html
index 4516a2a..9191ebd 100644
--- a/docs/bars_quantitybar.js.html
+++ b/docs/bars_quantitybar.js.html
@@ -70,7 +70,8 @@ 

Source: bars/quantitybar.js

var uiWidgets = uiWidgets || {};
+            class="sunlight-highlight-javascript linenums">var uiWidgets;
+uiWidgets = uiWidgets || {};
 
 /**
  * Bar that adjusts the size of a static sprite based on a value.
@@ -305,9 +306,9 @@ 
 	
 
 
-	Documentation generated by JSDoc 3.4.3
+	Documentation generated by JSDoc 3.5.5
 	
-		on Sat Feb 17th 2018
+		on Fri Mar 23rd 2018
 	
 	using the DocStrap template.
 
diff --git a/docs/bars_ranges.js.html b/docs/bars_ranges.js.html
index 10a1d0c..e0cc26d 100644
--- a/docs/bars_ranges.js.html
+++ b/docs/bars_ranges.js.html
@@ -70,7 +70,8 @@ 

Source: bars/ranges.js

var uiWidgets = uiWidgets || {};
+            class="sunlight-highlight-javascript linenums">var uiWidgets;
+uiWidgets = uiWidgets || {};
 
 
 /** Used by a QuantityBar to hold the bar's values.
@@ -247,9 +248,9 @@ 
 	
 
 
-	Documentation generated by JSDoc 3.4.3
+	Documentation generated by JSDoc 3.5.5
 	
-		on Sat Feb 17th 2018
+		on Fri Mar 23rd 2018
 	
 	using the DocStrap template.
 
diff --git a/docs/bars_scrollbar.js.html b/docs/bars_scrollbar.js.html
index f9b5e47..9136879 100644
--- a/docs/bars_scrollbar.js.html
+++ b/docs/bars_scrollbar.js.html
@@ -70,7 +70,8 @@ 

Source: bars/scrollbar.js

var uiWidgets = uiWidgets || {};
+            class="sunlight-highlight-javascript linenums">var uiWidgets;
+uiWidgets = uiWidgets || {};
 
 /**
  * A bar that moves along a track. The bar is resized relative to the size of the track and size of the content to be scrolled.
@@ -102,7 +103,7 @@ 

Source: bars/scrollbar.js

// The smallest pixel size allowed for the bar. this.minBarSize = 44; - this.tweenParams = tweenParams || {'duration': 300, 'ease': Phaser.Easing.Quadratic.Out}; + this.tweenParams = tweenParams || {"duration": 300, "ease": Phaser.Easing.Quadratic.Out}; // Flag switched on when the track is clicked, switched off after the bar movement is finished. this.trackClicked = false; @@ -492,9 +493,9 @@ - Documentation generated by JSDoc 3.4.3 + Documentation generated by JSDoc 3.5.5 - on Sat Feb 17th 2018 + on Fri Mar 23rd 2018 using the DocStrap template. diff --git a/docs/bars_valuebar.js.html b/docs/bars_valuebar.js.html index 705a664..4fd2935 100644 --- a/docs/bars_valuebar.js.html +++ b/docs/bars_valuebar.js.html @@ -70,7 +70,8 @@

Source: bars/valuebar.js

var uiWidgets = uiWidgets || {};
+            class="sunlight-highlight-javascript linenums">var uiWidgets;
+uiWidgets = uiWidgets || {};
 
 /**
  * Bar that adjusts a number.
@@ -207,9 +208,9 @@ 

Source: bars/valuebar.js

// The bar should always be in centered on it's current position. if (this.vertical) { - this.bar.y = gripPositionOnTrack + this.track.y - (this.bar.height / 2); + this.bar.y = gripPositionOnTrack + this.track.y - (this.bar.height / 2); } else { - this.bar.x = gripPositionOnTrack + this.track.x - (this.bar.width / 2); + this.bar.x = gripPositionOnTrack + this.track.x - (this.bar.width / 2); } }; @@ -333,9 +334,9 @@ - Documentation generated by JSDoc 3.4.3 + Documentation generated by JSDoc 3.5.5 - on Sat Feb 17th 2018 + on Fri Mar 23rd 2018 using the DocStrap template. diff --git a/docs/buttons.js.html b/docs/buttons.js.html index 282f532..6bb2f86 100644 --- a/docs/buttons.js.html +++ b/docs/buttons.js.html @@ -70,7 +70,8 @@

Source: buttons.js

var uiWidgets = uiWidgets || {};
+            class="sunlight-highlight-javascript linenums">var uiWidgets;
+uiWidgets = uiWidgets || {};
 
 
 /**
@@ -166,9 +167,9 @@ 
 	
 
 
-	Documentation generated by JSDoc 3.4.3
+	Documentation generated by JSDoc 3.5.5
 	
-		on Sat Feb 17th 2018
+		on Fri Mar 23rd 2018
 	
 	using the DocStrap template.
 
diff --git a/docs/classes.list.html b/docs/classes.list.html
index 737f5b6..3b31d50 100644
--- a/docs/classes.list.html
+++ b/docs/classes.list.html
@@ -236,9 +236,9 @@ 
 	
 
 
-	Documentation generated by JSDoc 3.4.3
+	Documentation generated by JSDoc 3.5.5
 	
-		on Sat Feb 17th 2018
+		on Fri Mar 23rd 2018
 	
 	using the DocStrap template.
 
diff --git a/docs/containers_column.js.html b/docs/containers_column.js.html
index 15e2c08..cb6a208 100644
--- a/docs/containers_column.js.html
+++ b/docs/containers_column.js.html
@@ -70,13 +70,16 @@ 

Source: containers/column.js

var uiWidgets = uiWidgets || {};
+            class="sunlight-highlight-javascript linenums">var uiWidgets;
+uiWidgets = uiWidgets || {};
 
 /**
  * Frame that places new child nodes directly under the previous child.
  * @constructor
  * @param {Object} game - Current game instance.
- * @param {Object} context - The context this object is called in.
+ * @param {Number} x - The x position of the Frame.
+ * @param {Number} y - The y position of the Frame.
+ * @param {string} bg - The background image to use.
  */
 uiWidgets.Column = function (game, x, y, bg) {
     "use strict";
@@ -86,28 +89,7 @@ 

Source: containers/column.js

uiWidgets.Column.prototype = Object.create(uiWidgets.Frame.prototype); uiWidgets.Column.constructor = uiWidgets.Column; -/** Adds a new object into the Column, then aligns it under the previous object. - * @param {Object} node - The sprite to add to the Column. - * @param {Number} alignment - The alignment relative to the previous child. - * @param {Number} padding - The amount of space between objects. - */ -uiWidgets.Column.prototype.addNode = function (node, alignment, padding) { - "use strict"; - alignment = alignment || Phaser.BOTTOM_CENTER; - padding = padding || 0; - - this.add(node); - var previousNode = this.children[this.children.length - 2]; - - if (previousNode !== undefined) { - node.alignTo(previousNode, alignment, 0, padding); - } - - // Reset the positions for the bar's draggable area. - if ("enableBarDrag" in node) { - node.enableBarDrag(); - } -}; +uiWidgets.Column.prototype.alignment = Phaser.BOTTOM_CENTER;
@@ -151,9 +133,9 @@ - Documentation generated by JSDoc 3.4.3 + Documentation generated by JSDoc 3.5.5 - on Sat Feb 17th 2018 + on Fri Mar 23rd 2018 using the DocStrap template. diff --git a/docs/containers_frame.js.html b/docs/containers_frame.js.html index 258dabe..0ea5f6d 100644 --- a/docs/containers_frame.js.html +++ b/docs/containers_frame.js.html @@ -70,14 +70,16 @@

Source: containers/frame.js

var uiWidgets = uiWidgets || {};
+            class="sunlight-highlight-javascript linenums">var uiWidgets;
+uiWidgets = uiWidgets || {};
 
 /**
  * Group with a dedicated background image.
  * Children added to the group will always be above the background image.
  * @constructor
  * @param {Object} game - Current game instance.
- * @param {Object} context - The context this object is called in.
+ * @param {Number} x - The x position of the Frame.
+ * @param {Number} y - The y position of the Frame.
  * @param {string} bg - The background image to use.
  */
 uiWidgets.Frame = function (game, x, y, bg) {
@@ -102,18 +104,29 @@ 

Source: containers/frame.js

uiWidgets.Frame.prototype = Object.create(Phaser.Group.prototype); uiWidgets.Frame.constructor = uiWidgets.Frame; -/** Adds a new object to the Frame. - * @param {Object} node - The sprite to add to the Frame. +/** Adds a new object into the Column, then aligns it under the previous object. + * @param {Object} node - The sprite to add to the Column. + * @param {Number} alignment - The alignment relative to the previous child. + * @param {Number} padding_x - The amount of horizontal space between objects. + * @param {Number} padding_y - The amount of vertical space between objects. */ -uiWidgets.Frame.prototype.addNode = function (node) { +uiWidgets.Frame.prototype.addNode = function (node, alignment, padding_x, padding_y) { "use strict"; + alignment = alignment || this.alignment; + padding_x = padding_x || 0; + padding_y = padding_y || 0; + this.add(node); + var previousNode = this.children[this.children.length - 2]; + + if (previousNode !== undefined) { + node.alignTo(previousNode, alignment, padding_x, padding_y); + } // Reset the positions for the bar's draggable area. if ("enableBarDrag" in node) { node.enableBarDrag(); } - };
@@ -158,9 +171,9 @@ - Documentation generated by JSDoc 3.4.3 + Documentation generated by JSDoc 3.5.5 - on Sat Feb 17th 2018 + on Fri Mar 23rd 2018 using the DocStrap template. diff --git a/docs/containers_row.js.html b/docs/containers_row.js.html index 66353f7..a257aa4 100644 --- a/docs/containers_row.js.html +++ b/docs/containers_row.js.html @@ -70,13 +70,16 @@

Source: containers/row.js

var uiWidgets = uiWidgets || {};
+            class="sunlight-highlight-javascript linenums">var uiWidgets;
+uiWidgets = uiWidgets || {};
 
 /**
  * Frame that places new child nodes directly next to the previous child.
  * @constructor
  * @param {Object} game - Current game instance.
- * @param {Object} context - The context this object is called in.
+ * @param {Number} x - The x position of the Frame.
+ * @param {Number} y - The y position of the Frame.
+ * @param {string} bg - The background image to use.
  */
 uiWidgets.Row = function (game, x, y, bg) {
     "use strict";
@@ -86,28 +89,7 @@ 

Source: containers/row.js

uiWidgets.Row.prototype = Object.create(uiWidgets.Frame.prototype); uiWidgets.Row.constructor = uiWidgets.Row; -/** Adds a new object into the Row, then aligns it next to the previous object. - * @param {Object} node - The sprite to add to the row. - * @param {Number} alignment - The alignment relative to the previous child. - * @param {Number} padding - The amount of space between objects. - */ -uiWidgets.Row.prototype.addNode = function (node, alignment, padding) { - "use strict"; - alignment = alignment || Phaser.RIGHT_CENTER; - padding = padding || 0; - - this.add(node); - var previousNode = this.children[this.children.length - 2]; - - if (previousNode !== undefined) { - node.alignTo(previousNode, alignment, padding); - } - - // Reset the positions for the bar's draggable area. - if ("enableBarDrag" in node) { - node.enableBarDrag(); - } -}; +uiWidgets.Row.prototype.alignment = Phaser.RIGHT_CENTER;
@@ -151,9 +133,9 @@ - Documentation generated by JSDoc 3.4.3 + Documentation generated by JSDoc 3.5.5 - on Sat Feb 17th 2018 + on Fri Mar 23rd 2018 using the DocStrap template. diff --git a/docs/containers_viewport.js.html b/docs/containers_viewport.js.html index 6e0563d..468268e 100644 --- a/docs/containers_viewport.js.html +++ b/docs/containers_viewport.js.html @@ -70,7 +70,8 @@

Source: containers/viewport.js

var uiWidgets = uiWidgets || {};
+            class="sunlight-highlight-javascript linenums">var uiWidgets;
+uiWidgets = uiWidgets || {};
 
 /**
  * A container with a limited viewable area. Uses a mask to hide children outside of the specified x/y/width/height area.
@@ -194,9 +195,9 @@ 
 	
 
 
-	Documentation generated by JSDoc 3.4.3
+	Documentation generated by JSDoc 3.5.5
 	
-		on Sat Feb 17th 2018
+		on Fri Mar 23rd 2018
 	
 	using the DocStrap template.
 
diff --git a/docs/examples/lib/phaser-ui-tools.js b/docs/examples/lib/phaser-ui-tools.js
index 90e8fce..e5e2dd9 100644
--- a/docs/examples/lib/phaser-ui-tools.js
+++ b/docs/examples/lib/phaser-ui-tools.js
@@ -1,4 +1,5 @@
-var uiWidgets = uiWidgets || {};
+var uiWidgets;
+uiWidgets = uiWidgets || {};
 
 uiWidgets.utils = {};
 
@@ -18,14 +19,16 @@ uiWidgets.utils.operators = {
     "+": function (a, b) { return a + b; },
     "-": function (a, b) { return a - b; }
 };
-;var uiWidgets = uiWidgets || {};
+;var uiWidgets;
+uiWidgets = uiWidgets || {};
 
 /**
  * Group with a dedicated background image.
  * Children added to the group will always be above the background image.
  * @constructor
  * @param {Object} game - Current game instance.
- * @param {Object} context - The context this object is called in.
+ * @param {Number} x - The x position of the Frame.
+ * @param {Number} y - The y position of the Frame.
  * @param {string} bg - The background image to use.
  */
 uiWidgets.Frame = function (game, x, y, bg) {
@@ -50,20 +53,32 @@ uiWidgets.Frame = function (game, x, y, bg) {
 uiWidgets.Frame.prototype = Object.create(Phaser.Group.prototype);
 uiWidgets.Frame.constructor = uiWidgets.Frame;
 
-/** Adds a new object to the Frame.
- * @param {Object} node - The sprite to add to the Frame.
+/** Adds a new object into the Column, then aligns it under the previous object.
+ * @param {Object} node - The sprite to add to the Column.
+ * @param {Number} alignment - The alignment relative to the previous child.
+ * @param {Number} padding_x - The amount of horizontal space between objects.
+ * @param {Number} padding_y - The amount of vertical space between objects.
  */
-uiWidgets.Frame.prototype.addNode = function (node) {
+uiWidgets.Frame.prototype.addNode = function (node, alignment, padding_x, padding_y) {
     "use strict";
+    alignment = alignment || this.alignment;
+    padding_x = padding_x || 0;
+    padding_y = padding_y || 0;
+
     this.add(node);
+    var previousNode = this.children[this.children.length - 2];
+
+    if (previousNode !== undefined) {
+        node.alignTo(previousNode, alignment, padding_x, padding_y);
+    }
 
     // Reset the positions for the bar's draggable area.
     if ("enableBarDrag" in node) {
         node.enableBarDrag();
     }
-
 };
-;var uiWidgets = uiWidgets || {};
+;var uiWidgets;
+uiWidgets = uiWidgets || {};
 
 
 /** Base object for all Bars. */
@@ -175,7 +190,8 @@ uiWidgets.DraggableBar.prototype.enableBarDrag = function () {
         draggableArea.h)
     ;
 };
-;var uiWidgets = uiWidgets || {};
+;var uiWidgets;
+uiWidgets = uiWidgets || {};
 
 /**
  * Bar that adjusts the size of a static sprite based on a value.
@@ -367,7 +383,8 @@ uiWidgets.QuantityBar.prototype.getBarSize = function () {
 
     return barSize;
 };
-;var uiWidgets = uiWidgets || {};
+;var uiWidgets;
+uiWidgets = uiWidgets || {};
 
 
 /** Used by a QuantityBar to hold the bar's values.
@@ -501,7 +518,8 @@ uiWidgets.ViewportRange.prototype.getCurrentValue = function () {
 
     return currentValue;
 };
-;var uiWidgets = uiWidgets || {};
+;var uiWidgets;
+uiWidgets = uiWidgets || {};
 
 /**
  * A bar that moves along a track. The bar is resized relative to the size of the track and size of the content to be scrolled.
@@ -533,7 +551,7 @@ uiWidgets.Scrollbar = function (game, content, draggable, vertical, trackImage,
     // The smallest pixel size allowed for the bar.
     this.minBarSize = 44;
 
-    this.tweenParams = tweenParams || {'duration': 300, 'ease': Phaser.Easing.Quadratic.Out};
+    this.tweenParams = tweenParams || {"duration": 300, "ease": Phaser.Easing.Quadratic.Out};
 
     // Flag switched on when the track is clicked, switched off after the bar movement is finished.
     this.trackClicked = false;
@@ -880,7 +898,8 @@ uiWidgets.Scrollbar.prototype.moveContent = function () {
 
     this.onMovement.dispatch(this);
 };
-;var uiWidgets = uiWidgets || {};
+;var uiWidgets;
+uiWidgets = uiWidgets || {};
 
 /**
  * Bar that adjusts a number.
@@ -1017,9 +1036,9 @@ uiWidgets.ValueBar.prototype.setInitialBarPosition = function () {
 
     // The bar should always be in centered on it's current position.
     if (this.vertical) {
-	       this.bar.y = gripPositionOnTrack + this.track.y - (this.bar.height / 2);
+            this.bar.y = gripPositionOnTrack + this.track.y - (this.bar.height / 2);
     } else {
-	       this.bar.x = gripPositionOnTrack + this.track.x - (this.bar.width / 2);
+            this.bar.x = gripPositionOnTrack + this.track.x - (this.bar.width / 2);
     }
 
 };
@@ -1100,7 +1119,8 @@ uiWidgets.ValueBar.prototype.getGripPositionRatio = function () {
 
     return newGripPositionRatio;
 };
-;var uiWidgets = uiWidgets || {};
+;var uiWidgets;
+uiWidgets = uiWidgets || {};
 
 
 /**
@@ -1153,13 +1173,16 @@ uiWidgets.textButton = function (game, image, label, style, x, y, callback, call
 
 uiWidgets.textButton.prototype = Object.create(Phaser.Button.prototype);
 uiWidgets.textButton.constructor = uiWidgets.textButton;
-;var uiWidgets = uiWidgets || {};
+;var uiWidgets;
+uiWidgets = uiWidgets || {};
 
 /**
  * Frame that places new child nodes directly under the previous child.
  * @constructor
  * @param {Object} game - Current game instance.
- * @param {Object} context - The context this object is called in.
+ * @param {Number} x - The x position of the Frame.
+ * @param {Number} y - The y position of the Frame.
+ * @param {string} bg - The background image to use.
  */
 uiWidgets.Column = function (game, x, y, bg) {
     "use strict";
@@ -1169,35 +1192,17 @@ uiWidgets.Column = function (game, x, y, bg) {
 uiWidgets.Column.prototype = Object.create(uiWidgets.Frame.prototype);
 uiWidgets.Column.constructor = uiWidgets.Column;
 
-/** Adds a new object into the Column, then aligns it under the previous object.
- * @param {Object} node - The sprite to add to the Column.
- * @param {Number} alignment - The alignment relative to the previous child.
- * @param {Number} padding - The amount of space between objects.
- */
-uiWidgets.Column.prototype.addNode = function (node, alignment, padding) {
-    "use strict";
-    alignment = alignment || Phaser.BOTTOM_CENTER;
-    padding = padding || 0;
-
-    this.add(node);
-    var previousNode = this.children[this.children.length - 2];
-
-    if (previousNode !== undefined) {
-        node.alignTo(previousNode, alignment, 0, padding);
-    }
-
-    // Reset the positions for the bar's draggable area.
-    if ("enableBarDrag" in node) {
-        node.enableBarDrag();
-    }
-};
-;var uiWidgets = uiWidgets || {};
+uiWidgets.Column.prototype.alignment = Phaser.BOTTOM_CENTER;
+;var uiWidgets;
+uiWidgets = uiWidgets || {};
 
 /**
  * Frame that places new child nodes directly next to the previous child.
  * @constructor
  * @param {Object} game - Current game instance.
- * @param {Object} context - The context this object is called in.
+ * @param {Number} x - The x position of the Frame.
+ * @param {Number} y - The y position of the Frame.
+ * @param {string} bg - The background image to use.
  */
 uiWidgets.Row = function (game, x, y, bg) {
     "use strict";
@@ -1207,29 +1212,9 @@ uiWidgets.Row = function (game, x, y, bg) {
 uiWidgets.Row.prototype = Object.create(uiWidgets.Frame.prototype);
 uiWidgets.Row.constructor = uiWidgets.Row;
 
-/** Adds a new object into the Row, then aligns it next to the previous object.
- * @param {Object} node - The sprite to add to the row.
- * @param {Number} alignment - The alignment relative to the previous child.
- * @param {Number} padding - The amount of space between objects.
- */
-uiWidgets.Row.prototype.addNode = function (node, alignment, padding) {
-    "use strict";
-    alignment = alignment || Phaser.RIGHT_CENTER;
-    padding = padding || 0;
-
-    this.add(node);
-    var previousNode = this.children[this.children.length - 2];
-
-    if (previousNode !== undefined) {
-        node.alignTo(previousNode, alignment, padding);
-    }
-
-    // Reset the positions for the bar's draggable area.
-    if ("enableBarDrag" in node) {
-        node.enableBarDrag();
-    }
-};
-;var uiWidgets = uiWidgets || {};
+uiWidgets.Row.prototype.alignment = Phaser.RIGHT_CENTER;
+;var uiWidgets;
+uiWidgets = uiWidgets || {};
 
 /**
  * A container with a limited viewable area. Uses a mask to hide children outside of the specified x/y/width/height area.
@@ -1310,7 +1295,8 @@ uiWidgets.Viewport.prototype.disableOutOfBounds = function (children, context, v
         }
     }
 };
-;var uiWidgets = uiWidgets || {};
+;var uiWidgets;
+uiWidgets = uiWidgets || {};
 
 /** Collection of sprites that can be selected with the keyboard.
   * When the select key is hit, the sprite that was selected is now connected to the keyboard.
@@ -1429,7 +1415,8 @@ uiWidgets.KeyboardGroup.prototype.useBar = function () {
         this.downKey.onDown.add(this.selected.downEvent, this.selected);
     }
 };
-;var uiWidgets = uiWidgets || {};
+;var uiWidgets;
+uiWidgets = uiWidgets || {};
 
 /**
  * Represents a single point in a Wheel3D.
diff --git a/docs/index.html b/docs/index.html
index de61ed5..33156d4 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -130,9 +130,9 @@ 
 	
 
 
-	Documentation generated by JSDoc 3.4.3
+	Documentation generated by JSDoc 3.5.5
 	
-		on Sat Feb 17th 2018
+		on Fri Mar 23rd 2018
 	
 	using the DocStrap template.
 
diff --git a/docs/keyboard_group.js.html b/docs/keyboard_group.js.html
index 43b129b..e866b1e 100644
--- a/docs/keyboard_group.js.html
+++ b/docs/keyboard_group.js.html
@@ -70,7 +70,8 @@ 

Source: keyboard_group.js

var uiWidgets = uiWidgets || {};
+            class="sunlight-highlight-javascript linenums">var uiWidgets;
+uiWidgets = uiWidgets || {};
 
 /** Collection of sprites that can be selected with the keyboard.
   * When the select key is hit, the sprite that was selected is now connected to the keyboard.
@@ -232,9 +233,9 @@ 
 	
 
 
-	Documentation generated by JSDoc 3.4.3
+	Documentation generated by JSDoc 3.5.5
 	
-		on Sat Feb 17th 2018
+		on Fri Mar 23rd 2018
 	
 	using the DocStrap template.
 
diff --git a/docs/quicksearch.html b/docs/quicksearch.html
index e218fa3..c66e483 100644
--- a/docs/quicksearch.html
+++ b/docs/quicksearch.html
@@ -7,7 +7,7 @@