Bug #5329
closedWStackedWidget can fail on animated transition after update
0%
Description
With github Wt 3.3.6-6-gbadb151, a WStackedWidget that uses fade (or other?) animations can fail to transition when the WAnimation type is changed after initialization.
The attached example demonstrates the issue by adding a Widget and changing the animation when a button is pressed. A partial capture of the output (from Chromium) looks like this:
01 var j7=Wt3_3_6.$('o2b');
02 j7.className='Wt-stack Wt-animated';
03 var j8=document.createElement('div');j7.appendChild(j8);
04 j8.setAttribute('id', 'o2e');
05 j8.style.overflowX='visible';
06 j8.style.overflowY='auto';
07 j8.style.backgroundColor='rgb(255,255,0)';
08 j8.style.display='none';
09 Wt3_3_6.setHtml(j8,'<span id="o2f"><i class="fa fa-smile-o fa-5x fa-fw"></i>...OMITTED...';
10 Wt3_3_6.animateDisplay('o2e',256,1,3000,'');
11
12 Wt3_3_6.$('o2b').wtAnimateChild=$('#o2b').data('obj').animateChild;
13 Wt3_3_6.$('o2b').wtAutoReverse=false;
14 $('#o2b').data('obj').adjustScroll(Wt3_3_6.$('o2d'));
15
16 var j9=Wt3_3_6.$('o2d');
17 Wt3_3_6.animateDisplay('o2d',256,1,3000,'none');
I believe the issue may be related to the sequence of the above JS statements. If lines 12-14 are moved in front of line 10, the transition appears to work correctly.
I suspect that the sequence issue occurs because child JS is generally output before parent JS. In this case, though, the setJavaScriptMember calls in WStackedWidget::loadAnimateJS() (responsible for lines 12-13) are expected to be executed prior to the child JS so that wtAnimateChild is available when line 10 is reached.
NOTE: This issue was encountered in attempting to workaround issue #5314. If the JS is manually re-ordered as described above, the issue described in #5314 is visible.
Files
Updated by Roel Standaert over 7 years ago
- Status changed from New to InProgress
- Assignee set to André Jacobs
Updated by André Jacobs over 7 years ago
- Status changed from InProgress to Feedback
This indeed does not work. After further investigation we concluded that this is an edge case that will not be supported by Wt, however it can be made to work by calling WApplication::processEvents before setCurrentIndex().
This information has been added to the documentation of WStackedWidget::setTransitionAnimation.
Updated by André Jacobs over 7 years ago
- Status changed from Feedback to Implemented @Emweb
Updated by Bruce Toll over 7 years ago
Thanks for the analysis and feedback. I agree that this is an edge case and very much appreciate the provided workaround to call processEvents.
Updated by Roel Standaert over 7 years ago
- Status changed from Implemented @Emweb to Resolved
Updated by Roel Standaert about 7 years ago
- Status changed from Resolved to Closed