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

Modified Files:
        keyevents.js 
Log Message:
new keyevents from Henrik
should make ctrl+alt work the same in NS and IE (NS6 has problems with keyevents in 
this version)

Index: keyevents.js
===================================================================
RCS file: /cvsroot/dynapi/dynapi/src/lib/dynapi/ext/keyevents.js,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** keyevents.js        2001/01/06 23:57:04     1.1
--- keyevents.js        2001/02/17 14:27:18     1.2
***************
*** 9,15 ****
  */
  
! KeyEvent=function() {
!       
! };
  
  KeyEvent.prototype.getSource=function() { return this.src; };
--- 9,13 ----
  */
  
! KeyEvent=function() { };
  
  KeyEvent.prototype.getSource=function() { return this.src; };
***************
*** 17,40 ****
  KeyEvent.prototype.setEvent=function(src,e) {
        this.src=src;
!     this.which=(is.ns4)?e.which:e.keyCode;
!       this.curKey = String.fromCharCode(this.which).toLowerCase();
!       var alt,ctrl,shft;
!       if (is.ie){
!               alt=(e.altKey||e.altLeft||e.keyCode==18)?true:false;
!               ctrl=(e.ctrlKey||e.ctrlLeft||e.keyCode==17)?true:false;
!               shft=(e.shiftKey||e.shiftLeft||e.keyCode==16)?true:false;
!       }
!       if (is.ns){
!               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;
!     }
!       this.controlKey=alt; //this doesn't work properly but on keypress
        this.orig=e;
        return this;
  };
  
! KeyEvent.prototype.getKey=function() { return this.curKey; };
  
  DynDocument.prototype.keys=new KeyEvent();
--- 15,28 ----
  KeyEvent.prototype.setEvent=function(src,e) {
        this.src=src;
!         this.which=(is.ns4)?e.which:e.keyCode;
!       var curKey = String.fromCharCode(this.which).toLowerCase();
!       if (((curKey>='a')&&(curKey<='z'))||((curKey>='0')&&(curKey<='9'))) 
this.charKey=curKey;
!       this.ctrlKey=(is.ns4)?(e.modifiers & 
Event.CONTROL_MASK):(e.ctrlKey||e.ctrlLeft||e.keyCode==17);
!       this.shiftKey=(is.ns4)?(e.modifiers & 
Event.SHIFT_MASK):(e.shiftKey||e.shiftLeft||e.keyCode==16);
        this.orig=e;
        return this;
  };
  
! KeyEvent.prototype.getKey=function() {return this.charKey};
  
  DynDocument.prototype.keys=new KeyEvent();
***************
*** 55,59 ****
                var evt=this.lyrobj.keys;
                evt.setEvent(src,e);
!         src.invokeEvent(e.type,evt);
        }
! };
\ No newline at end of file
--- 43,47 ----
                var evt=this.lyrobj.keys;
                evt.setEvent(src,e);
!               src.invokeEvent(e.type,evt);
        }
! }
\ No newline at end of file


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

Reply via email to