function fitBounds(bounds, immediately) {
            var aspect = this.getAspectRatio();
            var center = bounds.getCenter();

            // Resize bounds to match viewport's aspect ratio, maintaining center.
            var newBounds = new Malakh.Rectangle(bounds.x, bounds.y, bounds.width, bounds.height);
            if (newBounds.getAspectRatio() >= aspect) {
                // Width is bigger relative to viewport, resize height.
                newBounds.height = bounds.width / aspect;
                newBounds.y = center.y - newBounds.height / 2;
            } else {
                // Height is bigger relative to viewport, resize width.
                newBounds.width = bounds.height * aspect;
                newBounds.x = center.x - newBounds.width / 2;
            }

            parentPrototype.fitBounds.call(this, newBounds, immediately);

            this.$container.trigger('malakh:force_align');
            return this;
        }
/**
         * Displays the whole rectangle as large as possible so that it still
         * fits into the viewport and centers it.
         *
         * Note: this method it's a little different from it's equivalent in
         * <code>Malakh.AnimatedRectangle</code> as we can't change the viewport's aspect ratio.
         *
         * @see Malakh.AnimatedRectangle#fitBounds
         *
         * @param {Malakh.Rectangle} bounds
         * @param {boolean} [immediately=false]
         */
Displays the whole rectangle as large as possible so that it still
fits into the viewport and centers it.

this method it's a little different from it's equivalent in
Malakh.AnimatedRectangle as we can't change the viewport's aspect ratio.



@param {Malakh.Rectangle} bounds
@param {boolean} [immediately=false]
Displays the whole rectangle as large as possible so that it still fits into the viewport and centers it . this method it ' s a little different from it ' s equivalent in Malakh . AnimatedRectangle as we can ' t change the viewport ' s aspect ratio . @param { Malakh . Rectangle } bounds @param { boolean } [ immediately = false ]
function fitBounds(bounds, immediately) {
            var aspect = this.getAspectRatio();
            var center = bounds.getCenter();
            var newBounds = new Malakh.Rectangle(bounds.x, bounds.y, bounds.width, bounds.height);
            if (newBounds.getAspectRatio() >= aspect) {
                newBounds.height = bounds.width / aspect;
                newBounds.y = center.y - newBounds.height / 2;
            } else {
                newBounds.width = bounds.height * aspect;
                newBounds.x = center.x - newBounds.width / 2;
            }
            parentPrototype.fitBounds.call(this, newBounds, immediately);
            this.$container.trigger('malakh:force_align');
            return this;
        }
function fitBounds ( bounds , immediately ) { var aspect = this . getAspectRatio ( ) ; var center = bounds . getCenter ( ) ; var newBounds = new Malakh . Rectangle ( bounds . x , bounds . y , bounds . width , bounds . height ) ; if ( newBounds . getAspectRatio ( ) >= aspect ) { newBounds . height = bounds . width / aspect ; newBounds . y = center . y - newBounds . height / 2 ; } else { newBounds . width = bounds . height * aspect ; newBounds . x = center . x - newBounds . width / 2 ; } parentPrototype . fitBounds . call ( this , newBounds , immediately ) ; this . $container . trigger ( 'malakh:force_align' ) ; return this ; }
Displays the whole rectangle as large as possible so that it still
 fits into the viewport and centers it.
Displays the whole rectangle as large as possible so that it still fits into the viewport and centers it .
// Resize bounds to match viewport's aspect ratio, maintaining center. // Width is bigger relative to viewport, resize height. // Height is bigger relative to viewport, resize width.