Added noBackdropClose to prop create dialog
This commit is contained in:
@@ -155,7 +155,7 @@
|
|||||||
text
|
text
|
||||||
@click="$store.dispatch('popDialogStack')"
|
@click="$store.dispatch('popDialogStack')"
|
||||||
>
|
>
|
||||||
Cancel
|
{{ tab === 1 ? "Discard" : "Cancel" }}
|
||||||
</v-btn>
|
</v-btn>
|
||||||
<v-spacer />
|
<v-spacer />
|
||||||
<v-btn
|
<v-btn
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
<transition-group
|
<transition-group
|
||||||
name="dialog-list"
|
name="dialog-list"
|
||||||
class="dialog-sizer"
|
class="dialog-sizer"
|
||||||
|
:class="{shake}"
|
||||||
tag="div"
|
tag="div"
|
||||||
@enter="enter"
|
@enter="enter"
|
||||||
@leave="leave"
|
@leave="leave"
|
||||||
@@ -55,6 +56,7 @@
|
|||||||
},
|
},
|
||||||
data(){return {
|
data(){return {
|
||||||
hiddenElements: [],
|
hiddenElements: [],
|
||||||
|
shake: false,
|
||||||
}},
|
}},
|
||||||
computed: {
|
computed: {
|
||||||
dialogs(){
|
dialogs(){
|
||||||
@@ -80,8 +82,25 @@
|
|||||||
popDialogStack(result){
|
popDialogStack(result){
|
||||||
this.$store.dispatch('popDialogStack', result);
|
this.$store.dispatch('popDialogStack', result);
|
||||||
},
|
},
|
||||||
backdropClicked(event){
|
backdropClicked(event) {
|
||||||
if (event.target === event.currentTarget) this.popDialogStack();
|
// If the target was not the backdrop, ignore
|
||||||
|
if (event.target !== event.currentTarget) return;
|
||||||
|
|
||||||
|
// If the top dialog can't be closed with the backdrop, shake shake
|
||||||
|
const topDialog = this.dialogs[this.dialogs.length - 1];
|
||||||
|
if (topDialog.data.noBackdropClose) {
|
||||||
|
this.shakeTopDialog();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise close the top dialog
|
||||||
|
this.popDialogStack();
|
||||||
|
},
|
||||||
|
shakeTopDialog() {
|
||||||
|
this.shake = false;
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
this.shake = true;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
getDialogStyle(index){
|
getDialogStyle(index){
|
||||||
const length = this.$store.state.dialogStack.dialogs.length;
|
const length = this.$store.state.dialogStack.dialogs.length;
|
||||||
@@ -240,12 +259,23 @@
|
|||||||
z-index: 7;
|
z-index: 7;
|
||||||
flex: initial;
|
flex: initial;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dialog-sizer.shake {
|
||||||
|
animation: shake 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes shake {
|
||||||
|
0% { transform: scale(1); }
|
||||||
|
50% { transform: scale(1.02); }
|
||||||
|
100% { transform: scale(1); }
|
||||||
|
}
|
||||||
|
|
||||||
/* sm */
|
/* sm */
|
||||||
@media only screen and (max-width: 960px) and (min-width: 601px){
|
@media only screen and (max-width: 960px) and (min-width: 601px){
|
||||||
.dialog-sizer {
|
.dialog-sizer {
|
||||||
width: calc(100% - 32px);
|
width: calc(100% - 32px);
|
||||||
height: calc(100% - 32px);
|
height: calc(100% - 32px);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* xs */
|
/* xs */
|
||||||
@media only screen and (max-width: 600px) {
|
@media only screen and (max-width: 600px) {
|
||||||
|
|||||||
@@ -306,6 +306,7 @@ export default {
|
|||||||
creatureId: this.creatureId,
|
creatureId: this.creatureId,
|
||||||
hideLibraryTab: true,
|
hideLibraryTab: true,
|
||||||
suggestedType,
|
suggestedType,
|
||||||
|
noBackdropClose: true,
|
||||||
},
|
},
|
||||||
callback(result){
|
callback(result){
|
||||||
if (!result) return;
|
if (!result) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user