From efe89e07521f2e519fe8c5a4898ce8b5d61965ad Mon Sep 17 00:00:00 2001 From: euvl Date: Fri, 10 Mar 2017 16:12:20 +0000 Subject: [PATCH] Added minWidth and minHeigh, updated example --- Modal/Modal.vue | 19 +++++++++++++------ Modal/Resizer.vue | 30 ++++++++++++++---------------- examples/src/App.vue | 34 +++++++++++++++++++++++++++++++++- 3 files changed, 60 insertions(+), 23 deletions(-) diff --git a/Modal/Modal.vue b/Modal/Modal.vue index 7f113d1..f6ab9bf 100644 --- a/Modal/Modal.vue +++ b/Modal/Modal.vue @@ -10,7 +10,10 @@ v-on:mousedown.stop ref="modal"> - + @@ -118,8 +121,8 @@ computed: { position() { return { - left: (this.window.width - this.modal.width) / 2, - top: (this.window.height - this.modal.height) / 2 + left: Math.max((this.window.width - this.modal.width) / 2, 0), + top: Math.max((this.window.height - this.modal.height) / 2, 0) } }, modalClass() { @@ -140,13 +143,17 @@ this.window.height = window.innerHeight; if (this.adaptive) { - this.modal.width = this.window.width > this.width + var width = this.window.width > this.width ? this.width : this.window.width - this.modal.height = this.window.height > this.height + /*this.modal.height*/ + var height = this.window.height > this.height ? this.height : this.window.height; + + this.modal.width = width;//Math.max(width, this.minWidth); + this.modal.height = height;//Math.max(height, this.minHeight); } }, genEventObject(params) { @@ -224,7 +231,7 @@ } .nice-modal-fade-enter-active, .nice-modal-fade-leave-active { - transition: all 0.5s; + transition: all 0.4s; } .nice-modal-fade-enter, .nice-modal-fade-leave-active { diff --git a/Modal/Resizer.vue b/Modal/Resizer.vue index 4a3b166..dba3f93 100644 --- a/Modal/Resizer.vue +++ b/Modal/Resizer.vue @@ -5,13 +5,18 @@