/** * Animates view according to its toggled state * @callback jibo.face.views.StandardButton~ToggleAnimate * @param {Boolean} toggleOn Value to assign to flag holding button's current toggle state * @param {Boolean} [shouldAnimate = false] `true` to animate state change. */ /** * @interface jibo.face.views.StandardButton~StandardButtonOptions * @extends jibo.face.views.Element~ElementOptions * @description Interface describing data provided in the config. * @prop {Boolean} [willToggle] - Flag that indicates whether button will be toggleable or not. * @prop {Boolean} [toggledOn] - Value indicating current state of the button * @prop {jibo.face.views.StandardButton~ToggleAnimate} [toggleAnimate] - Function that performs animation for the changes of the toggling state */ /** * StandardButton element. * Describes general behavior for buttons when graphical asset responses to basic touch events. * * @class StandardButton * @extends jibo.face.views.Button * @memberof jibo.face.views */ /** * The default class identifier. * Generally used to register the class. * @name jibo.face.views.StandardButton#DEFAULT_TYPE * @type {String} * @private * @readOnly */ /** * FOR OVERRIDE ONLY. DO NOT ALTER. * * The Class name as a string. * @name jibo.face.views.StandardButton#_type * @type {String} * @protected */ /** * Scale value for down state of button. * @name jibo.face.views.StandardButton#downScale * @type {number} */ /** * Scale value for activate state of button. * @name jibo.face.views.StandardButton#activateScale * @type {number} */ /** * Duration of tweens for button state changes. * @name jibo.face.views.StandardButton#tweenTime * @type {number} */ /** * Flag that indicates whether button will be toggleable or not. * @name jibo.face.views.StandardButton#willToggle * @type {Boolean} * @default false */ /** * Flag that indicates whether button will do default down-state transitions * @name jibo.face.views.StandardButton#disableStateAnimations * @type {Boolean} * @default false */ /** * Flag determining current toggle state of the button * @name jibo.face.views.StandardButton#_toggledOn * @type {Boolean} * @default false * @private */ /** * Create a StandardButton from a configuration Object derived from JSON. * @method jibo.face.views.StandardButton.createFromConfig * @param {Object} configData Object derived from JSON, must be a specific format refer to examples. * @returns {jibo.face.views.StandardButton} The StandardButton created from the given configuration. */ /** * Create a StandardButton 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.StandardButton.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.StandardButton} The created StandardButton. */ /** * Optional function that implements animation switching of toggle state * @name jibo.face.views.StandardButton#toggleAnimate * @type {jibo.face.views.StandardButton~ToggleAnimate} */ /** * Returns button's current toggle state value * @method jibo.face.views.StandardButton#toggledOn * @returns {Boolean} `true` if the button is currently toggled * @readOnly */ /** * The display containing the button assets. * Additionaly this is the DisplayObject that transforms are applied to for button states. * @name jibo.face.views.StandardButton#buttonDisplay * @type {PIXI.Container} * @readOnly */ /** * FOR OVERRIDE ONLY. DO NOT CALL. * * Assign data passed via Object to class. * Method can be overridden to allow for manual definition of values, assets, etc. * @method jibo.face.views.StandardButton#assignConfig * @param {any} configData - Object derived from JSON containing values specific to StandardButton. */ /** * Destroy display's children and stop tweens on content. * @method jibo.face.views.StandardButton#emptyDisplay */ /** * Set up the display. * Assign assets, set timelines, etc. * @method jibo.face.views.StandardButton#setupDisplay * @param {Object} [assets] - Object passed back from loader namespace load method, * refer to {@link jibo.loader} for details. */ /** * * Add asset to content container of button, content is effected by state change transitions (e.g. down, out, up) * If the given asset is a PIXI.Sprite a center registration is applied, * in all other cases it is expected that the assets has been given appropriate registration. * @method jibo.face.views.StandardButton#addToContent * @param {PIXI.DisplayObject} asset DisplayObject instance to be placed within content container. * @param {PIXI.Container} [container] If not specified will uses default content container. * @param {boolean} [emptyContent = false] If `true` will empty content of all children */ /** * Method to change the state of the button and trigger visual change of the state * @method jibo.face.views.StandardButton#toggle * @param {Boolean} toggleOn Value to assign to flag holding button's current toggle state * @param {Boolean} [animate = true] `true` to animate state change. */ /** * Activate the button. Used for non-touch input. * @method jibo.face.views.StandardButton#activate */ /** * FOR OVERRIDE ONLY. DO NOT CALL. * * Handler for out-transition executed in {@link jibo.face.views.StandardButton#out} * @method jibo.face.views.StandardButton#outTransition * @protected */ /** * FOR OVERRIDE ONLY. DO NOT CALL. * * Handler for toggleOut-transition executed in {@link jibo.face.views.StandardButton#out} * @method jibo.face.views.StandardButton#toggleOutTransition * @protected */ /** * FOR OVERRIDE ONLY. DO NOT CALL. * * Handler for down-transition executed in {@link jibo.face.views.StandardButton#down} * @method jibo.face.views.StandardButton#downTransition * @protected */ /** * FOR OVERRIDE ONLY. DO NOT CALL. * * Handler for toggleDown-transition executed in {@link jibo.face.views.StandardButton#down} * @method jibo.face.views.StandardButton#toggleDownTransition * @protected */ /** * FOR OVERRIDE ONLY. DO NOT CALL. * * Handler for up-transition executed in {@link jibo.face.views.StandardButton#up} * @method jibo.face.views.StandardButton#upTransition * @protected */ /** * FOR OVERRIDE ONLY. DO NOT CALL. * * Handler for toggleUp-transition executed in {@link jibo.face.views.StandardButton#up} * @method jibo.face.views.StandardButton#toggleUpTransition * @protected */ /** * FOR OVERRIDE ONLY. DO NOT CALL. * * Animation for simple button behavior when it's pressed down * @method jibo.face.views.StandardButton#animateDown * @protected */ /** * FOR OVERRIDE ONLY. DO NOT CALL. * * Animation for simple button behavior when touch event is released * @method jibo.face.views.StandardButton#animateUp * @protected */ /** * This method takes array of functions and starts them asynchronously * @method jibo.face.views.StandardButton#executeAsyncTransitions * @param {any[]} [transitionArray] Array of transition functions to be executed in parallel * @param {Function} [callback] Function to execute once execution is done * @private */ /** // * Handler for when transitions are all complete. // * @method jibo.face.views.StandardButton#transitionComplete // * @param {Function} callback The callback triggered once transitions are completed // * @param {Error} [err] Error returns if there is an issue with the asynchronous method. // * @param {any[]} [results] Results returned from asynchronous method, will be empty. // * @private // */