r104909 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104908‎ | r104909 | r104910 >
Date:22:50, 1 December 2011
Author:tparscal
Status:deferred
Tags:
Comment:
Update context menu on scroll and resize
Modified paths:
  • /trunk/extensions/VisualEditor/modules/es/views/es.ContextView.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/modules/es/views/es.ContextView.js
@@ -63,12 +63,6 @@
6464
6565 /* Methods */
6666
67 -es.ContextView.prototype.update = function() {
68 - if ( this.$icon.is( ':visible' ) ) {
69 - this.set();
70 - }
71 -};
72 -
7367 es.ContextView.prototype.set = function() {
7468
7569 this.$.removeClass(
Index: trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js
@@ -129,6 +129,11 @@
130130 } );
131131 $window.scroll( function() {
132132 _this.dimensions.scrollTop = $window.scrollTop();
 133+ if ( _this.currentSelection.from !== _this.currentSelection.to ) {
 134+ _this.contextView.set();
 135+ } else {
 136+ _this.contextView.clear();
 137+ }
133138 } );
134139
135140 // Configuration
@@ -187,11 +192,11 @@
188193 _this.clearInsertionAnnotations();
189194 _this.hideCursor();
190195 _this.documentView.drawSelection( _this.currentSelection );
191 - // Update the context icon position
192 - _this.contextView.update();
 196+ _this.contextView.set();
193197 } else {
194198 _this.showCursor();
195199 _this.documentView.clearSelection( _this.currentSelection );
 200+ _this.contextView.clear();
196201 }
197202 _this.updateSelectionTimeout = undefined;
198203 }
@@ -270,8 +275,6 @@
271276 this.cursor.initialLeft = null;
272277 // Apply new selection
273278 this.model.select( selection );
274 - // Hide the context
275 - this.contextView.clear();
276279 }
277280 // If the inut isn't already focused, focus it and select it's contents
278281 if ( !this.$input.is( ':focus' ) ) {
@@ -332,8 +335,6 @@
333336 if ( e.button === 0 ) { // left mouse button
334337 this.mouse.selectingMode = this.mouse.selectedRange = null;
335338 this.model.select( this.currentSelection );
336 - // Show the context
337 - this.contextView.set();
338339 }
339340 };
340341

Status & tagging log