Make animation optional for Modal.setVisible (#903)
This commit is contained in:
parent
591253d783
commit
6799b87cc6
@ -41,7 +41,7 @@ class Modal extends EventDispatcher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setVisible(value) {
|
setVisible(value, animate=true) {
|
||||||
value = !!value;
|
value = !!value;
|
||||||
if (this._useJqueryModal()) {
|
if (this._useJqueryModal()) {
|
||||||
this._getWrappedNode().modal(value ? 'show' : 'hide');
|
this._getWrappedNode().modal(value ? 'show' : 'hide');
|
||||||
@ -55,19 +55,21 @@ class Modal extends EventDispatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
classList.add(this._openingClassName);
|
if (animate) { classList.add(this._openingClassName); }
|
||||||
|
classList.remove(this._closingClassName);
|
||||||
getComputedStyle(this._node).getPropertyValue('display'); // Force update of CSS display property, allowing animation
|
getComputedStyle(this._node).getPropertyValue('display'); // Force update of CSS display property, allowing animation
|
||||||
classList.add(this._visibleClassName);
|
classList.add(this._visibleClassName);
|
||||||
classList.remove(this._closingClassName);
|
if (animate) { classList.remove(this._openingClassName); }
|
||||||
classList.remove(this._openingClassName);
|
|
||||||
this._node.focus();
|
this._node.focus();
|
||||||
} else {
|
} else {
|
||||||
classList.add(this._closingClassName);
|
if (animate) { classList.add(this._closingClassName); }
|
||||||
classList.remove(this._visibleClassName);
|
classList.remove(this._visibleClassName);
|
||||||
this._closeTimer = setTimeout(() => {
|
if (animate) {
|
||||||
this._closeTimer = null;
|
this._closeTimer = setTimeout(() => {
|
||||||
classList.remove(this._closingClassName);
|
this._closeTimer = null;
|
||||||
}, this._closingAnimationDuration);
|
classList.remove(this._closingClassName);
|
||||||
|
}, this._closingAnimationDuration);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user