http://www.mediawiki.org/wiki/Special:Code/MediaWiki/99468

Revision: 99468
Author:   inez
Date:     2011-10-11 09:54:04 +0000 (Tue, 11 Oct 2011)
Log Message:
-----------
Basic support for moving cursor left and right

Modified Paths:
--------------
    trunk/parsers/wikidom/lib/synth/views/es.SurfaceView.js

Modified: trunk/parsers/wikidom/lib/synth/views/es.SurfaceView.js
===================================================================
--- trunk/parsers/wikidom/lib/synth/views/es.SurfaceView.js     2011-10-11 
09:31:34 UTC (rev 99467)
+++ trunk/parsers/wikidom/lib/synth/views/es.SurfaceView.js     2011-10-11 
09:54:04 UTC (rev 99468)
@@ -122,12 +122,16 @@
                case 35: // End
                        break;
                case 37: // Left arrow
+                       this.moveCursor( 'left' );
                        break;
                case 38: // Up arrow
+                       this.moveCursor( 'up' );
                        break;
                case 39: // Right arrow
+                       this.moveCursor( 'right' );
                        break;
                case 40: // Down arrow
+                       this.moveCursor( 'down' );
                        break;
                case 8: // Backspace
                        break;
@@ -156,18 +160,6 @@
                case 91: // Command
                        this.keyboard.keys.command = false;
                        break;
-               case 37: // Left arrow
-                       this.moveCursor( 'left' );
-                       break;
-               case 38: // Up arrow
-                       this.moveCursor( 'up' );
-                       break;
-               case 39: // Right arrow
-                       this.moveCursor( 'right' );
-                       break;
-               case 40: // Down arrow
-                       this.moveCursor( 'down' );
-                       break;
                default:
                        break;
        }
@@ -278,6 +270,19 @@
        this.cursor.$.hide();
 };
 
+es.SurfaceView.prototype.moveCursor = function( direction ) {
+       switch ( direction ) {
+               case 'left':
+                       this.showCursor( this.cursor.offset - 1 );
+                       break;
+               case 'right':
+                       this.showCursor( this.cursor.offset + 1 );
+                       break;
+               default:
+                       break;
+       }
+};
+
 es.SurfaceView.prototype.drawSelection = function() {
        this.documentView.drawSelection( new es.Range( this.selection.from, 
this.selection.to ) );
        if ( this.selection.from !== this.selection.to ) {


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to