mirror of
https://github.com/Hopiu/bootstrap.git
synced 2026-05-15 07:33:09 +00:00
Tweak methods
Name them to be more descriptive and have agnostic functionality
This commit is contained in:
parent
79e01c3bad
commit
fc33ce4b46
1 changed files with 8 additions and 8 deletions
|
|
@ -120,8 +120,8 @@ class Modal extends BaseComponent {
|
||||||
|
|
||||||
this._adjustDialog()
|
this._adjustDialog()
|
||||||
|
|
||||||
this._setEscapeEvent()
|
this._toggleEscapeEventListener(true)
|
||||||
this._setResizeEvent()
|
this._toggleResizeEventListener(true)
|
||||||
|
|
||||||
EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, () => {
|
EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, () => {
|
||||||
EventHandler.one(this._element, EVENT_MOUSEUP_DISMISS, event => {
|
EventHandler.one(this._element, EVENT_MOUSEUP_DISMISS, event => {
|
||||||
|
|
@ -148,8 +148,8 @@ class Modal extends BaseComponent {
|
||||||
this._isShown = false
|
this._isShown = false
|
||||||
this._isTransitioning = true
|
this._isTransitioning = true
|
||||||
|
|
||||||
this._setEscapeEvent()
|
this._toggleEscapeEventListener(false)
|
||||||
this._setResizeEvent()
|
this._toggleResizeEventListener(false)
|
||||||
|
|
||||||
this._focustrap.deactivate()
|
this._focustrap.deactivate()
|
||||||
|
|
||||||
|
|
@ -234,8 +234,8 @@ class Modal extends BaseComponent {
|
||||||
this._queueCallback(transitionComplete, this._dialog, this._isAnimated())
|
this._queueCallback(transitionComplete, this._dialog, this._isAnimated())
|
||||||
}
|
}
|
||||||
|
|
||||||
_setEscapeEvent() {
|
_toggleEscapeEventListener(enable) {
|
||||||
if (!this._isShown) {
|
if (!enable) {
|
||||||
EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS)
|
EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -255,8 +255,8 @@ class Modal extends BaseComponent {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
_setResizeEvent() {
|
_toggleResizeEventListener(enable) {
|
||||||
if (this._isShown) {
|
if (enable) {
|
||||||
EventHandler.on(window, EVENT_RESIZE, () => this._adjustDialog())
|
EventHandler.on(window, EVENT_RESIZE, () => this._adjustDialog())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue