Patches item #433195, was updated on 2001-06-14 10:59
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305757&aid=433195&group_id=5757
Category: DynAPI 2 Extension
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Scott Severtson (scottsevertson)
Assigned to: Nobody/Anonymous (nobody)
Summary: DragDrop requirements
Initial Comment:
Currently, drop events are fired only if the event
source layer is release entirely within the listening
layer.
Traditional drag-and-drop at the OS level accepts drop
events if an element is dragged and released with just
the mouse pointer inside the target. This includes
Windows, Macintosh, and most X apps that support drag
and drop.
The following changes will make this requirements
change take effect.
dynapi\event\dragevent.js, line 121:
FROM:
if (lyr.parent.DragDrop) lyr.parent.DragDrop(lyr);
TO:
if (lyr.parent.DragDrop) lyr.parent.DragDrop(lyr, e);
dynapi\ext\dragdrop.js, lines 10-26:
FROM:
DynObject.prototype.DragDrop=function(s){
if (!this.children.length>0) return false;
var ch,chX,sX,sY;
for (var i in this.children) {
ch=this.children[i];
chX=ch.getPageX();
chY=ch.getPageY();
sX=s.getPageX();
sY=s.getPageY();
if (chX<sX && chX+ch.w>sX+s.w && chY<sY &&
chY+ch.h>sY+s.h) {
if (ch.DragDrop(s)) return true;
ch.invokeEvent("drop");
return true;
}
}
return false;
};
TO:
DynObject.prototype.DragDrop=function(s,e){
if (!this.children.length>0) return false;
var ch,chX,chY,eX,eY;
for (var i in this.children) {
ch=this.children[i];
chX=ch.getPageX();
chY=ch.getPageY();
eX=e.getX();
eY=e.getY();
if (chX<eX && chX+ch.w>eX && chY<eY &&
chY+ch.h>eY) {
if (ch.DragDrop(s,e)) return true;
ch.invokeEvent("drop");
return true;
}
}
return false;
};
Tested on Windows NT, IE 5.01 and NS 4.72.
Test Case:
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript"
SRC="dynapi/dynapi.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript"><!--
DynAPI.setLibraryPath("dynapi/lib/");
DynAPI.include("dynapi.api.*");
DynAPI.include("dynapi.event.*");
DynAPI.include("dynapi.ext.dragdrop");
//--></SCRIPT>
<SCRIPT LANGUAGE="JavaScript"><!--
DynAPI.onLoad = function() {
myTarget1= new DynLayer
('Target1',200,300,50,50,'green')
mySource1 = new DynLayer
('Source1',250,200,20,20,'#00FF99')
myListenerDrop=new EventListener(myTarget1)
myListenerDrop.ondrop=function(e) {
alert("dropped");
}
myTarget1.addEventListener(myListenerDrop)
DragEvent.enableDragEvents(mySource1)
DynAPI.document.addChild(myTarget1)
DynAPI.document.addChild(mySource1)
}
//--></SCRIPT>
</HEAD>
<BODY>
</BODY>
</HTML>
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305757&aid=433195&group_id=5757
_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-dev