r101930 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101929‎ | r101930 | r101931 >
Date:00:21, 4 November 2011
Author:inez
Status:deferred
Tags:
Comment:
Minor changes
Modified paths:
  • /trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js
@@ -28,7 +28,6 @@
2929 this.cursor = {
3030 $: $( '<div class="es-surfaceView-cursor"></div>' ).appendTo( this.$ ),
3131 interval: null,
32 - offset: null,
3332 initialLeft: null,
3433 initialBias: false
3534 };
@@ -108,22 +107,24 @@
109108 this.$window.scroll( function() {
110109 surfaceView.dimensions.scrollTop = surfaceView.$window.scrollTop();
111110 } );
 111+
 112+ this.documentView.on('update', function() {alert(1);});
112113 };
113114
114115 es.SurfaceView.prototype.onMouseDown = function( e ) {
115116 if ( e.button === 0 /* left mouse button */ ) {
116117 this.mouse.selecting = true;
117118 this.selection.to = this.documentView.getOffsetFromEvent( e );
118 -
 119+
119120 if ( this.keyboard.keys.shift ) {
120 - this.drawSelection();
 121+ this.documentView.drawSelection( this.selection );
121122 this.hideCursor();
122123 } else {
123124 this.documentView.clearSelection();
124125 this.selection.from = this.selection.to;
125126 var position = es.Position.newFromEventPagePosition( e ),
126127 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 );
128129 }
129130 }
130131 if ( !this.$input.is( ':focus' ) ) {
@@ -295,25 +296,20 @@
296297 * @method
297298 * @param offset {Integer} Position to show the cursor at
298299 */
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+ });
318314
319315 // cursor blinking
320316 if ( this.cursor.interval ) {

Status & tagging log