]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - include/javascript/yui3/build/resize/resize-proxy.js
Release 6.5.0
[Github/sugarcrm.git] / include / javascript / yui3 / build / resize / resize-proxy.js
1 /*
2  Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3  Code licensed under the BSD License:
4  http://developer.yahoo.com/yui/license.html
5  version: 3.3.0
6  build: 3167
7  */
8 YUI.add('resize-proxy',function(Y){var ACTIVE_HANDLE_NODE='activeHandleNode',CURSOR='cursor',DRAG_CURSOR='dragCursor',HOST='host',PARENT_NODE='parentNode',PROXY='proxy',PROXY_NODE='proxyNode',RESIZE='resize',RESIZE_PROXY='resize-proxy',WRAPPER='wrapper',getCN=Y.ClassNameManager.getClassName,CSS_RESIZE_PROXY=getCN(RESIZE,PROXY);function ResizeProxy(){ResizeProxy.superclass.constructor.apply(this,arguments);}
9 Y.mix(ResizeProxy,{NAME:RESIZE_PROXY,NS:PROXY,ATTRS:{proxyNode:{setter:Y.one,valueFn:function(){return Y.Node.create(this.PROXY_TEMPLATE);}}}});Y.extend(ResizeProxy,Y.Plugin.Base,{PROXY_TEMPLATE:'<div class="'+CSS_RESIZE_PROXY+'"></div>',initializer:function(){var instance=this;instance.afterHostEvent('resize:start',instance._afterResizeStart);instance.beforeHostMethod('_resize',instance._beforeHostResize);instance.afterHostMethod('_resizeEnd',instance._afterHostResizeEnd);},destructor:function(){var instance=this;instance.get(PROXY_NODE).remove(true);},_afterHostResizeEnd:function(event){var instance=this,drag=event.dragEvent.target;drag.actXY=[];instance._syncProxyUI();instance.get(PROXY_NODE).hide();},_afterResizeStart:function(event){var instance=this;instance._renderProxy();},_beforeHostResize:function(event){var instance=this,host=this.get(HOST);host._handleResizeAlignEvent(event.dragEvent);instance._syncProxyUI();return new Y.Do.Prevent();},_renderProxy:function(){var instance=this,host=this.get(HOST),proxyNode=instance.get(PROXY_NODE);if(!proxyNode.inDoc()){host.get(WRAPPER).get(PARENT_NODE).append(proxyNode.hide());}},_syncProxyUI:function(){var instance=this,host=this.get(HOST),info=host.info,activeHandleNode=host.get(ACTIVE_HANDLE_NODE),proxyNode=instance.get(PROXY_NODE),cursor=activeHandleNode.getStyle(CURSOR);proxyNode.show().setStyle(CURSOR,cursor);host.delegate.dd.set(DRAG_CURSOR,cursor);proxyNode.sizeTo(info.offsetWidth,info.offsetHeight);proxyNode.setXY([info.left,info.top]);}});Y.namespace('Plugin');Y.Plugin.ResizeProxy=ResizeProxy;},'3.3.0',{requires:['resize-base','plugin'],skinnable:false});