modal: add relative geometry property

This commit is contained in:
bordun 2020-11-15 11:26:23 +01:00
parent 0cd3db8583
commit c893241313
4 changed files with 20 additions and 2 deletions

View file

@ -25,6 +25,8 @@ As of this version, packages except the `node` package are bundled with a midi b
- widgets
- keyboard: add `velocity` property (allows mapping the touch coordinates between `off` (top) and `on` (bottom))
- input: add `validation` property (allows defining a regular expression that the value must match)
- modal: add `relative` geometry property
- midi
- accept sending sysex strings without spaces between the bytes
- load prebuilt midi binary on 64bit linux/windows/osx

View file

@ -21,6 +21,7 @@ class Modal extends Panel {
},
geometry: {
_separator_modal_geometry: 'Modal geometry',
relative: {type: 'boolean', value: false, help: 'Set to `true` to make the modal\'s position and size relative to the button\'s.'},
popupWidth: {type: 'number|percentage', value: '80%', help: 'Modal popup\'s size'},
popupHeight: {type: 'number|percentage', value: '80%', help: 'Modal popup\'s size'},
popupLeft: {type: 'number|percentage', value: 'auto', help: 'Modal popup\'s position'},
@ -114,7 +115,7 @@ class Modal extends Panel {
this.init = false
this.labelChange = true
this.container.classList.toggle('relative', this.getProp('relative'))
this.popupContent.classList.add('layout-' + this.getProp('layout'))
this.label = html`<label></label>`

View file

@ -17,7 +17,7 @@ $padding: 8rem;
bottom:0;
background: black;
opacity: .3;
pointer-events: none;
// pointer-events: none;
// animation: popup-backdrop-fade-in .25s forwards;
}

View file

@ -515,6 +515,21 @@
}
&.relative {
> .popup {
left: auto;
right: auto;
top: auto;
bottom: auto;
position: absolute;
width: var(--width, 100%);
height: var(--height, 100%);
margin-top: calc(-1 * var(--widget-spacing));
margin-left: calc(-1 * var(--widget-spacing));
padding: var(--widget-spacing);
}
}
}
.modal-breakout {