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

Revision: 99467
Author:   inez
Date:     2011-10-11 09:31:34 +0000 (Tue, 11 Oct 2011)
Log Message:
-----------
Encapsulate cursor related variables into SurfaceView.cursor

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:17:36 UTC (rev 99466)
+++ trunk/parsers/wikidom/lib/synth/views/es.SurfaceView.js     2011-10-11 
09:31:34 UTC (rev 99467)
@@ -15,34 +15,34 @@
        // Interaction state
        this.width = null;
        this.mouse = {
-               'selecting': false,
-               'clicks': 0,
-               'clickDelay': 500,
-               'clickTimeout': null,
-               'clickPosition': null,
-               'hotSpotRadius': 1
+               selecting: false,
+               clicks: 0,
+               clickDelay: 500,
+               clickTimeout: null,
+               clickPosition: null,
+               hotSpotRadius: 1
        };
        this.keyboard = {
-               'selecting': false,
-               'cursorAnchor': null,
-               'keydownTimeout': null,
-               'keys': {
-                       'shift': false,
-                       'control': false,
-                       'command': false,
-                       'alt': false
+               selecting: false,
+               cursorAnchor: null,
+               keydownTimeout: null,
+               keys: {
+                       shift: false,
+                       control: false,
+                       command: false,
+                       alt: false
                }
        };
        this.selection = {
-               'from': 0,
-               'to': 0
+               from: 0,
+               to: 0
        };
+       this.cursor = {
+               $: $( '<div class="editSurface-cursor"></div>' ).appendTo( 
this.$ ),
+               interval: null,
+               offset: null
+       };
 
-       // Cursor
-       this.cursorOffset = null;
-       this.blinkInterval = null;
-       this.$cursor = $( '<div class="editSurface-cursor"></div>' ).appendTo( 
this.$ );
-       
        // References for use in closures
        var surfaceView = this,
                $document = $( document );
@@ -246,22 +246,23 @@
  */
 es.SurfaceView.prototype.showCursor = function( offset ) {
        if ( typeof offset !== 'undefined' ) {
+               this.cursor.offset = offset;
                var position = this.documentView.getRenderedPosition( offset );
-               this.$cursor.css( {
+               this.cursor.$.css( {
                        'left': position.left,
                        'top': position.top,
                        'height': position.bottom - position.top
                } ).show();
        } else {
-               this.$cursor.show();
+               this.cursor.$.show();
        }
 
-       if ( this.blinkInterval ) {
-               clearInterval( this.blinkInterval );
+       if ( this.cursor.interval ) {
+               clearInterval( this.cursor.interval );
        }
-       this.blinkInterval = setInterval( function( surface ) {
-               surface.$cursor.css( 'display' ) == 'block'
-                       ? surface.$cursor.hide() : surface.$cursor.show();
+       this.cursor.interval = setInterval( function( surface ) {
+               surface.cursor.$.css( 'display' ) == 'block'
+                       ? surface.cursor.$.hide() : surface.cursor.$.show();
        }, 500, this );
 };
 
@@ -271,10 +272,10 @@
  * @method
  */
 es.SurfaceView.prototype.hideCursor = function( position ) {
-       if( this.blinkInterval ) {
-               clearInterval( this.blinkInterval );
+       if( this.cursor.interval ) {
+               clearInterval( this.cursor.interval );
        }
-       this.$cursor.hide();
+       this.cursor.$.hide();
 };
 
 es.SurfaceView.prototype.drawSelection = function() {


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

Reply via email to