Files
SIG/Scripts/AjaxControlToolkit/Release/FloatingBehavior.js
2024-11-05 10:47:20 -07:00

1 line
2.6 KiB
JavaScript

Sys.Extended.UI.FloatingBehavior=function(t){function e(t){window._event=t;var e=this.get_element();this.checkCanDrag(t.target)&&(i=$common.getLocation(e),t.preventDefault(),this.startDragDrop(e))}Sys.Extended.UI.FloatingBehavior.initializeBase(this,[t]);var n,o,i,r,a,s=Function.createDelegate(this,e);this.add_move=function(t){this.get_events().addHandler("move",t)},this.remove_move=function(t){this.get_events().removeHandler("move",t)},this.get_handle=function(){return n},this.set_handle=function(t){null!=n&&$removeHandler(n,"mousedown",s),n=t,$addHandler(n,"mousedown",s)},this.get_profileProperty=function(){return r},this.set_profileProperty=function(t){r=t},this.get_profileComponent=function(){return a},this.set_profileComponent=function(t){a=t},this.get_location=function(){return o},this.set_location=function(t){o!=t&&(o=t,this.get_isInitialized()&&$common.setLocation(this.get_element(),o),this.raisePropertyChanged("location"))},this.initialize=function(){Sys.Extended.UI.FloatingBehavior.callBaseMethod(this,"initialize"),Sys.Extended.UI.DragDropManager.registerDropTarget(this);var t=this.get_element();o||(o=$common.getLocation(t)),t.style.position="fixed",$common.setLocation(t,o)},this.dispose=function(){Sys.Extended.UI.DragDropManager.unregisterDropTarget(this),n&&s&&$removeHandler(n,"mousedown",s),s=null,Sys.Extended.UI.FloatingBehavior.callBaseMethod(this,"dispose")},this.checkCanDrag=function(t){var e=["input","button","select","textarea","label"],n=t.tagName;return!("a"==n.toLowerCase()&&null!=t.href&&t.href.length>0)&&!(Array.indexOf(e,n.toLowerCase())>-1)},this.get_dragDataType=function(){return"_floatingObject"},this.getDragData=function(t){return null},this.get_dragMode=function(){return Sys.Extended.UI.DragMode.Move},this.onDragStart=function(){},this.onDrag=function(){},this.onDragEnd=function(t){if(!t){var e=this.get_events().getHandler("move");if(e){var n=new Sys.CancelEventArgs;e(this,n),t=n.get_cancel()}}var r=this.get_element();t?$common.setLocation(r,i):(o=$common.getLocation(r),this.raisePropertyChanged("location"))},this.startDragDrop=function(t){Sys.Extended.UI.DragDropManager.startDragDrop(this,t,null)},this.get_dropTargetElement=function(){return document.body},this.canDrop=function(t,e,n){return"_floatingObject"==e},this.drop=function(t,e,n){},this.onDragEnterTarget=function(t,e,n){},this.onDragLeaveTarget=function(t,e,n){},this.onDragInTarget=function(t,e,n){}},Sys.Extended.UI.FloatingBehavior.registerClass("Sys.Extended.UI.FloatingBehavior",Sys.Extended.UI.BehaviorBase,Sys.Extended.UI.IDragSource,Sys.Extended.UI.IDropTarget,Sys.IDisposable);