Index: trunk/extensions/VisualEditor/modules/es/views/es.ContextView.js |
— | — | @@ -63,12 +63,6 @@ |
64 | 64 | |
65 | 65 | /* Methods */ |
66 | 66 | |
67 | | -es.ContextView.prototype.update = function() { |
68 | | - if ( this.$icon.is( ':visible' ) ) { |
69 | | - this.set(); |
70 | | - } |
71 | | -}; |
72 | | - |
73 | 67 | es.ContextView.prototype.set = function() { |
74 | 68 | |
75 | 69 | this.$.removeClass( |
Index: trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js |
— | — | @@ -129,6 +129,11 @@ |
130 | 130 | } ); |
131 | 131 | $window.scroll( function() { |
132 | 132 | _this.dimensions.scrollTop = $window.scrollTop(); |
| 133 | + if ( _this.currentSelection.from !== _this.currentSelection.to ) { |
| 134 | + _this.contextView.set(); |
| 135 | + } else { |
| 136 | + _this.contextView.clear(); |
| 137 | + } |
133 | 138 | } ); |
134 | 139 | |
135 | 140 | // Configuration |
— | — | @@ -187,11 +192,11 @@ |
188 | 193 | _this.clearInsertionAnnotations(); |
189 | 194 | _this.hideCursor(); |
190 | 195 | _this.documentView.drawSelection( _this.currentSelection ); |
191 | | - // Update the context icon position |
192 | | - _this.contextView.update(); |
| 196 | + _this.contextView.set(); |
193 | 197 | } else { |
194 | 198 | _this.showCursor(); |
195 | 199 | _this.documentView.clearSelection( _this.currentSelection ); |
| 200 | + _this.contextView.clear(); |
196 | 201 | } |
197 | 202 | _this.updateSelectionTimeout = undefined; |
198 | 203 | } |
— | — | @@ -270,8 +275,6 @@ |
271 | 276 | this.cursor.initialLeft = null; |
272 | 277 | // Apply new selection |
273 | 278 | this.model.select( selection ); |
274 | | - // Hide the context |
275 | | - this.contextView.clear(); |
276 | 279 | } |
277 | 280 | // If the inut isn't already focused, focus it and select it's contents |
278 | 281 | if ( !this.$input.is( ':focus' ) ) { |
— | — | @@ -332,8 +335,6 @@ |
333 | 336 | if ( e.button === 0 ) { // left mouse button |
334 | 337 | this.mouse.selectingMode = this.mouse.selectedRange = null; |
335 | 338 | this.model.select( this.currentSelection ); |
336 | | - // Show the context |
337 | | - this.contextView.set(); |
338 | 339 | } |
339 | 340 | }; |
340 | 341 | |