Index: trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js |
— | — | @@ -28,7 +28,6 @@ |
29 | 29 | this.cursor = { |
30 | 30 | $: $( '<div class="es-surfaceView-cursor"></div>' ).appendTo( this.$ ), |
31 | 31 | interval: null, |
32 | | - offset: null, |
33 | 32 | initialLeft: null, |
34 | 33 | initialBias: false |
35 | 34 | }; |
— | — | @@ -108,22 +107,24 @@ |
109 | 108 | this.$window.scroll( function() { |
110 | 109 | surfaceView.dimensions.scrollTop = surfaceView.$window.scrollTop(); |
111 | 110 | } ); |
| 111 | + |
| 112 | + this.documentView.on('update', function() {alert(1);}); |
112 | 113 | }; |
113 | 114 | |
114 | 115 | es.SurfaceView.prototype.onMouseDown = function( e ) { |
115 | 116 | if ( e.button === 0 /* left mouse button */ ) { |
116 | 117 | this.mouse.selecting = true; |
117 | 118 | this.selection.to = this.documentView.getOffsetFromEvent( e ); |
118 | | - |
| 119 | + |
119 | 120 | if ( this.keyboard.keys.shift ) { |
120 | | - this.drawSelection(); |
| 121 | + this.documentView.drawSelection( this.selection ); |
121 | 122 | this.hideCursor(); |
122 | 123 | } else { |
123 | 124 | this.documentView.clearSelection(); |
124 | 125 | this.selection.from = this.selection.to; |
125 | 126 | var position = es.Position.newFromEventPagePosition( e ), |
126 | 127 | nodeView = this.documentView.getNodeFromOffset( this.selection.to, false ); |
127 | | - this.showCursor( this.selection.to, position.left > nodeView.$.offset().left ); |
| 128 | + this.showCursor( position.left > nodeView.$.offset().left ); |
128 | 129 | } |
129 | 130 | } |
130 | 131 | if ( !this.$input.is( ':focus' ) ) { |
— | — | @@ -295,25 +296,20 @@ |
296 | 297 | * @method |
297 | 298 | * @param offset {Integer} Position to show the cursor at |
298 | 299 | */ |
299 | | -es.SurfaceView.prototype.showCursor = function( offset, leftBias ) { |
300 | | - if ( typeof offset !== 'undefined' ) { |
301 | | - this.cursor.initialBias = leftBias ? true : false; |
302 | | - this.selection.to = offset; |
303 | | - var position = this.documentView.getRenderedPositionFromOffset( |
304 | | - this.selection.to, leftBias |
305 | | - ); |
306 | | - this.cursor.$.css( { |
307 | | - 'left': position.left, |
308 | | - 'top': position.top, |
309 | | - 'height': position.bottom - position.top |
310 | | - } ); |
311 | | - this.$input.css({ |
312 | | - 'top': position.top, |
313 | | - 'height': position.bottom - position.top |
314 | | - }); |
315 | | - } |
316 | | - |
317 | | - this.cursor.$.show(); |
| 300 | +es.SurfaceView.prototype.showCursor = function( leftBias ) { |
| 301 | + this.cursor.initialBias = leftBias ? true : false; |
| 302 | + var position = this.documentView.getRenderedPositionFromOffset( |
| 303 | + this.selection.to, leftBias |
| 304 | + ); |
| 305 | + this.cursor.$.css( { |
| 306 | + 'left': position.left, |
| 307 | + 'top': position.top, |
| 308 | + 'height': position.bottom - position.top |
| 309 | + } ).show(); |
| 310 | + this.$input.css({ |
| 311 | + 'top': position.top, |
| 312 | + 'height': position.bottom - position.top |
| 313 | + }); |
318 | 314 | |
319 | 315 | // cursor blinking |
320 | 316 | if ( this.cursor.interval ) { |