[FIX] web_editor: fix overlay missing after animation

Before this commit, with some animations (e.g. Bounce In-Left) the
overlay of the animated element or the overlay of selected element
inside it no longer reappeared after the animation.

task-2630112

closes odoo/odoo#75444

X-original-commit: fb98430b1cdbc63896d152b39bcf23c0f2241cb4
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
Benjamin Vray
2021-08-23 10:51:32 +00:00
committed by qsm-odoo
parent fd1007749e
commit ba371a0d9b
@@ -226,7 +226,11 @@ var SnippetEditor = Widget.extend({
}
var _animationsCount = 0;
var postAnimationCover = _.throttle(() => this.cover(), 100);
var postAnimationCover = _.throttle(() => {
this.trigger_up('cover_update', {
overlayVisible: true,
});
}, 100);
this.$target.on('transitionstart.snippet_editor, animationstart.snippet_editor', () => {
// We cannot rely on the fact each transition/animation start will
// trigger a transition/animation end as the element may be removed
@@ -2590,9 +2594,13 @@ var SnippetsMenu = Widget.extend({
* Called when the overlay dimensions/positions should be recomputed.
*
* @private
* @param {OdooEvent} ev
*/
_onOverlaysCoverUpdate: function () {
_onOverlaysCoverUpdate: function (ev) {
this.snippetEditors.forEach(editor => {
if (ev.data.overlayVisible) {
editor.toggleOverlayVisibility(true);
}
editor.cover();
});
},