Update of /cvsroot/dynapi/dynapi/src/lib/dynapi/event
In directory usw-pr-cvs1:/tmp/cvs-serv8866/src/lib/dynapi/event

Modified Files:
        listeners.js mouse.js 
Log Message:
Hopefully the scrollbar and drag event work fine now. The .x and .y sttributes where 
incorrectly set in mouse.js. Also I added that force mouseUp to me where the mouseDown 
was. Disabled by default, set DynMouseEvent.forceUp to true if you want to enable it.

Index: listeners.js
===================================================================
RCS file: /cvsroot/dynapi/dynapi/src/lib/dynapi/event/listeners.js,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** listeners.js        2001/03/26 09:42:15     1.2
--- listeners.js        2001/03/26 15:41:36     1.3
***************
*** 49,52 ****
--- 49,53 ----
        if(e.bubble && this.parent) {
                e.preBubbleCode();
+               e.src = this.parent;
                this.parent.invokeEvent(type,e,args);
        }

Index: mouse.js
===================================================================
RCS file: /cvsroot/dynapi/dynapi/src/lib/dynapi/event/mouse.js,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** mouse.js    2001/03/25 06:04:17     1.1
--- mouse.js    2001/03/26 15:41:36     1.2
***************
*** 18,25 ****
  DynMouseEvent.prototype.preBubbleCode=function() {
        if(!this.src.parent) return;
!       this.x+=this.src.parent.x;
!       this.y+=this.src.parent.y;
!       // This is difficult to explain but needs to be here. Try removing it and 
running 'dynapi.event.bubbling.html'
!       if(is.def && (this.type=='mouseover' || this.type=='mouseout') && 
this.src.parent) this.src = this.src.parent;
  };
  DynMouseEvent.prototype.getX=function() {return this.x};
--- 18,23 ----
  DynMouseEvent.prototype.preBubbleCode=function() {
        if(!this.src.parent) return;
!       this.x+=this.src.x;
!       this.y+=this.src.y;
  };
  DynMouseEvent.prototype.getX=function() {return this.x};
***************
*** 30,39 ****
  // This is THE event. 
  DynMouseEvent._e=new DynMouseEvent()
  
  DynMouseEvent.EventMethod=function(e) {
        var dynobject=this.lyrobj;
        if(is.def) {
!           if (is.ie) var e=dynobject.frame.event
!         e.cancelBubble=true;
  
                if (DynAPI.wasDragging && e.type=="click") {
--- 28,39 ----
  // This is THE event. 
  DynMouseEvent._e=new DynMouseEvent()
+ // If this is true, then mouseups always happen where the mousedown happened
+ DynMouseEvent.forceMouseUp = false
  
  DynMouseEvent.EventMethod=function(e) {
        var dynobject=this.lyrobj;
        if(is.def) {
!               if (is.ie) var e=dynobject.frame.event
!               e.cancelBubble=true;
  
                if (DynAPI.wasDragging && e.type=="click") {
***************
*** 48,52 ****
  
        // Now 'realsrc' should point to the DynLayer object where the event initially 
was triggered
!     if (!realsrc) { alert('Error in MouseEvents'); return; }
  
        if(is.def) {
--- 48,52 ----
  
        // Now 'realsrc' should point to the DynLayer object where the event initially 
was triggered
!       if (!realsrc) { alert('Error in MouseEvents'); return; }
  
        if(is.def) {
***************
*** 54,58 ****
                if(e.type=="mouseover" && 
realsrc.isParentOf(Methods.getContainerLayerOf(is.ie?e.fromElement:e.relatedTarget),true))
 return true;
        }
!     var evt=DynMouseEvent._e
  
        // Step one: properties common to all DynEvents
--- 54,58 ----
                if(e.type=="mouseover" && 
realsrc.isParentOf(Methods.getContainerLayerOf(is.ie?e.fromElement:e.relatedTarget),true))
 return true;
        }
!       var evt=DynMouseEvent._e
  
        // Step one: properties common to all DynEvents
***************
*** 107,112 ****
        else if(is.ns4 && (e.type=="mouseover" || e.type=="mouseout")) 
evt.setBubble(false);
  
        // Invoke the event
!     realsrc.invokeEvent(type,evt);
        if (is.ns4 && is.other && type=="mousedown") {
                if (this.dbltimer!=null) {
--- 107,122 ----
        else if(is.ns4 && (e.type=="mouseover" || e.type=="mouseout")) 
evt.setBubble(false);
  
+ 
+       // This forces mouseUps to happen in the same place where mousedowns took place
+       if (DynMouseEvent.forceMouseUp && is.def) { 
+               if (e.type=='mousedown') DynMouseEvent.focus=realsrc; 
+               else if (e.type=='mouseup' && DynMouseEvent.focus!=null) 
+               evt.src=realsrc=DynMouseEvent.focus; 
+       };
+ 
        // Invoke the event
!       realsrc.invokeEvent(type,evt);
! 
!       // Other checks
        if (is.ns4 && is.other && type=="mousedown") {
                if (this.dbltimer!=null) {
***************
*** 128,131 ****
--- 138,142 ----
        }
  
+       // Return value
        return evt.browserReturn;
  }


_______________________________________________
Dynapi-CVS mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-cvs

Reply via email to