forked from Jibo-Revival-Group/JiboOs
110 lines
3.5 KiB
JavaScript
110 lines
3.5 KiB
JavaScript
/**
|
|
* Button element.
|
|
* Can be assigned {@link jibo.face.views.ActionData}, which are triggered on button click.
|
|
*
|
|
* @class Button
|
|
* @extends jibo.face.views.Element
|
|
* @memberof jibo.face.views
|
|
*/
|
|
|
|
/**
|
|
* `PIXI.animate.MovieClip` containing button states.
|
|
* Buttons do not require MovieClips, so if a `PIXI.animate.Timeline`
|
|
* is not given as the base asset this remains undefined.
|
|
* @name jibo.face.views.Button#timeline
|
|
* @type {PIXI.animate.MovieClip}
|
|
*/
|
|
|
|
/**
|
|
* FOR OVERRIDE ONLY. DO NOT ALTER.
|
|
*
|
|
* The Class name as a string.
|
|
* @name jibo.face.views.Button#_type
|
|
* @type {String}
|
|
* @protected
|
|
*/
|
|
|
|
/**
|
|
* Flag used to keep track if button is down.
|
|
* Is set within button state methods e.g. over, down, up, etc.
|
|
* @name jibo.face.views.Button#isDown
|
|
* @type {Boolean}
|
|
* @protected
|
|
*/
|
|
|
|
/**
|
|
* Create a Button from a configuration Object derived from JSON.
|
|
* @method jibo.face.views.Button.createFromConfig
|
|
* @param {Object} configData Object derived from JSON, must be a specific format refer to examples.
|
|
* @returns {jibo.face.views.Button} The Button created from the given configuration.
|
|
*/
|
|
|
|
/**
|
|
* Create a Button object by passing the DisplayObject and specifying the {@link jibo.face.views.ActionData}.
|
|
* This allows for a more direct way to create Buttons that is not reliant on the configuration data.
|
|
* @method jibo.face.views.Button.createFromDisplayObject
|
|
* @param {PIXI.DisplayObject} displayObject The DisplayObject with the button assets.
|
|
* @param {jibo.face.views.ActionData} [actionData] The action to be triggered on button click.
|
|
* @param {PIXI.Container} container Display container for the button.
|
|
* @returns {jibo.face.views.Button} The created Button.
|
|
*/
|
|
|
|
/**
|
|
* Set up the display.
|
|
* Assign assets, set timelines, etc.
|
|
* @method jibo.face.views.Button#setupDisplay
|
|
* @param {Object} [assets] - Object passed back from loader namespace load method,
|
|
* refer to {@link jibo.loader} for details.
|
|
*/
|
|
|
|
/**
|
|
* TO BE CALLED INTERNALLY ONLY.
|
|
*
|
|
* Define the interactive hit area of the display.
|
|
* The `DisplayObject.hitArea` is what Pixi uses to define the interactive area.
|
|
* Should be called within `setupDisplay()`.
|
|
* @method jibo.face.views.Button#setupHitArea
|
|
* @param {PIXI.Rectangle} [bounds] Optionally specify the bounds for the hit area.
|
|
* If not defined, defaults to using the display's bounds.
|
|
* @protected
|
|
*/
|
|
|
|
/**
|
|
* Lock or unlock input, lock value is applied to the display's interactive variable.
|
|
* @method jibo.face.views.Button#lockInput
|
|
* @param {Boolean} flag - Determines if input is locked.
|
|
*/
|
|
|
|
/**
|
|
* Manually force a click.
|
|
* @method jibo.face.views.Button#click
|
|
* @param {any} mouseData Returned from Pixi.
|
|
* @protected
|
|
*/
|
|
|
|
/**
|
|
* Handler for out touch input.
|
|
* @method jibo.face.views.Button#out
|
|
* @param {any} mouseData Returned from Pixi.
|
|
* @protected
|
|
*/
|
|
|
|
/**
|
|
* Handler for down touch input.
|
|
* @method jibo.face.views.Button#down
|
|
* @param {any} mouseData Returned from Pixi.
|
|
* @protected
|
|
*/
|
|
|
|
/**
|
|
* Handler for up touch input.
|
|
* @method jibo.face.views.Button#up
|
|
* @param {any} mouseData Returned from Pixi.
|
|
* @protected
|
|
*/
|
|
|
|
/**
|
|
* Activate the button, used for non-touch input.
|
|
* @method jibo.face.views.Button#activate
|
|
* @public
|
|
*/ |