@@ -239,11 +239,8 @@ define(function (require, exports, module) {
239
239
// compute scrollbars
240
240
this . $relatedContainer . height ( this . $related . height ( ) ) ;
241
241
242
- // Update the position of the selected marker now that we're laid out, and then
243
- // set it to animate for future updates.
244
- this . _updateSelectedMarker ( ) . done ( function ( ) {
245
- self . $selectedMarker . addClass ( "animate" ) ;
246
- } ) ;
242
+ // Set the initial position of the selected marker now that we're laid out.
243
+ this . _updateSelectedMarker ( false ) ;
247
244
248
245
// Call super
249
246
MultiRangeInlineEditor . prototype . parentClass . onAdded . apply ( this , arguments ) ;
@@ -316,7 +313,7 @@ define(function (require, exports, module) {
316
313
// ensureVisibility is set to false because we don't want to scroll the main editor when the user selects a view
317
314
this . sizeInlineWidgetToContents ( true , false ) ;
318
315
319
- this . _updateSelectedMarker ( ) ;
316
+ this . _updateSelectedMarker ( true ) ;
320
317
}
321
318
322
319
this . _updateCommands ( ) ;
@@ -378,7 +375,7 @@ define(function (require, exports, module) {
378
375
// If the selected range is below, we need to update the index
379
376
if ( index < this . _selectedRangeIndex ) {
380
377
this . _selectedRangeIndex -- ;
381
- this . _updateSelectedMarker ( ) ;
378
+ this . _updateSelectedMarker ( true ) ;
382
379
}
383
380
384
381
if ( this . _ranges . length === 1 ) {
@@ -434,7 +431,7 @@ define(function (require, exports, module) {
434
431
this . _updateCommands ( ) ;
435
432
} ;
436
433
437
- MultiRangeInlineEditor . prototype . _updateSelectedMarker = function ( ) {
434
+ MultiRangeInlineEditor . prototype . _updateSelectedMarker = function ( animate ) {
438
435
if ( this . _selectedRangeIndex < 0 ) {
439
436
return new $ . Deferred ( ) . resolve ( ) . promise ( ) ;
440
437
}
@@ -449,8 +446,10 @@ define(function (require, exports, module) {
449
446
itemTop = $rangeItem . position ( ) . top ,
450
447
scrollTop = self . $relatedContainer . scrollTop ( ) ;
451
448
452
- self . $selectedMarker . css ( "top" , itemTop ) ;
453
- self . $selectedMarker . height ( $rangeItem . outerHeight ( ) ) ;
449
+ self . $selectedMarker
450
+ . toggleClass ( "animate" , animate )
451
+ . css ( "top" , itemTop )
452
+ . height ( $rangeItem . outerHeight ( ) ) ;
454
453
455
454
if ( containerHeight <= 0 ) {
456
455
return ;
@@ -614,6 +613,15 @@ define(function (require, exports, module) {
614
613
}
615
614
} ;
616
615
616
+ /**
617
+ * Called when the editor containing the inline is made visible. Updates UI based on
618
+ * state that might have changed while the editor was hidden.
619
+ */
620
+ MultiRangeInlineEditor . prototype . onParentShown = function ( ) {
621
+ MultiRangeInlineEditor . prototype . parentClass . onParentShown . apply ( this , arguments ) ;
622
+ this . _updateSelectedMarker ( false ) ;
623
+ } ;
624
+
617
625
/**
618
626
* Refreshes the height of the inline editor and all child editors.
619
627
* @override
0 commit comments