Index: trunk/parsers/wikidom/lib/synth/views/es.SurfaceView.js |
— | — | @@ -217,11 +217,7 @@ |
218 | 218 | position = this.documentView.getRenderedPosition( contentOffset ); |
219 | 219 | |
220 | 220 | if ( position !== null ) { |
221 | | - this.$cursor.css( { |
222 | | - 'left': position.left, |
223 | | - 'top': position.top, |
224 | | - 'height': position.bottom - position.top |
225 | | - } ).show(); |
| 221 | + this.showCursor( position ); |
226 | 222 | } |
227 | 223 | |
228 | 224 | /* |
— | — | @@ -279,4 +275,31 @@ |
280 | 276 | |
281 | 277 | es.SurfaceView.prototype.setInputContent = function( content ) { |
282 | 278 | // TODO: Set the value of this.$input |
| 279 | +}; |
| 280 | + |
| 281 | +es.SurfaceView.prototype.showCursor = function( position ) { |
| 282 | + if ( position ) { |
| 283 | + this.$cursor.css( { |
| 284 | + 'left': position.left, |
| 285 | + 'top': position.top, |
| 286 | + 'height': position.bottom - position.top |
| 287 | + } ).show(); |
| 288 | + } else { |
| 289 | + this.$cursor.show(); |
| 290 | + } |
| 291 | + |
| 292 | + if ( this.blinkInterval ) { |
| 293 | + clearInterval( this.blinkInterval ); |
| 294 | + } |
| 295 | + this.blinkInterval = setInterval( function( surface ) { |
| 296 | + surface.$cursor.css( 'display' ) == 'block' |
| 297 | + ? surface.$cursor.hide() : surface.$cursor.show(); |
| 298 | + }, 500, this ); |
| 299 | +}; |
| 300 | + |
| 301 | +es.SurfaceView.prototype.hideCursor = function( position ) { |
| 302 | + if( this.blinkInterval ) { |
| 303 | + clearInterval( this.blinkInterval ); |
| 304 | + } |
| 305 | + this.$cursor.hide(); |
283 | 306 | }; |
\ No newline at end of file |