Hopkins-Plugin-HMI

 view release on metacpan or  search on metacpan

share/root/static/yui/build/imagecropper/imagecropper-debug.js  view on Meta::CPAN

                    this._syncBackgroundPosition();
                    return false;
                }
            }
            if (ch != 't' && ch != 'tr' && ch != 'tl') {
                if (c.top && args.height && ((c.top + args.height) > region.bottom)) {
                    h = (region.bottom - c.top);
                    Dom.setY(this._resize.getWrapEl(), (region.bottom - h));
                    this._resize.getWrapEl().style.height = h + 'px';
                    this._resize._cache.height = h;
                    this._resize._cache.top = (region.bottom - h);
                    this._syncBackgroundPosition();
                    return false;
                }
            }
        },
        /**
        * @private
        * @method _handleResizeMaskEl
        * @description Resizes the inner mask element
        */
        _handleResizeMaskEl: function() {
            var a = this._resize._cache;
            this._resizeMaskEl.style.height = Math.floor(a.height) + 'px';
            this._resizeMaskEl.style.width = Math.floor(a.width) + 'px';
        },
        /**
        * @private
        * @method _handleResizeEvent
        * @param Event ev The Resize Utilitys resize event.
        * @description Handles the Resize Utilitys Resize event
        */
        _handleResizeEvent: function(ev) {
            this._setConstraints(true);
            this._syncBackgroundPosition();
            this.fireEvent('resizeEvent', arguments);
            this.fireEvent('moveEvent', { target: 'resizeevent' });
        },

        /**
        * @private
        * @method _syncBackgroundPosition
        * @description Syncs the packground position of the resize element with the resize elements top and left style position
        */
        _syncBackgroundPosition: function() {
            this._handleResizeMaskEl();
            this._setBackgroundPosition(-(parseInt(this._resizeEl.style.left, 10)), -(parseInt(this._resizeEl.style.top, 10)));
        },

        /**
        * @private
        * @method _setBackgroundPosition
        * @param Number l The left position
        * @param Number t The top position
        * @description Sets the background image position to the top and left position
        */
        _setBackgroundPosition: function(l, t) {
            //YAHOO.log('Setting the image background position of the mask to: (' + l + ', ' + t + ')', 'log', 'ImageCropper');
            var bl = parseInt(Dom.getStyle(this._resize.get('element'), 'borderLeftWidth'), 10);
            var bt = parseInt(Dom.getStyle(this._resize.get('element'), 'borderTopWidth'), 10);
            if (isNaN(bl)) {
                bl = 0;
            }
            if (isNaN(bt)) {
                bt = 0;
            }
            var mask = this._resize.getWrapEl().firstChild;
            var pos = (l - bl) + 'px ' + (t - bt) + 'px';
            this._resizeMaskEl.style.backgroundPosition = pos;
        },

        /**
        * @private
        * @method _setBackgroundImage
        * @param String url The url of the image
        * @description Sets the background image of the resize element
        */
        _setBackgroundImage: function(url) {
            YAHOO.log('Setting the background image', 'log', 'ImageCropper');
            var mask = this._resize.getWrapEl().firstChild;
            this._image = url;
            mask.style.backgroundImage = 'url(' + url + '#)';
        },
        
        /**
        * @private
        * @method _handleEndResizeEvent
        * @description Handles the Resize Utilitys endResize event
        */
        _handleEndResizeEvent: function() {
            this._setConstraints(true);
        },
        /**
        * @private
        * @method _handleStartResizeEvent
        * @description Handles the Resize Utilitys startResize event
        */
        _handleStartResizeEvent: function() {
            this._setConstraints(true);

            var h = this._resize._cache.height,
                 w = this._resize._cache.width,
                 t = parseInt(this._resize.getWrapEl().style.top, 10),
                 l = parseInt(this._resize.getWrapEl().style.left, 10),
                 maxH = 0, maxW = 0;
 
            switch (this._resize._currentHandle) {
                case 'b':
                    maxH = (h + this._resize.dd.bottomConstraint);
                    break;
                case 'l':
                    maxW = (w + this._resize.dd.leftConstraint);
                    break;
                case 'r':
                    maxH = (h + t);
                    maxW = (w + this._resize.dd.rightConstraint);
                    break;
                 case 'br':
                     maxH = (h + this._resize.dd.bottomConstraint);
                     maxW = (w + this._resize.dd.rightConstraint);
                     break;
                 case 'tr':
                     maxH = (h + t);
                     maxW = (w + this._resize.dd.rightConstraint);



( run in 1.696 second using v1.01-cache-2.11-cpan-39bf76dae61 )