Files
JiboOs/docs/rendering/gui/DisplayUtils.js
2026-03-16 13:53:01 +02:00

24 lines
1.3 KiB
JavaScript

/**
* Get the uniform scale required for DisplayObject to fit given dimensions.
* @method jibo.face.DisplayUtils#getScaleByWidthHeight
* @param {PIXI.DisplayObject} displayObject - DisplayObject to get the scale for.
* @param {number} width - Target width.
* @param {number} height - Target height.
* @returns {number} Uniform scale to apply to given DisplayObject for it to fit given dimension.
*/
/**
* Check whether display if contained by another display.
* @method jibo.face.DisplayUtils#isContained
* @param {PIXI.DisplayObject} display - DisplayObject checking for containment.
* @param {PIXI.Container} container - Container to check if display is contained within.
* @returns {boolean} `true` if display is contained within container.
*/
/**
* Takes position value provided for the element and makes sure that it is positioned properly + processes LEFT/RIGHT/CENTER/TOP/BOTTOM alignment options
* Remember, that RIGHT/BOTTOM alignment does not include actual element bounds, this should be handled separately
* @method jibo.face.DisplayUtils#getElementPosition
* @param {Object} position - Position data for the element
* @returns {PIXI.Point} Contains proper point value of the element on the screen
*/