src/aria/utils/resize/Resize.js
function (geometry) {
            var boundary = this._boundary;
            if (boundary) {
                var boundaryGeometry = boundary;
                if (boundary == ariaUtilsDom.VIEWPORT) {
                    var viewportSize = ariaUtilsDom._getViewportSize();
                    boundaryGeometry = {
                        x: 0,
                        y: 0,
                        width: viewportSize.width,
                        height: viewportSize.height
                    };
                }
                var deltaLeft = geometry.x - boundaryGeometry.x;
                var deltaTop = geometry.y - boundaryGeometry.y;
                var deltaRight = boundaryGeometry.x + boundaryGeometry.width - geometry.x - geometry.width;
                var deltaBottom = boundaryGeometry.y + boundaryGeometry.height - geometry.y - geometry.height;
                if (deltaLeft < 0) {
                    geometry.x -= deltaLeft;
                    geometry.width += deltaLeft;
                }
                if (deltaTop < 0) {
                    geometry.y -= deltaTop;
                    geometry.height += deltaTop;
                }
                if (deltaRight < 0) {
                    geometry.width += deltaRight;
                }
                if (deltaBottom < 0) {
                    geometry.height += deltaBottom;
                }
            }
            return geometry;
        }
function (geometry) {
            var boundary = this._boundary;
            if (boundary) {
                var boundaryGeometry = boundary;
                if (boundary == ariaUtilsDom.VIEWPORT) {
                    var viewportSize = ariaUtilsDom._getViewportSize();
                    boundaryGeometry = {
                        x: 0,
                        y: 0,
                        width: viewportSize.width,
                        height: viewportSize.height
                    };
                }
                var deltaLeft = geometry.x - boundaryGeometry.x;
                var deltaTop = geometry.y - boundaryGeometry.y;
                var deltaRight = boundaryGeometry.x + boundaryGeometry.width - geometry.x - geometry.width;
                var deltaBottom = boundaryGeometry.y + boundaryGeometry.height - geometry.y - geometry.height;
                if (deltaLeft < 0) {
                    geometry.x -= deltaLeft;
                    geometry.width += deltaLeft;
                }
                if (deltaTop < 0) {
                    geometry.y -= deltaTop;
                    geometry.height += deltaTop;
                }
                if (deltaRight < 0) {
                    geometry.width += deltaRight;
                }
                if (deltaBottom < 0) {
                    geometry.height += deltaBottom;
                }
            }
            return geometry;
        }
function ( geometry ) { var boundary = this . _boundary ; if ( boundary ) { var boundaryGeometry = boundary ; if ( boundary == ariaUtilsDom . VIEWPORT ) { var viewportSize = ariaUtilsDom . _getViewportSize ( ) ; boundaryGeometry = { x : 0 , y : 0 , width : viewportSize . width , height : viewportSize . height } ; } var deltaLeft = geometry . x - boundaryGeometry . x ; var deltaTop = geometry . y - boundaryGeometry . y ; var deltaRight = boundaryGeometry . x + boundaryGeometry . width - geometry . x - geometry . width ; var deltaBottom = boundaryGeometry . y + boundaryGeometry . height - geometry . y - geometry . height ; if ( deltaLeft < 0 ) { geometry . x -= deltaLeft ; geometry . width += deltaLeft ; } if ( deltaTop < 0 ) { geometry . y -= deltaTop ; geometry . height += deltaTop ; } if ( deltaRight < 0 ) { geometry . width += deltaRight ; } if ( deltaBottom < 0 ) { geometry . height += deltaBottom ; } } return geometry ; }
Fits the resized element within viewport
@param {aria.utils.DomBeans:Geometry} geometry
@return {aria.utils.DomBeans:Geometry} fitted geometry
Fits the resized element within viewport