mirror of
https://github.com/status-im/react-native.git
synced 2025-01-17 21:11:45 +00:00
5e33dbcfcc
Summary: This was a confusing place for them. BoundingDimensions, Position, and Touchable were only used in Touchable; StaticContainer I moved to Libraries/Components. @public Reviewed By: @vjeux Differential Revision: D2530730 fb-gh-sync-id: e636a6b7259c2bd3ab52c82ebd59a6c66c9e7e7a
38 lines
889 B
JavaScript
38 lines
889 B
JavaScript
/**
|
|
* @providesModule BoundingDimensions
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
var PooledClass = require('PooledClass');
|
|
|
|
var twoArgumentPooler = PooledClass.twoArgumentPooler;
|
|
|
|
/**
|
|
* PooledClass representing the bounding rectangle of a region.
|
|
*
|
|
* @param {number} width Width of bounding rectangle.
|
|
* @param {number} height Height of bounding rectangle.
|
|
* @constructor BoundingDimensions
|
|
*/
|
|
function BoundingDimensions(width, height) {
|
|
this.width = width;
|
|
this.height = height;
|
|
}
|
|
|
|
/**
|
|
* @param {HTMLElement} element Element to return `BoundingDimensions` for.
|
|
* @return {BoundingDimensions} Bounding dimensions of `element`.
|
|
*/
|
|
BoundingDimensions.getPooledFromElement = function(element) {
|
|
return BoundingDimensions.getPooled(
|
|
element.offsetWidth,
|
|
element.offsetHeight
|
|
);
|
|
};
|
|
|
|
PooledClass.addPoolingTo(BoundingDimensions, twoArgumentPooler);
|
|
|
|
module.exports = BoundingDimensions;
|
|
|