modal: Do not occlude when overlay is not enable. (#657)
This commit is contained in:
parent
806c6dffe8
commit
8edd80d5ee
2 changed files with 14 additions and 2 deletions
|
|
@ -166,6 +166,7 @@ pub struct ModalStory {
|
|||
model_show_close: bool,
|
||||
model_padding: bool,
|
||||
model_keyboard: bool,
|
||||
overlay_closeable: bool,
|
||||
}
|
||||
|
||||
impl super::Story for ModalStory {
|
||||
|
|
@ -288,6 +289,7 @@ impl ModalStory {
|
|||
model_show_close: true,
|
||||
model_padding: true,
|
||||
model_keyboard: true,
|
||||
overlay_closeable: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -360,6 +362,7 @@ impl ModalStory {
|
|||
let overlay = self.modal_overlay;
|
||||
let modal_show_close = self.model_show_close;
|
||||
let modal_padding = self.model_padding;
|
||||
let overlay_closeable = self.overlay_closeable;
|
||||
let input1 = self.input1.clone();
|
||||
let date_picker = self.date_picker.clone();
|
||||
let dropdown = self.dropdown.clone();
|
||||
|
|
@ -372,6 +375,7 @@ impl ModalStory {
|
|||
.overlay(overlay)
|
||||
.keyboard(keyboard)
|
||||
.show_close(modal_show_close)
|
||||
.overlay_closable(overlay_closeable)
|
||||
.when(!modal_padding, |this| this.p(px(0.)))
|
||||
.child(
|
||||
v_flex()
|
||||
|
|
@ -469,6 +473,15 @@ impl Render for ModalStory {
|
|||
cx.notify();
|
||||
})),
|
||||
)
|
||||
.child(
|
||||
Checkbox::new("overlay-closeable")
|
||||
.label("Overlay Closeable")
|
||||
.checked(self.overlay_closeable)
|
||||
.on_click(cx.listener(|view, _, _, cx| {
|
||||
view.overlay_closeable = !view.overlay_closeable;
|
||||
cx.notify();
|
||||
})),
|
||||
)
|
||||
.child(
|
||||
Checkbox::new("modal-show-close")
|
||||
.label("Model Close Button")
|
||||
|
|
|
|||
|
|
@ -357,11 +357,10 @@ impl RenderOnce for Modal {
|
|||
.snap_to_window()
|
||||
.child(
|
||||
div()
|
||||
.occlude()
|
||||
.w(view_size.width)
|
||||
.h(view_size.height)
|
||||
.when(self.overlay_visible, |this| {
|
||||
this.bg(overlay_color(self.overlay, window, cx))
|
||||
this.occlude().bg(overlay_color(self.overlay, window, cx))
|
||||
})
|
||||
.when(self.overlay_closable, |this| {
|
||||
this.on_mouse_down(MouseButton::Left, {
|
||||
|
|
|
|||
Loading…
Reference in a new issue