Update of /cvsroot/dynapi/dynapi/src/lib/dynapi/api
In directory usw-pr-cvs1:/tmp/cvs-serv18018
Modified Files:
events.js
Log Message:
Fixed NS6 events. Events are attached properly (but not removed yet).
Double click is now working, and click and double click events are no
longer generated after drag.
Index: events.js
===================================================================
RCS file: /cvsroot/dynapi/dynapi/src/lib/dynapi/api/events.js,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -r1.22 -r1.23
*** events.js 2001/03/11 05:31:44 1.22
--- events.js 2001/03/14 17:58:51 1.23
***************
*** 4,8 ****
The DynAPI Distribution is distributed under the terms of the GNU LGPL license.
! */
DynEvent=function(type,src,target) {
this.type=type;
--- 4,8 ----
The DynAPI Distribution is distributed under the terms of the GNU LGPL license.
! */
DynEvent=function(type,src,target) {
this.type=type;
***************
*** 49,54 ****
var m = e.modifiers;
alt = (m==1 || m==3 || m==5 || m==7)?true:false;
! ctrl = (m==2 || m==3 || m==6 || m==7)?true:false;
! shft = (m==4 || m==5 || m==6 || m==7)?true:false;
}
else { }
--- 49,54 ----
var m = e.modifiers;
alt = (m==1 || m==3 || m==5 || m==7)?true:false;
! ctrl = (m==2 || m==3 || m==6 || m==7)?true:false;
! shft = (m==4 || m==5 || m==6 || m==7)?true:false;
}
else { }
***************
*** 79,83 ****
var elm=this.elm;
if (is.ns4) elm.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP | Event.CLICK |
Event.DBLCLICK);
!
elm.onmousedown=elm.onmouseup=elm.onmouseover=elm.onmouseout=elm.onclick=elm.ondblclick=DynLayer.prototype.EventMethod;
if (is.ie5) this.elm.oncontextmenu=function() {return false};
};
--- 79,91 ----
var elm=this.elm;
if (is.ns4) elm.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP | Event.CLICK |
Event.DBLCLICK);
! if (is.ns6){
!
this.doc.addEventListener("mousedown",DynLayer.prototype.EventMethod,false)
!
this.doc.addEventListener("mouseup",DynLayer.prototype.EventMethod,false)
!
this.doc.addEventListener("mouseover",DynLayer.prototype.EventMethod,false)
!
this.doc.addEventListener("mouseout",DynLayer.prototype.EventMethod,false)
! this.doc.addEventListener("click",DynLayer.prototype.EventMethod,false)
!
this.doc.addEventListener("dblclick",DynLayer.prototype.EventMethod,false)
! }
! else
elm.onmousedown=elm.onmouseup=elm.onmouseover=elm.onmouseout=elm.onclick=elm.ondblclick=DynLayer.prototype.EventMethod;
if (is.ie5) this.elm.oncontextmenu=function() {return false};
};
***************
*** 87,97 ****
var e=dyndoc.elm.event;
e.cancelBubble=true;
- if (e.type=="click" && DynAPI.wasDragging) {
- DynAPI.wasDragging=false;
- return true;
- }
if (e.type=="mouseout" && this.contains(e.toElement)) { return true };
if (e.type=="mouseover" && this.contains(e.fromElement)) { return true
};
}
if(is.ns6) {
// Need to find this IEs equivalent for NS6
--- 95,115 ----
var e=dyndoc.elm.event;
e.cancelBubble=true;
if (e.type=="mouseout" && this.contains(e.toElement)) { return true };
if (e.type=="mouseover" && this.contains(e.fromElement)) { return true
};
}
+ if (is.def) {
+ if (DynAPI.wasDragging) {
+ if (e.type=="click") {
+ // this is to catch double clicks in NS6, which is a
+bit double click happy.
+ setTimeout('DynAPI.wasDragging=false',300);
+ return true;
+ }
+ else if (e.type=="dblclick") {
+ DynAPI.wasDragging=false;
+ return true;
+ }
+ }
+ }
+ /*
if(is.ns6) {
// Need to find this IEs equivalent for NS6
***************
*** 99,105 ****
//if (e.type=="mouseover" && this.contains(e.fromElement) { return
true };
}
!
! if (is.ns6 && (e.target.tagName=="INPUT")) return true;
! var realsrc=is.ie?e.srcElement:is.ns6?e.currentTarget:e.target;
if (is.ie) while (!realsrc.lyrobj && realsrc.parentElement &&
realsrc.parentElement!=realsrc) realsrc=realsrc.parentElement;
--- 117,122 ----
//if (e.type=="mouseover" && this.contains(e.fromElement) { return
true };
}
! */
! var realsrc=is.ie?e.srcElement:e.target;
if (is.ie) while (!realsrc.lyrobj && realsrc.parentElement &&
realsrc.parentElement!=realsrc) realsrc=realsrc.parentElement;
***************
*** 139,143 ****
var orig=null;
! if (e && is.ns) {
orig=e.orig;
e.cancelBubble=false;
--- 156,160 ----
var orig=null;
! if (e && is.ns) {
orig=e.orig;
e.cancelBubble=false;
***************
*** 171,175 ****
this.hasEventListeners=true;
if (is.ns4) this.doc.captureEvents(Event.MOUSEMOVE | Event.MOUSEDOWN |
Event.MOUSEUP | Event.CLICK | Event.DBLCLICK);
!
this.doc.onmousemove=this.doc.onmousedown=this.doc.onmouseup=this.doc.onclick=this.doc.ondblclick=DynDocument.prototype.EventMethod;
if (is.ie5) this.doc.oncontextmenu=function(){ return false };
};
--- 188,198 ----
this.hasEventListeners=true;
if (is.ns4) this.doc.captureEvents(Event.MOUSEMOVE | Event.MOUSEDOWN |
Event.MOUSEUP | Event.CLICK | Event.DBLCLICK);
! if (is.ns6){
!
this.doc.addEventListener("mousemove",DynDocument.prototype.EventMethod,false)
!
this.doc.addEventListener("mousedown",DynDocument.prototype.EventMethod,false)
!
this.doc.addEventListener("mouseup",DynDocument.prototype.EventMethod,false)
!
this.doc.addEventListener("click",DynDocument.prototype.EventMethod,false)
!
this.doc.addEventListener("dblclick",DynDocument.prototype.EventMethod,false)
! } else
this.doc.onmousemove=this.doc.onmousedown=this.doc.onmouseup=this.doc.onclick=this.doc.ondblclick=DynDocument.prototype.EventMethod;
if (is.ie5) this.doc.oncontextmenu=function(){ return false };
};
***************
*** 185,189 ****
if (!this.hasEventListeners) return;
var orig=null;
! if (e && is.ns) {
orig=e.orig;
e.cancelBubble=false;
--- 208,212 ----
if (!this.hasEventListeners) return;
var orig=null;
! if (e && is.ns) {
orig=e.orig;
e.cancelBubble=false;
_______________________________________________
Dynapi-CVS mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-cvs