If I have a dragable node on a RadTree is it possible to check the x/y location of where the node is dropped in respect to a panel?
So if I have a panel containing tree A, plus some other controls, I just want to know if the node I have dragged from tree B is over the panel containing tree A possibly changing the background colour of the panel to show that the node is over an area that it can be released?
I have tried using the following code to test the possibility out, but the domEvent.offsetX seems to keep changing what it is measuring from as I move it around.
So if I have a panel containing tree A, plus some other controls, I just want to know if the node I have dragged from tree B is over the panel containing tree A possibly changing the background colour of the panel to show that the node is over an area that it can be released?
I have tried using the following code to test the possibility out, but the domEvent.offsetX seems to keep changing what it is measuring from as I move it around.
<script type=
"text/javascript"
language=
"javascript"
>
function
findPosX(obj) {
var
curleft = 0;
if
(obj.offsetParent)
while
(1) {
curleft += obj.offsetLeft;
if
(!obj.offsetParent)
break
;
obj = obj.offsetParent;
}
else
if
(obj.x)
curleft += obj.x;
return
curleft;
}
function
findPosY(obj) {
var
curtop = 0;
if
(obj.offsetParent)
while
(1) {
curtop += obj.offsetTop;
if
(!obj.offsetParent)
break
;
obj = obj.offsetParent;
}
else
if
(obj.y)
curtop += obj.y;
return
curtop;
}
function
ClientNodeDragging(sender, eventArgs) {
var
domEvent = eventArgs.get_domEvent();
var
node = eventArgs.get_node();
var
MyPanel;
if
(document.getElementById(
'<%= leftPanel.FindControl("pnlPositionSelector").ClientID %>'
) !=
null
) {
MyPanel = document.getElementById(
'<%= leftPanel.FindControl("pnlPositionSelector").ClientID %>'
);
node.set_text(
"Dragging X:"
+ domEvent.offsetX +
" Y:"
+ domEvent.offsetY +
" target XPos="
+ findPosX(MyPanel) +
" target YPos="
+ findPosY(MyPanel));
}
else
{
node.set_text(
"Dragging X:"
+ domEvent.offsetX +
" Y:"
+ domEvent.offsetY);
}
//MyPanel.style.height = NewHeight + "px";
//MyPanel.style.width = NewWidth + "px";
}
</script>