Index: branches/RC/core/kernel/utility/debugger/debugger.js =================================================================== diff -u -r8929 -r9307 --- branches/RC/core/kernel/utility/debugger/debugger.js (.../debugger.js) (revision 8929) +++ branches/RC/core/kernel/utility/debugger/debugger.js (.../debugger.js) (revision 9307) @@ -69,6 +69,12 @@ this.RowCount = 0; this.busyRequest = false; + this.DragObject = null; + this.LastDragObject = null; + this.MouseOffset = [0,0]; + this.ResizeHappening = false; + this.ResizeTimer = null; + this.InitialPos = null; // window.$Debugger = this; // this should be uncommented in case if debugger variable is not $Debugger this.AddEvent(window, 'scroll', function (ev) { window.$Debugger.Resize(ev); }); this.AddEvent(window, 'resize', function (ev) { window.$Debugger.Resize(ev); }); @@ -99,6 +105,10 @@ Debugger.prototype.AddToolbar = function($var_name) { var $span = document.createElement('SPAN'); $span.style.position = 'absolute'; + $span.style.zIndex= 99; + $span.style.top = '0px'; + $span.style.left = '0px'; + $span.id = 'debug_toolbar_span'; document.body.style.textAlign = 'left'; var $toolbar_content = 'Reload Frame'; @@ -111,10 +121,10 @@ } if (this.SQLCount > 0) { - $toolbar_content += '' + this.SQLCount + ' sqls'; + $toolbar_content += '' + this.SQLCount + ' sqls'; } - $span.innerHTML = '' + $toolbar_content + '
'; + $span.innerHTML = '' + $toolbar_content + '
'; this.DebuggerToolbar = $span; this.SetOpacity(20); @@ -127,6 +137,7 @@ var $body = document.getElementsByTagName('BODY')[0]; $body.insertBefore($span, $body.firstChild); + this.MakeDragable('debug_toolbar_span', function() {}, function() {}, function() {}); } Debugger.prototype.AppendRow = function($html) { @@ -339,4 +350,63 @@ } else { $status = el.addEventListener(evname, func, true); } +} +Debugger.prototype.mouseCoords = function(ev) +{ + if(ev.pageX || ev.pageY){ + var res = {x:ev.pageX, y:ev.pageY}; + } + else { + var res = { + x:ev.clientX + document.body.scrollLeft - document.body.clientLeft, + y:ev.clientY + document.body.scrollTop - document.body.clientTop + }; + } + return res; +} +Debugger.prototype.MakeDragable = function(object_id, startCallback, moveCallback, endCallback, options) +{ + var drag_object = document.getElementById(object_id); + var cur_options = {'VerticalDrag': 1, 'HorizontalDrag': 1}; + if (options) { + for(var i in options) { + cur_options[i] = options[i]; + } + } + var the_debugger = this; + drag_object.onmousedown = function(ev){ + ev = ev || window.event; + the_debugger.InitialPos = findPos(drag_object); + var coords = the_debugger.mouseCoords(ev); + var pos = findPos(this); + the_debugger.MouseOffset = [coords.x - pos[0], coords.y - pos[1]]; + the_debugger.DragObject = this; + the_debugger.LastDragObject = this; + the_debugger.DragObject.style.position = 'absolute'; + the_debugger.Options = cur_options; + startCallback(drag_object); + } + document.onmousemove = function(ev){ + ev = ev || window.event; + var coords = the_debugger.mouseCoords(ev); +// window.status = 'mouse at: '+coords.x+','+coords.y; + if(the_debugger.DragObject){ + if (the_debugger.Options.VerticalDrag) { + the_debugger.DragObject.style.top = (coords.y - the_debugger.MouseOffset[1] ) + 'px' // ; + } + if (the_debugger.Options.HorizontalDrag) { + the_debugger.DragObject.style.left = (coords.x - the_debugger.MouseOffset[0] ) + 'px' // ; + } + moveCallback(drag_object, coords) + return false; + } + } + document.onmouseup = function(ev){ + var tmp = the_debugger.DragObject; + the_debugger.DragObject = null; + if(tmp){ + endCallback(tmp); + } + var pos = findPos(drag_object); + } } \ No newline at end of file