modal: revert modal containment except in modals/tabs

This commit is contained in:
bordun 2020-04-19 20:31:46 +02:00
parent 29ad18de8c
commit 0be90dd155
2 changed files with 22 additions and 2 deletions

View file

@ -59,7 +59,7 @@
- plots/sliders/pads: reversed `logScale` behavior to match standard implementations; can be either `false` (disabled), `true` (logarithmic scale) or `number` (manual log scale, negative for exponential scale)
- visualizer: added `framerate` property
- menu: always centered menu
- modal: modals can't overflow their parents' (modal, tab, panel) boundaries
- modal: modals can't overflow parent modal/tab boundaries
- input: removed `vertical`
- pads, range: when `touchAddress` is set, one message per touched point is sent, in addition to the former touch state message
- eq: removed `logScaleX` property, always draw logarithmic frequency response

View file

@ -144,10 +144,11 @@ class Modal extends Panel {
this.popup.classList.toggle('show', this.value)
this.container.classList.toggle('on', this.value)
// this.setVisibility()
this.bindEscKey(this.value)
if (this.init) this.fixParents()
if (this.value) {
resize.check(this.widget, true)
}
@ -157,6 +158,25 @@ class Modal extends Panel {
if (options.sync) this.changed(options)
}
fixParents() {
var parent = this.parent,
scrollFixed = false
while (parent && parent.props && !parent.getProp('type').match(/modal|tab|root/)) {
// stacking
parent.container.style.zIndex = this.value ? 'initial' : ''
parent.container.style.contain = this.value ? 'style size' : ''
parent = parent.parent
}
this.container.style.contain = this.value ? 'style size' : ''
}
bindEscKey(set) {