[OpenLayers-Trac] [OpenLayers] #1108: Modify feature example problems with IE. keyboard handler broken in IE

OpenLayers trac at openlayers.org
Fri Feb 29 09:26:10 EST 2008


#1108: Modify feature example problems with IE. keyboard handler broken in IE
-------------------------------+--------------------------------------------
  Reporter:  openlayers        |       Owner:     
      Type:  bug               |      Status:  new
  Priority:  minor             |   Milestone:     
 Component:  Handler.Keyboard  |     Version:  2.5
Resolution:                    |    Keywords:     
     State:                    |  
-------------------------------+--------------------------------------------
Changes (by openlayers):

  * state:  =>

Comment:

 As the ticket suggests changing "window" to "document" is a step in this
 process, but there is a bit more involved to get it to work. The following
 code may not be ideal, but it has gotten around the issue so that my non-
 firefox users can successfully delete individual points from a polygon.

 Handler/Keyboard.js

     /**
      * Method: handleKeyEvent
      */
     handleKeyEvent: function (evt) {
         if (!evt.charCode) {
             evt.charCode = 0;
         }

         // Non-Firefox Browser Hack for "d" key
         if ((!evt.charCode) && (evt.keyCode == 68)
             && evt.type == 'keydown'
             && navigator.appVersion.match(/Konqueror|Safari|KHTML|MSIE/))
 {
             evt.keyCode = 0;
             evt.charCode = 100;
         }

         if (this.checkModifiers(evt)) {
             // Non-Firefox browsers (Internet Explodinator, Safari, Opera)
 do not support keypress events
             if (evt.type == 'keydown'
                 &&
 navigator.appVersion.match(/Konqueror|Safari|KHTML|MSIE/)) {
                 this.callback('keypress', [evt.charCode || evt.keyCode]);
             } else {
                 this.callback(evt.type, [evt.charCode || evt.keyCode]);
             }
         }
     },

-- 
Ticket URL: <http://trac.openlayers.org/ticket/1108#comment:1>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list